All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-25 16:28 ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

	Hi Rafael, Simon, Magnus,

This patch series enables DT support for PM domains on Renesas R-Mobile SoCs.

Currently it's limited to R-Mobile A1 (r8a7740), but given the similarity of
the SYSC System-Controller on the various SH-Mobile/R-Mobile SoCs, and the
abstraction of PM domains in DT, it should be sufficiently generic to handle
other SoCs in the future (e.g. SH-Mobile AP4 (sh7372), SH-Mobile AG5 (sh73a0),
R-Mobile APE6 (r8a73a4)).

Changes compared to v2 (more detailed changelogs in the individual patches):
  - Minor changes to attach/detach callbacks,
  - Really add the A4MP and D4 PM domains, as fixes are available (see
    dependencies below),
  - Scan DT topology to identify special PM domains (CPUs and console),
  - Move PM domain power-on/off latencies to a separate patch.

Changes compared to v1 (more detailed changelogs in the individual patches):
  - Several new patches: PM QoS device latencies in DT, attach/detach
    callbacks,
  - Run-Time management of the module clocks, making the hack in
    drivers/sh/pm_runtime.c obsolete for DT platforms using genpd,
  - Addition of PM QoS device latencies, specified from DT,
  - Addition of build glue, so this builds and runs without additional
    changes, incl. s2ram.

This means that functionality-wise, the DT version is now on par with the
legacy version ("[PATCH v2 00/11] ARM: shmobile: r8a7740/armadillo800eva legacy
PM domain support").

Dependencies:
  - Simon Horman's renesas-devel-20140924-v3.17-rc6,
  - Rafael J. Wysocki's linux-pm.git#linux-next,
  - Jason Cooper's linux.git#irqchip/for-next.
  - "ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain"
    depends on the legacy version of this series, but if the legacy version
    will never be accepted, the conflicts are trivial to resolve (drop changes
    to non-existing PM domains),
  - Working resume from s2ram depends on:
      - "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq re-enable
	on resume",
      - "[PATCH] ARM: hw_breakpoint: Trap undef instruction exceptions on
	wake-up", or an alternative solution.
  - Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
    shmobile: armadillo800eva dts: Add chosen/stdout-path".

For your convenience, I've also pushed this (incl. its dependencies) to
git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git#rmobile-genpd

Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
would be good to get this patch in v3.18-rc1, as it's the only hard dependency
on linux-pm.git for the rest of this series. The other parts have relaxed
ordering constraints due to the separation of code and DTS.

Question: Can we use the preliminary PM domain power-on/off and QoS device
latencie patches (the last 2) as-is, or should we refine them first?

Thanks!

Geert Uytterhoeven (13):
  PM / Domains: Add genpd attach/detach callbacks
  PM / Domains: Add DT bindings for power-on/off latencies
  PM / Domains: Add DT bindings for PM QoS device latencies
  PM / Domains: Add DT bindings for the R-Mobile System Controller
  PM / Domains: Add helper variable np = dev->of_node
  PM / Domains: Retrieve PM QoS device latencies from DT
  ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk
    setup
  ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
  ARM: shmobile: R-Mobile: Add DT support for PM domains
  ARM: shmobile: r8a7740 dtsi: Add PM domain support
  drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd
  ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies
  ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies

 .../devicetree/bindings/power/power_domain.txt     |  16 ++
 .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++
 arch/arm/boot/dts/r8a7740.dtsi                     | 257 +++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig                     |   3 +-
 arch/arm/mach-shmobile/pm-r8a7740.c                |  14 ++
 arch/arm/mach-shmobile/pm-rmobile.c                | 236 +++++++++++++++++--
 arch/arm/mach-shmobile/pm-rmobile.h                |   3 +-
 arch/arm/mach-shmobile/pm-sh7372.c                 |  11 +
 drivers/base/power/domain.c                        |  32 ++-
 drivers/sh/pm_runtime.c                            |   2 +
 include/linux/pm_domain.h                          |   2 +
 11 files changed, 663 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-25 16:28 ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

	Hi Rafael, Simon, Magnus,

This patch series enables DT support for PM domains on Renesas R-Mobile SoCs.

Currently it's limited to R-Mobile A1 (r8a7740), but given the similarity of
the SYSC System-Controller on the various SH-Mobile/R-Mobile SoCs, and the
abstraction of PM domains in DT, it should be sufficiently generic to handle
other SoCs in the future (e.g. SH-Mobile AP4 (sh7372), SH-Mobile AG5 (sh73a0),
R-Mobile APE6 (r8a73a4)).

Changes compared to v2 (more detailed changelogs in the individual patches):
  - Minor changes to attach/detach callbacks,
  - Really add the A4MP and D4 PM domains, as fixes are available (see
    dependencies below),
  - Scan DT topology to identify special PM domains (CPUs and console),
  - Move PM domain power-on/off latencies to a separate patch.

Changes compared to v1 (more detailed changelogs in the individual patches):
  - Several new patches: PM QoS device latencies in DT, attach/detach
    callbacks,
  - Run-Time management of the module clocks, making the hack in
    drivers/sh/pm_runtime.c obsolete for DT platforms using genpd,
  - Addition of PM QoS device latencies, specified from DT,
  - Addition of build glue, so this builds and runs without additional
    changes, incl. s2ram.

This means that functionality-wise, the DT version is now on par with the
legacy version ("[PATCH v2 00/11] ARM: shmobile: r8a7740/armadillo800eva legacy
PM domain support").

Dependencies:
  - Simon Horman's renesas-devel-20140924-v3.17-rc6,
  - Rafael J. Wysocki's linux-pm.git#linux-next,
  - Jason Cooper's linux.git#irqchip/for-next.
  - "ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain"
    depends on the legacy version of this series, but if the legacy version
    will never be accepted, the conflicts are trivial to resolve (drop changes
    to non-existing PM domains),
  - Working resume from s2ram depends on:
      - "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq re-enable
	on resume",
      - "[PATCH] ARM: hw_breakpoint: Trap undef instruction exceptions on
	wake-up", or an alternative solution.
  - Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
    shmobile: armadillo800eva dts: Add chosen/stdout-path".

For your convenience, I've also pushed this (incl. its dependencies) to
git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git#rmobile-genpd

Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
would be good to get this patch in v3.18-rc1, as it's the only hard dependency
on linux-pm.git for the rest of this series. The other parts have relaxed
ordering constraints due to the separation of code and DTS.

Question: Can we use the preliminary PM domain power-on/off and QoS device
latencie patches (the last 2) as-is, or should we refine them first?

Thanks!

Geert Uytterhoeven (13):
  PM / Domains: Add genpd attach/detach callbacks
  PM / Domains: Add DT bindings for power-on/off latencies
  PM / Domains: Add DT bindings for PM QoS device latencies
  PM / Domains: Add DT bindings for the R-Mobile System Controller
  PM / Domains: Add helper variable np = dev->of_node
  PM / Domains: Retrieve PM QoS device latencies from DT
  ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk
    setup
  ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
  ARM: shmobile: R-Mobile: Add DT support for PM domains
  ARM: shmobile: r8a7740 dtsi: Add PM domain support
  drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd
  ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies
  ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies

 .../devicetree/bindings/power/power_domain.txt     |  16 ++
 .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++
 arch/arm/boot/dts/r8a7740.dtsi                     | 257 +++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig                     |   3 +-
 arch/arm/mach-shmobile/pm-r8a7740.c                |  14 ++
 arch/arm/mach-shmobile/pm-rmobile.c                | 236 +++++++++++++++++--
 arch/arm/mach-shmobile/pm-rmobile.h                |   3 +-
 arch/arm/mach-shmobile/pm-sh7372.c                 |  11 +
 drivers/base/power/domain.c                        |  32 ++-
 drivers/sh/pm_runtime.c                            |   2 +
 include/linux/pm_domain.h                          |   2 +
 11 files changed, 663 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-25 16:28 ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

	Hi Rafael, Simon, Magnus,

This patch series enables DT support for PM domains on Renesas R-Mobile SoCs.

Currently it's limited to R-Mobile A1 (r8a7740), but given the similarity of
the SYSC System-Controller on the various SH-Mobile/R-Mobile SoCs, and the
abstraction of PM domains in DT, it should be sufficiently generic to handle
other SoCs in the future (e.g. SH-Mobile AP4 (sh7372), SH-Mobile AG5 (sh73a0),
R-Mobile APE6 (r8a73a4)).

Changes compared to v2 (more detailed changelogs in the individual patches):
  - Minor changes to attach/detach callbacks,
  - Really add the A4MP and D4 PM domains, as fixes are available (see
    dependencies below),
  - Scan DT topology to identify special PM domains (CPUs and console),
  - Move PM domain power-on/off latencies to a separate patch.

Changes compared to v1 (more detailed changelogs in the individual patches):
  - Several new patches: PM QoS device latencies in DT, attach/detach
    callbacks,
  - Run-Time management of the module clocks, making the hack in
    drivers/sh/pm_runtime.c obsolete for DT platforms using genpd,
  - Addition of PM QoS device latencies, specified from DT,
  - Addition of build glue, so this builds and runs without additional
    changes, incl. s2ram.

This means that functionality-wise, the DT version is now on par with the
legacy version ("[PATCH v2 00/11] ARM: shmobile: r8a7740/armadillo800eva legacy
PM domain support").

Dependencies:
  - Simon Horman's renesas-devel-20140924-v3.17-rc6,
  - Rafael J. Wysocki's linux-pm.git#linux-next,
  - Jason Cooper's linux.git#irqchip/for-next.
  - "ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain"
    depends on the legacy version of this series, but if the legacy version
    will never be accepted, the conflicts are trivial to resolve (drop changes
    to non-existing PM domains),
  - Working resume from s2ram depends on:
      - "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq re-enable
	on resume",
      - "[PATCH] ARM: hw_breakpoint: Trap undef instruction exceptions on
	wake-up", or an alternative solution.
  - Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
    shmobile: armadillo800eva dts: Add chosen/stdout-path".

For your convenience, I've also pushed this (incl. its dependencies) to
git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git#rmobile-genpd

Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
would be good to get this patch in v3.18-rc1, as it's the only hard dependency
on linux-pm.git for the rest of this series. The other parts have relaxed
ordering constraints due to the separation of code and DTS.

Question: Can we use the preliminary PM domain power-on/off and QoS device
latencie patches (the last 2) as-is, or should we refine them first?

Thanks!

Geert Uytterhoeven (13):
  PM / Domains: Add genpd attach/detach callbacks
  PM / Domains: Add DT bindings for power-on/off latencies
  PM / Domains: Add DT bindings for PM QoS device latencies
  PM / Domains: Add DT bindings for the R-Mobile System Controller
  PM / Domains: Add helper variable np = dev->of_node
  PM / Domains: Retrieve PM QoS device latencies from DT
  ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk
    setup
  ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
  ARM: shmobile: R-Mobile: Add DT support for PM domains
  ARM: shmobile: r8a7740 dtsi: Add PM domain support
  drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd
  ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies
  ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies

 .../devicetree/bindings/power/power_domain.txt     |  16 ++
 .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++
 arch/arm/boot/dts/r8a7740.dtsi                     | 257 +++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig                     |   3 +-
 arch/arm/mach-shmobile/pm-r8a7740.c                |  14 ++
 arch/arm/mach-shmobile/pm-rmobile.c                | 236 +++++++++++++++++--
 arch/arm/mach-shmobile/pm-rmobile.h                |   3 +-
 arch/arm/mach-shmobile/pm-sh7372.c                 |  11 +
 drivers/base/power/domain.c                        |  32 ++-
 drivers/sh/pm_runtime.c                            |   2 +
 include/linux/pm_domain.h                          |   2 +
 11 files changed, 663 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

While a PM domain can enable PM runtime management of its devices' module
clocks by setting

	genpd->dev_ops.stop = pm_clk_suspend;
	genpd->dev_ops.start = pm_clk_resume;

this also requires registering the clocks with the pm_clk subsystem.
In the legacy case, this is handled by the platform code, after
attaching the device to its PM domain.

When the devices are instantiated from DT, devices are attached to their
PM domains by generic code, leaving no method for the platform-specific
PM domain code to register their clocks.

Add two callbacks, allowing a PM domain to perform platform-specific
tasks when a device is attached to or detached from a PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
---
v3:
  - Add Reviewed-by (Ulf: are you still OK with the changes in v3?)
  - Move calling of the callbacks to a point where dev->pm_domain is
    valid, so the domain parameter is no longer needed,
  - Make callbacks return void.
v2:
  - New

 drivers/base/power/domain.c | 6 ++++++
 include/linux/pm_domain.h   | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index cd400575ee0ee89c..6e36bb09e7d9c144 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1436,6 +1436,9 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
 
 	spin_unlock_irq(&dev->power.lock);
 
+	if (genpd->attach_dev)
+		genpd->attach_dev(dev);
+
 	mutex_lock(&gpd_data->lock);
 	gpd_data->base.dev = dev;
 	list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
@@ -1528,6 +1531,9 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
 	genpd->device_count--;
 	genpd->max_off_time_changed = true;
 
+	if (genpd->detach_dev)
+		genpd->detach_dev(dev);
+
 	spin_lock_irq(&dev->power.lock);
 
 	dev->pm_domain = NULL;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 292079d8da6b8a78..9a93e622bdea3f79 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -73,6 +73,8 @@ struct generic_pm_domain {
 	bool cached_power_down_ok;
 	struct device_node *of_node; /* Node in device tree */
 	struct gpd_cpu_data *cpu_data;
+	void (*attach_dev)(struct device *dev);
+	void (*detach_dev)(struct device *dev);
 };
 
 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
-- 
1.9.1


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

* [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

While a PM domain can enable PM runtime management of its devices' module
clocks by setting

	genpd->dev_ops.stop = pm_clk_suspend;
	genpd->dev_ops.start = pm_clk_resume;

this also requires registering the clocks with the pm_clk subsystem.
In the legacy case, this is handled by the platform code, after
attaching the device to its PM domain.

When the devices are instantiated from DT, devices are attached to their
PM domains by generic code, leaving no method for the platform-specific
PM domain code to register their clocks.

Add two callbacks, allowing a PM domain to perform platform-specific
tasks when a device is attached to or detached from a PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
---
v3:
  - Add Reviewed-by (Ulf: are you still OK with the changes in v3?)
  - Move calling of the callbacks to a point where dev->pm_domain is
    valid, so the domain parameter is no longer needed,
  - Make callbacks return void.
v2:
  - New

 drivers/base/power/domain.c | 6 ++++++
 include/linux/pm_domain.h   | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index cd400575ee0ee89c..6e36bb09e7d9c144 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1436,6 +1436,9 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
 
 	spin_unlock_irq(&dev->power.lock);
 
+	if (genpd->attach_dev)
+		genpd->attach_dev(dev);
+
 	mutex_lock(&gpd_data->lock);
 	gpd_data->base.dev = dev;
 	list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
@@ -1528,6 +1531,9 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
 	genpd->device_count--;
 	genpd->max_off_time_changed = true;
 
+	if (genpd->detach_dev)
+		genpd->detach_dev(dev);
+
 	spin_lock_irq(&dev->power.lock);
 
 	dev->pm_domain = NULL;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 292079d8da6b8a78..9a93e622bdea3f79 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -73,6 +73,8 @@ struct generic_pm_domain {
 	bool cached_power_down_ok;
 	struct device_node *of_node; /* Node in device tree */
 	struct gpd_cpu_data *cpu_data;
+	void (*attach_dev)(struct device *dev);
+	void (*detach_dev)(struct device *dev);
 };
 
 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
-- 
1.9.1


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

* [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh-u79uwXL29TY76Z2rM5mHXA,
	linux-pm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

While a PM domain can enable PM runtime management of its devices' module
clocks by setting

	genpd->dev_ops.stop = pm_clk_suspend;
	genpd->dev_ops.start = pm_clk_resume;

this also requires registering the clocks with the pm_clk subsystem.
In the legacy case, this is handled by the platform code, after
attaching the device to its PM domain.

When the devices are instantiated from DT, devices are attached to their
PM domains by generic code, leaving no method for the platform-specific
PM domain code to register their clocks.

Add two callbacks, allowing a PM domain to perform platform-specific
tasks when a device is attached to or detached from a PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
Reviewed-by: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
v3:
  - Add Reviewed-by (Ulf: are you still OK with the changes in v3?)
  - Move calling of the callbacks to a point where dev->pm_domain is
    valid, so the domain parameter is no longer needed,
  - Make callbacks return void.
v2:
  - New

 drivers/base/power/domain.c | 6 ++++++
 include/linux/pm_domain.h   | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index cd400575ee0ee89c..6e36bb09e7d9c144 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1436,6 +1436,9 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
 
 	spin_unlock_irq(&dev->power.lock);
 
+	if (genpd->attach_dev)
+		genpd->attach_dev(dev);
+
 	mutex_lock(&gpd_data->lock);
 	gpd_data->base.dev = dev;
 	list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
@@ -1528,6 +1531,9 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
 	genpd->device_count--;
 	genpd->max_off_time_changed = true;
 
+	if (genpd->detach_dev)
+		genpd->detach_dev(dev);
+
 	spin_lock_irq(&dev->power.lock);
 
 	dev->pm_domain = NULL;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 292079d8da6b8a78..9a93e622bdea3f79 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -73,6 +73,8 @@ struct generic_pm_domain {
 	bool cached_power_down_ok;
 	struct device_node *of_node; /* Node in device tree */
 	struct gpd_cpu_data *cpu_data;
+	void (*attach_dev)(struct device *dev);
+	void (*detach_dev)(struct device *dev);
 };
 
 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

While a PM domain can enable PM runtime management of its devices' module
clocks by setting

	genpd->dev_ops.stop = pm_clk_suspend;
	genpd->dev_ops.start = pm_clk_resume;

this also requires registering the clocks with the pm_clk subsystem.
In the legacy case, this is handled by the platform code, after
attaching the device to its PM domain.

When the devices are instantiated from DT, devices are attached to their
PM domains by generic code, leaving no method for the platform-specific
PM domain code to register their clocks.

Add two callbacks, allowing a PM domain to perform platform-specific
tasks when a device is attached to or detached from a PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
---
v3:
  - Add Reviewed-by (Ulf: are you still OK with the changes in v3?)
  - Move calling of the callbacks to a point where dev->pm_domain is
    valid, so the domain parameter is no longer needed,
  - Make callbacks return void.
v2:
  - New

 drivers/base/power/domain.c | 6 ++++++
 include/linux/pm_domain.h   | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index cd400575ee0ee89c..6e36bb09e7d9c144 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1436,6 +1436,9 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
 
 	spin_unlock_irq(&dev->power.lock);
 
+	if (genpd->attach_dev)
+		genpd->attach_dev(dev);
+
 	mutex_lock(&gpd_data->lock);
 	gpd_data->base.dev = dev;
 	list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
@@ -1528,6 +1531,9 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
 	genpd->device_count--;
 	genpd->max_off_time_changed = true;
 
+	if (genpd->detach_dev)
+		genpd->detach_dev(dev);
+
 	spin_lock_irq(&dev->power.lock);
 
 	dev->pm_domain = NULL;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 292079d8da6b8a78..9a93e622bdea3f79 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -73,6 +73,8 @@ struct generic_pm_domain {
 	bool cached_power_down_ok;
 	struct device_node *of_node; /* Node in device tree */
 	struct gpd_cpu_data *cpu_data;
+	void (*attach_dev)(struct device *dev);
+	void (*detach_dev)(struct device *dev);
 };
 
 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
-- 
1.9.1

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

* [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

PM domain power on/off-latencies are properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kevin Hilman <khilman@linaro.org>
---
v3:
  - No changes
v2:
  - Add Acked-by

 Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 98c16672ab5f49e0..7bc421d84367d636 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -19,12 +19,18 @@ Required properties:
    providing multiple PM domains (e.g. power controllers), but can be any value
    as specified by device tree binding documentation of particular provider.
 
+Optional properties:
+ - power-on-latency: Power-on latency of the PM domain, in ns,
+ - power-off-latency: Power-off latency of the PM domain, in ns.
+
 Example:
 
 	power: power-controller@12340000 {
 		compatible = "foo,power-controller";
 		reg = <0x12340000 0x1000>;
 		#power-domain-cells = <1>;
+		power-on-latency = <250000>;
+		power-off-latency = <250000>;
 	};
 
 The node above defines a power controller that is a PM domain provider and
-- 
1.9.1


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

* [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

PM domain power on/off-latencies are properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kevin Hilman <khilman@linaro.org>
---
v3:
  - No changes
v2:
  - Add Acked-by

 Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 98c16672ab5f49e0..7bc421d84367d636 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -19,12 +19,18 @@ Required properties:
    providing multiple PM domains (e.g. power controllers), but can be any value
    as specified by device tree binding documentation of particular provider.
 
+Optional properties:
+ - power-on-latency: Power-on latency of the PM domain, in ns,
+ - power-off-latency: Power-off latency of the PM domain, in ns.
+
 Example:
 
 	power: power-controller@12340000 {
 		compatible = "foo,power-controller";
 		reg = <0x12340000 0x1000>;
 		#power-domain-cells = <1>;
+		power-on-latency = <250000>;
+		power-off-latency = <250000>;
 	};
 
 The node above defines a power controller that is a PM domain provider and
-- 
1.9.1


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

* [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: devicetree, Ulf Hansson, Kevin Hilman, Geert Uytterhoeven,
	linux-sh, linux-pm, Tomasz Figa, linux-kernel, Grygorii Strashko,
	Philipp Zabel, linux-arm-kernel

PM domain power on/off-latencies are properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kevin Hilman <khilman@linaro.org>
---
v3:
  - No changes
v2:
  - Add Acked-by

 Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 98c16672ab5f49e0..7bc421d84367d636 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -19,12 +19,18 @@ Required properties:
    providing multiple PM domains (e.g. power controllers), but can be any value
    as specified by device tree binding documentation of particular provider.
 
+Optional properties:
+ - power-on-latency: Power-on latency of the PM domain, in ns,
+ - power-off-latency: Power-off latency of the PM domain, in ns.
+
 Example:
 
 	power: power-controller@12340000 {
 		compatible = "foo,power-controller";
 		reg = <0x12340000 0x1000>;
 		#power-domain-cells = <1>;
+		power-on-latency = <250000>;
+		power-off-latency = <250000>;
 	};
 
 The node above defines a power controller that is a PM domain provider and
-- 
1.9.1

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

* [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

PM domain power on/off-latencies are properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kevin Hilman <khilman@linaro.org>
---
v3:
  - No changes
v2:
  - Add Acked-by

 Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 98c16672ab5f49e0..7bc421d84367d636 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -19,12 +19,18 @@ Required properties:
    providing multiple PM domains (e.g. power controllers), but can be any value
    as specified by device tree binding documentation of particular provider.
 
+Optional properties:
+ - power-on-latency: Power-on latency of the PM domain, in ns,
+ - power-off-latency: Power-off latency of the PM domain, in ns.
+
 Example:
 
 	power: power-controller at 12340000 {
 		compatible = "foo,power-controller";
 		reg = <0x12340000 0x1000>;
 		#power-domain-cells = <1>;
+		power-on-latency = <250000>;
+		power-off-latency = <250000>;
 	};
 
 The node above defines a power controller that is a PM domain provider and
-- 
1.9.1

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

* [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

PM QoS device start/stop and save/restore state latencies are more or
less properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Should these properties be called "linux,*-latency"?

v3:
  - No changes
v2:
  - New

 Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 7bc421d84367d636..024815bc257723b1 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -42,12 +42,22 @@ Required properties:
  - power-domains : A phandle and PM domain specifier as defined by bindings of
                    the power controller specified by phandle.
 
+Optional properties:
+ - stop-latency: Stop latency of the device, in ns,
+ - start-latency: Start latency of the device, in ns,
+ - save-state-latency: Save-state latency of the device, in ns,
+ - restore-state-latency: Restore-state latency of the device, in ns.
+
 Example:
 
 	leaky-device@12350000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12350000 0x1000>;
 		power-domains = <&power 0>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 The node above defines a typical PM domain consumer device, which is located
-- 
1.9.1


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

* [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

PM QoS device start/stop and save/restore state latencies are more or
less properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Should these properties be called "linux,*-latency"?

v3:
  - No changes
v2:
  - New

 Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 7bc421d84367d636..024815bc257723b1 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -42,12 +42,22 @@ Required properties:
  - power-domains : A phandle and PM domain specifier as defined by bindings of
                    the power controller specified by phandle.
 
+Optional properties:
+ - stop-latency: Stop latency of the device, in ns,
+ - start-latency: Start latency of the device, in ns,
+ - save-state-latency: Save-state latency of the device, in ns,
+ - restore-state-latency: Restore-state latency of the device, in ns.
+
 Example:
 
 	leaky-device@12350000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12350000 0x1000>;
 		power-domains = <&power 0>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 The node above defines a typical PM domain consumer device, which is located
-- 
1.9.1


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

* [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: devicetree, Ulf Hansson, Kevin Hilman, Geert Uytterhoeven,
	linux-sh, linux-pm, Tomasz Figa, linux-kernel, Grygorii Strashko,
	Philipp Zabel, linux-arm-kernel

PM QoS device start/stop and save/restore state latencies are more or
less properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Should these properties be called "linux,*-latency"?

v3:
  - No changes
v2:
  - New

 Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 7bc421d84367d636..024815bc257723b1 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -42,12 +42,22 @@ Required properties:
  - power-domains : A phandle and PM domain specifier as defined by bindings of
                    the power controller specified by phandle.
 
+Optional properties:
+ - stop-latency: Stop latency of the device, in ns,
+ - start-latency: Start latency of the device, in ns,
+ - save-state-latency: Save-state latency of the device, in ns,
+ - restore-state-latency: Restore-state latency of the device, in ns.
+
 Example:
 
 	leaky-device@12350000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12350000 0x1000>;
 		power-domains = <&power 0>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 The node above defines a typical PM domain consumer device, which is located
-- 
1.9.1

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

* [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

PM QoS device start/stop and save/restore state latencies are more or
less properties of the hardware.
In legacy code, they're specified from platform code.
On DT platforms, their values should come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Should these properties be called "linux,*-latency"?

v3:
  - No changes
v2:
  - New

 Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 7bc421d84367d636..024815bc257723b1 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -42,12 +42,22 @@ Required properties:
  - power-domains : A phandle and PM domain specifier as defined by bindings of
                    the power controller specified by phandle.
 
+Optional properties:
+ - stop-latency: Stop latency of the device, in ns,
+ - start-latency: Start latency of the device, in ns,
+ - save-state-latency: Save-state latency of the device, in ns,
+ - restore-state-latency: Restore-state latency of the device, in ns.
+
 Example:
 
 	leaky-device at 12350000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12350000 0x1000>;
 		power-domains = <&power 0>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 The node above defines a typical PM domain consumer device, which is located
-- 
1.9.1

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

* [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

The Renesas R-Mobile System Controller provides a.o. power management
support, following the generic PM domain bindings in
Documentation/devicetree/bindings/power/power_domain.txt.

For now this supports the R-Mobile A1 (r8a7740) only, but it should be
sufficiently generic to handle other members of the SH-Mobile/R-Mobile
family in the future.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword,
v2:
  - Fix copy-and-paste s/#address-cells/#size-cells/,
  - Add optional PM QoS device latencies.

 .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt

diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
new file mode 100644
index 0000000000000000..0b1e56d6ed1ab9a2
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
@@ -0,0 +1,111 @@
+DT bindings for the Renesas R-Mobile System Controller
+
+= System Controller Node =
+
+The R-Mobile System Controller provides the following functions:
+  - Boot mode management,
+  - Reset generation,
+  - Power management.
+
+Required properties:
+- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
+	      fallback.
+	      Examples with soctypes are:
+		- "renesas,sysc-r8a7740" (R-Mobile A1)
+- reg: Two address start and address range blocks for the device:
+         - The first block refers to the normally accessible registers,
+         - the second block refers to the registers protected by the HPB
+	   semaphore.
+
+Optional nodes:
+- pm-domains: This node contains a hierarchy of PM domain nodes, which should
+  match the Power Area Hierarchy in the Power Domain Specifications section of
+  the device's datasheet.
+
+
+= PM Domain Nodes =
+
+Each of the PM domain nodes represents a PM domain, as documented by the
+generic PM domain bindings in
+Documentation/devicetree/bindings/power/power_domain.txt.
+
+The nodes should be named by the real power area names, and thus their names
+should be unique.
+
+Required properties:
+  - #power-domain-cells: Must be 0.
+
+Optional properties:
+- reg: If the PM domain is not always-on, this property must contain the bit
+       index number for the corresponding power area in the various Power
+       Control and Status Registers. The parent's node must contain the
+       following two properties:
+	 - #address-cells: Must be 1,
+	 - #size-cells: Must be 0.
+       If the PM domain is always-on, this property must be omitted.
+- power-on-latency: Power-on latency of the PM domain, in ns,
+- power-off-latency: Power-off latency of the PM domain, in ns.
+
+
+Example:
+
+This shows a subset of the r8a7740 PM domain hierarchy, containing the
+C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
+which is a subdomain of A4S.
+
+	sysc: system-controller@e6180000 {
+		compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
+		reg = <0xe6180000 8000>, <0xe6188000 8000>;
+
+		pm-domains {
+			pd_c5: c5 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				#power-domain-cells = <0>;
+
+				pd_a4s: a4s@10 {
+					reg = <10>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+
+					pd_a3sp: a3sp@11 {
+						reg = <11>;
+						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
+					};
+				};
+
+				pd_a4su: a4su@20 {
+					reg = <20>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+				};
+			};
+		};
+	};
+
+
+= PM Domain Consumers =
+
+Hardware blocks belonging to a PM domain should contain a "power-domains"
+property that is a phandle pointing to the corresponding PM domain node,
+and optional PM QoS device latencies:
+
+Example:
+
+	tpu: pwm@e6600000 {
+		compatible = "renesas,tpu-r8a7740", "renesas,tpu";
+		reg = <0xe6600000 0x100>;
+		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
+		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
+		#pwm-cells = <3>;
+	};
-- 
1.9.1


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

* [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

The Renesas R-Mobile System Controller provides a.o. power management
support, following the generic PM domain bindings in
Documentation/devicetree/bindings/power/power_domain.txt.

For now this supports the R-Mobile A1 (r8a7740) only, but it should be
sufficiently generic to handle other members of the SH-Mobile/R-Mobile
family in the future.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword,
v2:
  - Fix copy-and-paste s/#address-cells/#size-cells/,
  - Add optional PM QoS device latencies.

 .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt

diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
new file mode 100644
index 0000000000000000..0b1e56d6ed1ab9a2
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
@@ -0,0 +1,111 @@
+DT bindings for the Renesas R-Mobile System Controller
+
+== System Controller Node ==
+
+The R-Mobile System Controller provides the following functions:
+  - Boot mode management,
+  - Reset generation,
+  - Power management.
+
+Required properties:
+- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
+	      fallback.
+	      Examples with soctypes are:
+		- "renesas,sysc-r8a7740" (R-Mobile A1)
+- reg: Two address start and address range blocks for the device:
+         - The first block refers to the normally accessible registers,
+         - the second block refers to the registers protected by the HPB
+	   semaphore.
+
+Optional nodes:
+- pm-domains: This node contains a hierarchy of PM domain nodes, which should
+  match the Power Area Hierarchy in the Power Domain Specifications section of
+  the device's datasheet.
+
+
+== PM Domain Nodes ==
+
+Each of the PM domain nodes represents a PM domain, as documented by the
+generic PM domain bindings in
+Documentation/devicetree/bindings/power/power_domain.txt.
+
+The nodes should be named by the real power area names, and thus their names
+should be unique.
+
+Required properties:
+  - #power-domain-cells: Must be 0.
+
+Optional properties:
+- reg: If the PM domain is not always-on, this property must contain the bit
+       index number for the corresponding power area in the various Power
+       Control and Status Registers. The parent's node must contain the
+       following two properties:
+	 - #address-cells: Must be 1,
+	 - #size-cells: Must be 0.
+       If the PM domain is always-on, this property must be omitted.
+- power-on-latency: Power-on latency of the PM domain, in ns,
+- power-off-latency: Power-off latency of the PM domain, in ns.
+
+
+Example:
+
+This shows a subset of the r8a7740 PM domain hierarchy, containing the
+C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
+which is a subdomain of A4S.
+
+	sysc: system-controller@e6180000 {
+		compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
+		reg = <0xe6180000 8000>, <0xe6188000 8000>;
+
+		pm-domains {
+			pd_c5: c5 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				#power-domain-cells = <0>;
+
+				pd_a4s: a4s@10 {
+					reg = <10>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+
+					pd_a3sp: a3sp@11 {
+						reg = <11>;
+						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
+					};
+				};
+
+				pd_a4su: a4su@20 {
+					reg = <20>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+				};
+			};
+		};
+	};
+
+
+== PM Domain Consumers ==
+
+Hardware blocks belonging to a PM domain should contain a "power-domains"
+property that is a phandle pointing to the corresponding PM domain node,
+and optional PM QoS device latencies:
+
+Example:
+
+	tpu: pwm@e6600000 {
+		compatible = "renesas,tpu-r8a7740", "renesas,tpu";
+		reg = <0xe6600000 0x100>;
+		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
+		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
+		#pwm-cells = <3>;
+	};
-- 
1.9.1


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

* [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: devicetree, Ulf Hansson, Kevin Hilman, Geert Uytterhoeven,
	linux-sh, linux-pm, Tomasz Figa, linux-kernel, Grygorii Strashko,
	Philipp Zabel, linux-arm-kernel

The Renesas R-Mobile System Controller provides a.o. power management
support, following the generic PM domain bindings in
Documentation/devicetree/bindings/power/power_domain.txt.

For now this supports the R-Mobile A1 (r8a7740) only, but it should be
sufficiently generic to handle other members of the SH-Mobile/R-Mobile
family in the future.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword,
v2:
  - Fix copy-and-paste s/#address-cells/#size-cells/,
  - Add optional PM QoS device latencies.

 .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt

diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
new file mode 100644
index 0000000000000000..0b1e56d6ed1ab9a2
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
@@ -0,0 +1,111 @@
+DT bindings for the Renesas R-Mobile System Controller
+
+== System Controller Node ==
+
+The R-Mobile System Controller provides the following functions:
+  - Boot mode management,
+  - Reset generation,
+  - Power management.
+
+Required properties:
+- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
+	      fallback.
+	      Examples with soctypes are:
+		- "renesas,sysc-r8a7740" (R-Mobile A1)
+- reg: Two address start and address range blocks for the device:
+         - The first block refers to the normally accessible registers,
+         - the second block refers to the registers protected by the HPB
+	   semaphore.
+
+Optional nodes:
+- pm-domains: This node contains a hierarchy of PM domain nodes, which should
+  match the Power Area Hierarchy in the Power Domain Specifications section of
+  the device's datasheet.
+
+
+== PM Domain Nodes ==
+
+Each of the PM domain nodes represents a PM domain, as documented by the
+generic PM domain bindings in
+Documentation/devicetree/bindings/power/power_domain.txt.
+
+The nodes should be named by the real power area names, and thus their names
+should be unique.
+
+Required properties:
+  - #power-domain-cells: Must be 0.
+
+Optional properties:
+- reg: If the PM domain is not always-on, this property must contain the bit
+       index number for the corresponding power area in the various Power
+       Control and Status Registers. The parent's node must contain the
+       following two properties:
+	 - #address-cells: Must be 1,
+	 - #size-cells: Must be 0.
+       If the PM domain is always-on, this property must be omitted.
+- power-on-latency: Power-on latency of the PM domain, in ns,
+- power-off-latency: Power-off latency of the PM domain, in ns.
+
+
+Example:
+
+This shows a subset of the r8a7740 PM domain hierarchy, containing the
+C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
+which is a subdomain of A4S.
+
+	sysc: system-controller@e6180000 {
+		compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
+		reg = <0xe6180000 8000>, <0xe6188000 8000>;
+
+		pm-domains {
+			pd_c5: c5 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				#power-domain-cells = <0>;
+
+				pd_a4s: a4s@10 {
+					reg = <10>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+
+					pd_a3sp: a3sp@11 {
+						reg = <11>;
+						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
+					};
+				};
+
+				pd_a4su: a4su@20 {
+					reg = <20>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+				};
+			};
+		};
+	};
+
+
+== PM Domain Consumers ==
+
+Hardware blocks belonging to a PM domain should contain a "power-domains"
+property that is a phandle pointing to the corresponding PM domain node,
+and optional PM QoS device latencies:
+
+Example:
+
+	tpu: pwm@e6600000 {
+		compatible = "renesas,tpu-r8a7740", "renesas,tpu";
+		reg = <0xe6600000 0x100>;
+		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
+		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
+		#pwm-cells = <3>;
+	};
-- 
1.9.1

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

* [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

The Renesas R-Mobile System Controller provides a.o. power management
support, following the generic PM domain bindings in
Documentation/devicetree/bindings/power/power_domain.txt.

For now this supports the R-Mobile A1 (r8a7740) only, but it should be
sufficiently generic to handle other members of the SH-Mobile/R-Mobile
family in the future.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword,
v2:
  - Fix copy-and-paste s/#address-cells/#size-cells/,
  - Add optional PM QoS device latencies.

 .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt

diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
new file mode 100644
index 0000000000000000..0b1e56d6ed1ab9a2
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
@@ -0,0 +1,111 @@
+DT bindings for the Renesas R-Mobile System Controller
+
+== System Controller Node ==
+
+The R-Mobile System Controller provides the following functions:
+  - Boot mode management,
+  - Reset generation,
+  - Power management.
+
+Required properties:
+- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
+	      fallback.
+	      Examples with soctypes are:
+		- "renesas,sysc-r8a7740" (R-Mobile A1)
+- reg: Two address start and address range blocks for the device:
+         - The first block refers to the normally accessible registers,
+         - the second block refers to the registers protected by the HPB
+	   semaphore.
+
+Optional nodes:
+- pm-domains: This node contains a hierarchy of PM domain nodes, which should
+  match the Power Area Hierarchy in the Power Domain Specifications section of
+  the device's datasheet.
+
+
+== PM Domain Nodes ==
+
+Each of the PM domain nodes represents a PM domain, as documented by the
+generic PM domain bindings in
+Documentation/devicetree/bindings/power/power_domain.txt.
+
+The nodes should be named by the real power area names, and thus their names
+should be unique.
+
+Required properties:
+  - #power-domain-cells: Must be 0.
+
+Optional properties:
+- reg: If the PM domain is not always-on, this property must contain the bit
+       index number for the corresponding power area in the various Power
+       Control and Status Registers. The parent's node must contain the
+       following two properties:
+	 - #address-cells: Must be 1,
+	 - #size-cells: Must be 0.
+       If the PM domain is always-on, this property must be omitted.
+- power-on-latency: Power-on latency of the PM domain, in ns,
+- power-off-latency: Power-off latency of the PM domain, in ns.
+
+
+Example:
+
+This shows a subset of the r8a7740 PM domain hierarchy, containing the
+C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
+which is a subdomain of A4S.
+
+	sysc: system-controller at e6180000 {
+		compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
+		reg = <0xe6180000 8000>, <0xe6188000 8000>;
+
+		pm-domains {
+			pd_c5: c5 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				#power-domain-cells = <0>;
+
+				pd_a4s: a4s at 10 {
+					reg = <10>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+
+					pd_a3sp: a3sp at 11 {
+						reg = <11>;
+						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
+					};
+				};
+
+				pd_a4su: a4su at 20 {
+					reg = <20>;
+					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
+				};
+			};
+		};
+	};
+
+
+== PM Domain Consumers ==
+
+Hardware blocks belonging to a PM domain should contain a "power-domains"
+property that is a phandle pointing to the corresponding PM domain node,
+and optional PM QoS device latencies:
+
+Example:
+
+	tpu: pwm at e6600000 {
+		compatible = "renesas,tpu-r8a7740", "renesas,tpu";
+		reg = <0xe6600000 0x100>;
+		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
+		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
+		#pwm-cells = <3>;
+	};
-- 
1.9.1

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

* [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 drivers/base/power/domain.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 6e36bb09e7d9c144..0ebc6bb31c9c227f 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2171,17 +2171,18 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
  */
 int genpd_dev_pm_attach(struct device *dev)
 {
+	struct device_node *np = dev->of_node;
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
 	int ret;
 
-	if (!dev->of_node)
+	if (!np)
 		return -ENODEV;
 
 	if (dev->pm_domain)
 		return -EEXIST;
 
-	ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
+	ret = of_parse_phandle_with_args(np, "power-domains",
 					"#power-domain-cells", 0, &pd_args);
 	if (ret < 0) {
 		if (ret != -ENOENT)
@@ -2192,8 +2193,7 @@ int genpd_dev_pm_attach(struct device *dev)
 		 * (for backwards compatibility of DT ABI)
 		 */
 		pd_args.args_count = 0;
-		pd_args.np = of_parse_phandle(dev->of_node,
-						"samsung,power-domain", 0);
+		pd_args.np = of_parse_phandle(np, "samsung,power-domain", 0);
 		if (!pd_args.np)
 			return -ENOENT;
 	}
@@ -2202,7 +2202,7 @@ int genpd_dev_pm_attach(struct device *dev)
 	if (IS_ERR(pd)) {
 		dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
 			__func__, PTR_ERR(pd));
-		of_node_put(dev->of_node);
+		of_node_put(np);
 		return PTR_ERR(pd);
 	}
 
@@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)
 	if (ret < 0) {
 		dev_err(dev, "failed to add to PM domain %s: %d",
 			pd->name, ret);
-		of_node_put(dev->of_node);
+		of_node_put(np);
 		return ret;
 	}
 
-- 
1.9.1


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

* [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 drivers/base/power/domain.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 6e36bb09e7d9c144..0ebc6bb31c9c227f 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2171,17 +2171,18 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
  */
 int genpd_dev_pm_attach(struct device *dev)
 {
+	struct device_node *np = dev->of_node;
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
 	int ret;
 
-	if (!dev->of_node)
+	if (!np)
 		return -ENODEV;
 
 	if (dev->pm_domain)
 		return -EEXIST;
 
-	ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
+	ret = of_parse_phandle_with_args(np, "power-domains",
 					"#power-domain-cells", 0, &pd_args);
 	if (ret < 0) {
 		if (ret != -ENOENT)
@@ -2192,8 +2193,7 @@ int genpd_dev_pm_attach(struct device *dev)
 		 * (for backwards compatibility of DT ABI)
 		 */
 		pd_args.args_count = 0;
-		pd_args.np = of_parse_phandle(dev->of_node,
-						"samsung,power-domain", 0);
+		pd_args.np = of_parse_phandle(np, "samsung,power-domain", 0);
 		if (!pd_args.np)
 			return -ENOENT;
 	}
@@ -2202,7 +2202,7 @@ int genpd_dev_pm_attach(struct device *dev)
 	if (IS_ERR(pd)) {
 		dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
 			__func__, PTR_ERR(pd));
-		of_node_put(dev->of_node);
+		of_node_put(np);
 		return PTR_ERR(pd);
 	}
 
@@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)
 	if (ret < 0) {
 		dev_err(dev, "failed to add to PM domain %s: %d",
 			pd->name, ret);
-		of_node_put(dev->of_node);
+		of_node_put(np);
 		return ret;
 	}
 
-- 
1.9.1


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

* [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 drivers/base/power/domain.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 6e36bb09e7d9c144..0ebc6bb31c9c227f 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2171,17 +2171,18 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
  */
 int genpd_dev_pm_attach(struct device *dev)
 {
+	struct device_node *np = dev->of_node;
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
 	int ret;
 
-	if (!dev->of_node)
+	if (!np)
 		return -ENODEV;
 
 	if (dev->pm_domain)
 		return -EEXIST;
 
-	ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
+	ret = of_parse_phandle_with_args(np, "power-domains",
 					"#power-domain-cells", 0, &pd_args);
 	if (ret < 0) {
 		if (ret != -ENOENT)
@@ -2192,8 +2193,7 @@ int genpd_dev_pm_attach(struct device *dev)
 		 * (for backwards compatibility of DT ABI)
 		 */
 		pd_args.args_count = 0;
-		pd_args.np = of_parse_phandle(dev->of_node,
-						"samsung,power-domain", 0);
+		pd_args.np = of_parse_phandle(np, "samsung,power-domain", 0);
 		if (!pd_args.np)
 			return -ENOENT;
 	}
@@ -2202,7 +2202,7 @@ int genpd_dev_pm_attach(struct device *dev)
 	if (IS_ERR(pd)) {
 		dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
 			__func__, PTR_ERR(pd));
-		of_node_put(dev->of_node);
+		of_node_put(np);
 		return PTR_ERR(pd);
 	}
 
@@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)
 	if (ret < 0) {
 		dev_err(dev, "failed to add to PM domain %s: %d",
 			pd->name, ret);
-		of_node_put(dev->of_node);
+		of_node_put(np);
 		return ret;
 	}
 
-- 
1.9.1

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

* [PATCH v3 06/13] PM / Domains: Retrieve PM QoS device latencies from DT
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 drivers/base/power/domain.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 0ebc6bb31c9c227f..c79d5d43a5249562 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2174,6 +2174,8 @@ int genpd_dev_pm_attach(struct device *dev)
 	struct device_node *np = dev->of_node;
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
+	struct gpd_timing_data td;
+	u32 latency;
 	int ret;
 
 	if (!np)
@@ -2206,10 +2208,20 @@ int genpd_dev_pm_attach(struct device *dev)
 		return PTR_ERR(pd);
 	}
 
+	memset(&td, 0, sizeof(td));
+	if (!of_property_read_u32(np, "stop-latency", &latency))
+		td.stop_latency_ns = latency;
+	if (!of_property_read_u32(np, "start-latency", &latency))
+		td.start_latency_ns = latency;
+	if (!of_property_read_u32(np, "save-state-latency", &latency))
+		td.save_state_latency_ns = latency;
+	if (!of_property_read_u32(np, "restore-state-latency", &latency))
+		td.restore_state_latency_ns = latency;
+
 	dev_dbg(dev, "adding to PM domain %s\n", pd->name);
 
 	while (1) {
-		ret = pm_genpd_add_device(pd, dev);
+		ret = __pm_genpd_add_device(pd, dev, &td);
 		if (ret != -EAGAIN)
 			break;
 		cond_resched();
-- 
1.9.1


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

* [PATCH v3 06/13] PM / Domains: Retrieve PM QoS device latencies from DT
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 drivers/base/power/domain.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 0ebc6bb31c9c227f..c79d5d43a5249562 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2174,6 +2174,8 @@ int genpd_dev_pm_attach(struct device *dev)
 	struct device_node *np = dev->of_node;
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
+	struct gpd_timing_data td;
+	u32 latency;
 	int ret;
 
 	if (!np)
@@ -2206,10 +2208,20 @@ int genpd_dev_pm_attach(struct device *dev)
 		return PTR_ERR(pd);
 	}
 
+	memset(&td, 0, sizeof(td));
+	if (!of_property_read_u32(np, "stop-latency", &latency))
+		td.stop_latency_ns = latency;
+	if (!of_property_read_u32(np, "start-latency", &latency))
+		td.start_latency_ns = latency;
+	if (!of_property_read_u32(np, "save-state-latency", &latency))
+		td.save_state_latency_ns = latency;
+	if (!of_property_read_u32(np, "restore-state-latency", &latency))
+		td.restore_state_latency_ns = latency;
+
 	dev_dbg(dev, "adding to PM domain %s\n", pd->name);
 
 	while (1) {
-		ret = pm_genpd_add_device(pd, dev);
+		ret = __pm_genpd_add_device(pd, dev, &td);
 		if (ret != -EAGAIN)
 			break;
 		cond_resched();
-- 
1.9.1


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

* [PATCH v3 06/13] PM / Domains: Retrieve PM QoS device latencies from DT
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: devicetree, Ulf Hansson, Kevin Hilman, Geert Uytterhoeven,
	linux-sh, linux-pm, Tomasz Figa, linux-kernel, Grygorii Strashko,
	Philipp Zabel, linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 drivers/base/power/domain.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 0ebc6bb31c9c227f..c79d5d43a5249562 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2174,6 +2174,8 @@ int genpd_dev_pm_attach(struct device *dev)
 	struct device_node *np = dev->of_node;
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
+	struct gpd_timing_data td;
+	u32 latency;
 	int ret;
 
 	if (!np)
@@ -2206,10 +2208,20 @@ int genpd_dev_pm_attach(struct device *dev)
 		return PTR_ERR(pd);
 	}
 
+	memset(&td, 0, sizeof(td));
+	if (!of_property_read_u32(np, "stop-latency", &latency))
+		td.stop_latency_ns = latency;
+	if (!of_property_read_u32(np, "start-latency", &latency))
+		td.start_latency_ns = latency;
+	if (!of_property_read_u32(np, "save-state-latency", &latency))
+		td.save_state_latency_ns = latency;
+	if (!of_property_read_u32(np, "restore-state-latency", &latency))
+		td.restore_state_latency_ns = latency;
+
 	dev_dbg(dev, "adding to PM domain %s\n", pd->name);
 
 	while (1) {
-		ret = pm_genpd_add_device(pd, dev);
+		ret = __pm_genpd_add_device(pd, dev, &td);
 		if (ret != -EAGAIN)
 			break;
 		cond_resched();
-- 
1.9.1

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

* [PATCH v3 06/13] PM / Domains: Retrieve PM QoS device latencies from DT
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 drivers/base/power/domain.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 0ebc6bb31c9c227f..c79d5d43a5249562 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2174,6 +2174,8 @@ int genpd_dev_pm_attach(struct device *dev)
 	struct device_node *np = dev->of_node;
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
+	struct gpd_timing_data td;
+	u32 latency;
 	int ret;
 
 	if (!np)
@@ -2206,10 +2208,20 @@ int genpd_dev_pm_attach(struct device *dev)
 		return PTR_ERR(pd);
 	}
 
+	memset(&td, 0, sizeof(td));
+	if (!of_property_read_u32(np, "stop-latency", &latency))
+		td.stop_latency_ns = latency;
+	if (!of_property_read_u32(np, "start-latency", &latency))
+		td.start_latency_ns = latency;
+	if (!of_property_read_u32(np, "save-state-latency", &latency))
+		td.save_state_latency_ns = latency;
+	if (!of_property_read_u32(np, "restore-state-latency", &latency))
+		td.restore_state_latency_ns = latency;
+
 	dev_dbg(dev, "adding to PM domain %s\n", pd->name);
 
 	while (1) {
-		ret = pm_genpd_add_device(pd, dev);
+		ret = __pm_genpd_add_device(pd, dev, &td);
 		if (ret != -EAGAIN)
 			break;
 		cond_resched();
-- 
1.9.1

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

* [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Use the just introduced genpd attach/detach callbacks to register the
devices' module clocks, instead of doing it directly, to make it
DT-proof.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Update for callback signature changes,
v2:
  - New

 arch/arm/mach-shmobile/pm-rmobile.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 717e6413d29cb998..ae846dfcd69293f7 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
 	return true;
 }
 
+static void rmobile_pd_attach_dev(struct device *dev)
+{
+	if (pm_clk_no_clocks(dev))
+		pm_clk_add(dev, NULL);
+}
+
+static void rmobile_pd_detach_dev(struct device *dev)
+{
+	pm_clk_remove(dev, NULL);
+}
+
 static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 {
 	struct generic_pm_domain *genpd = &rmobile_pd->genpd;
@@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 	genpd->dev_ops.active_wakeup	= rmobile_pd_active_wakeup;
 	genpd->power_off		= rmobile_pd_power_down;
 	genpd->power_on			= rmobile_pd_power_up;
+	genpd->attach_dev		= rmobile_pd_attach_dev;
+	genpd->detach_dev		= rmobile_pd_detach_dev;
 	__rmobile_pd_power_up(rmobile_pd, false);
 }
 
@@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
 	struct device *dev = &pdev->dev;
 
 	__pm_genpd_name_add_device(domain_name, dev, td);
-	if (pm_clk_no_clocks(dev))
-		pm_clk_add(dev, NULL);
 }
 
 void rmobile_add_devices_to_domains(struct pm_domain_device data[],
-- 
1.9.1


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

* [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

Use the just introduced genpd attach/detach callbacks to register the
devices' module clocks, instead of doing it directly, to make it
DT-proof.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Update for callback signature changes,
v2:
  - New

 arch/arm/mach-shmobile/pm-rmobile.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 717e6413d29cb998..ae846dfcd69293f7 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
 	return true;
 }
 
+static void rmobile_pd_attach_dev(struct device *dev)
+{
+	if (pm_clk_no_clocks(dev))
+		pm_clk_add(dev, NULL);
+}
+
+static void rmobile_pd_detach_dev(struct device *dev)
+{
+	pm_clk_remove(dev, NULL);
+}
+
 static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 {
 	struct generic_pm_domain *genpd = &rmobile_pd->genpd;
@@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 	genpd->dev_ops.active_wakeup	= rmobile_pd_active_wakeup;
 	genpd->power_off		= rmobile_pd_power_down;
 	genpd->power_on			= rmobile_pd_power_up;
+	genpd->attach_dev		= rmobile_pd_attach_dev;
+	genpd->detach_dev		= rmobile_pd_detach_dev;
 	__rmobile_pd_power_up(rmobile_pd, false);
 }
 
@@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
 	struct device *dev = &pdev->dev;
 
 	__pm_genpd_name_add_device(domain_name, dev, td);
-	if (pm_clk_no_clocks(dev))
-		pm_clk_add(dev, NULL);
 }
 
 void rmobile_add_devices_to_domains(struct pm_domain_device data[],
-- 
1.9.1


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

* [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Use the just introduced genpd attach/detach callbacks to register the
devices' module clocks, instead of doing it directly, to make it
DT-proof.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Update for callback signature changes,
v2:
  - New

 arch/arm/mach-shmobile/pm-rmobile.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 717e6413d29cb998..ae846dfcd69293f7 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
 	return true;
 }
 
+static void rmobile_pd_attach_dev(struct device *dev)
+{
+	if (pm_clk_no_clocks(dev))
+		pm_clk_add(dev, NULL);
+}
+
+static void rmobile_pd_detach_dev(struct device *dev)
+{
+	pm_clk_remove(dev, NULL);
+}
+
 static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 {
 	struct generic_pm_domain *genpd = &rmobile_pd->genpd;
@@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 	genpd->dev_ops.active_wakeup	= rmobile_pd_active_wakeup;
 	genpd->power_off		= rmobile_pd_power_down;
 	genpd->power_on			= rmobile_pd_power_up;
+	genpd->attach_dev		= rmobile_pd_attach_dev;
+	genpd->detach_dev		= rmobile_pd_detach_dev;
 	__rmobile_pd_power_up(rmobile_pd, false);
 }
 
@@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
 	struct device *dev = &pdev->dev;
 
 	__pm_genpd_name_add_device(domain_name, dev, td);
-	if (pm_clk_no_clocks(dev))
-		pm_clk_add(dev, NULL);
 }
 
 void rmobile_add_devices_to_domains(struct pm_domain_device data[],
-- 
1.9.1

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

* [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Replace the hardcoded addresses for accessing the SYSC PM domain
registers by register offsets, relative to the SYSC base address stored
in struct rmobile_pm_domain.

In the future, the SYSC base address will come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - No changes

 arch/arm/mach-shmobile/pm-r8a7740.c | 14 ++++++++++++++
 arch/arm/mach-shmobile/pm-rmobile.c | 24 +++++++++++++-----------
 arch/arm/mach-shmobile/pm-rmobile.h |  1 +
 arch/arm/mach-shmobile/pm-sh7372.c  | 11 +++++++++++
 4 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index 41e61f1b5d44f00d..f92e64fd91de5631 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -9,10 +9,14 @@
  * for more details.
  */
 #include <linux/console.h>
+#include <linux/io.h>
 #include <linux/suspend.h>
+
 #include "common.h"
 #include "pm-rmobile.h"
 
+#define SYSC_BASE	IOMEM(0xe6180000)
+
 #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
 static int r8a7740_pd_a3sm_suspend(void)
 {
@@ -35,39 +39,49 @@ static int r8a7740_pd_a3sp_suspend(void)
 static struct rmobile_pm_domain r8a7740_pm_domains[] = {
 	{
 		.genpd.name	= "A4LC",
+		.base		= SYSC_BASE,
 		.bit_shift	= 1,
 	}, {
 		.genpd.name	= "A4MP",
+		.base		= SYSC_BASE,
 		.bit_shift	= 2,
 	}, {
 		.genpd.name	= "D4",
+		.base		= SYSC_BASE,
 		.bit_shift	= 3,
 	}, {
 		.genpd.name	= "A4R",
+		.base		= SYSC_BASE,
 		.bit_shift	= 5,
 	}, {
 		.genpd.name	= "A3RV",
+		.base		= SYSC_BASE,
 		.bit_shift	= 6,
 	}, {
 		.genpd.name	= "A4S",
+		.base		= SYSC_BASE,
 		.bit_shift	= 10,
 		.no_debug	= true,
 	}, {
 		.genpd.name	= "A3SP",
+		.base		= SYSC_BASE,
 		.bit_shift	= 11,
 		.gov		= &pm_domain_always_on_gov,
 		.no_debug	= true,
 		.suspend	= r8a7740_pd_a3sp_suspend,
 	}, {
 		.genpd.name	= "A3SM",
+		.base		= SYSC_BASE,
 		.bit_shift	= 12,
 		.gov		= &pm_domain_always_on_gov,
 		.suspend	= r8a7740_pd_a3sm_suspend,
 	}, {
 		.genpd.name	= "A3SG",
+		.base		= SYSC_BASE,
 		.bit_shift	= 13,
 	}, {
 		.genpd.name	= "A4SU",
+		.base		= SYSC_BASE,
 		.bit_shift	= 20,
 	},
 };
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index ae846dfcd69293f7..8b876fcf7d0fc2ba 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -20,9 +20,9 @@
 #include "pm-rmobile.h"
 
 /* SYSC */
-#define SPDCR		IOMEM(0xe6180008)
-#define SWUCR		IOMEM(0xe6180014)
-#define PSTR		IOMEM(0xe6180080)
+#define SPDCR	0x08	/* SYS Power Down Control Register */
+#define SWUCR	0x14	/* SYS Wakeup Control Register */
+#define PSTR	0x80	/* Power Status Register */
 
 #define PSTR_RETRIES	100
 #define PSTR_DELAY_US	10
@@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 			return ret;
 	}
 
-	if (__raw_readl(PSTR) & mask) {
+	if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
 		unsigned int retry_count;
-		__raw_writel(mask, SPDCR);
+		__raw_writel(mask, rmobile_pd->base + SPDCR);
 
 		for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
-			if (!(__raw_readl(SPDCR) & mask))
+			if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
 				break;
 			cpu_relax();
 		}
@@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 
 	if (!rmobile_pd->no_debug)
 		pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
-			 genpd->name, mask, __raw_readl(PSTR));
+			 genpd->name, mask,
+			 __raw_readl(rmobile_pd->base + PSTR));
 
 	return 0;
 }
@@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 	unsigned int retry_count;
 	int ret = 0;
 
-	if (__raw_readl(PSTR) & mask)
+	if (__raw_readl(rmobile_pd->base + PSTR) & mask)
 		goto out;
 
-	__raw_writel(mask, SWUCR);
+	__raw_writel(mask, rmobile_pd->base + SWUCR);
 
 	for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
-		if (!(__raw_readl(SWUCR) & mask))
+		if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
 			break;
 		if (retry_count > PSTR_RETRIES)
 			udelay(PSTR_DELAY_US);
@@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 
 	if (!rmobile_pd->no_debug)
 		pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
-			 rmobile_pd->genpd.name, mask, __raw_readl(PSTR));
+			 rmobile_pd->genpd.name, mask,
+			 __raw_readl(rmobile_pd->base + PSTR));
 
 out:
 	if (ret = 0 && rmobile_pd->resume && do_resume)
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 8f66b343162b0411..0602130bb260c31d 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -21,6 +21,7 @@ struct rmobile_pm_domain {
 	struct dev_power_governor *gov;
 	int (*suspend)(void);
 	void (*resume)(void);
+	void __iomem *base;
 	unsigned int bit_shift;
 	bool no_debug;
 };
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 7e5c2676c48902f1..7181a280b3b541af 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -45,6 +45,8 @@
 #define PLLC01STPCR IOMEM(0xe61500c8)
 
 /* SYSC */
+#define SYSC_BASE IOMEM(0xe6180000)
+
 #define SBAR IOMEM(0xe6180020)
 #define WUPRMSK IOMEM(0xe6180028)
 #define WUPSMSK IOMEM(0xe618002c)
@@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A4LC",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 1,
 	},
 	{
 		.genpd.name = "A4MP",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 2,
 	},
 	{
 		.genpd.name = "D4",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 3,
 	},
 	{
 		.genpd.name = "A4R",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 5,
 		.suspend = sh7372_a4r_pd_suspend,
 		.resume = sh7372_intcs_resume,
@@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3RV",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 6,
 	},
 	{
 		.genpd.name = "A3RI",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 8,
 	},
 	{
 		.genpd.name = "A4S",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 10,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3SP",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 11,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3SG",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 13,
 	},
 };
-- 
1.9.1


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

* [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

Replace the hardcoded addresses for accessing the SYSC PM domain
registers by register offsets, relative to the SYSC base address stored
in struct rmobile_pm_domain.

In the future, the SYSC base address will come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - No changes

 arch/arm/mach-shmobile/pm-r8a7740.c | 14 ++++++++++++++
 arch/arm/mach-shmobile/pm-rmobile.c | 24 +++++++++++++-----------
 arch/arm/mach-shmobile/pm-rmobile.h |  1 +
 arch/arm/mach-shmobile/pm-sh7372.c  | 11 +++++++++++
 4 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index 41e61f1b5d44f00d..f92e64fd91de5631 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -9,10 +9,14 @@
  * for more details.
  */
 #include <linux/console.h>
+#include <linux/io.h>
 #include <linux/suspend.h>
+
 #include "common.h"
 #include "pm-rmobile.h"
 
+#define SYSC_BASE	IOMEM(0xe6180000)
+
 #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
 static int r8a7740_pd_a3sm_suspend(void)
 {
@@ -35,39 +39,49 @@ static int r8a7740_pd_a3sp_suspend(void)
 static struct rmobile_pm_domain r8a7740_pm_domains[] = {
 	{
 		.genpd.name	= "A4LC",
+		.base		= SYSC_BASE,
 		.bit_shift	= 1,
 	}, {
 		.genpd.name	= "A4MP",
+		.base		= SYSC_BASE,
 		.bit_shift	= 2,
 	}, {
 		.genpd.name	= "D4",
+		.base		= SYSC_BASE,
 		.bit_shift	= 3,
 	}, {
 		.genpd.name	= "A4R",
+		.base		= SYSC_BASE,
 		.bit_shift	= 5,
 	}, {
 		.genpd.name	= "A3RV",
+		.base		= SYSC_BASE,
 		.bit_shift	= 6,
 	}, {
 		.genpd.name	= "A4S",
+		.base		= SYSC_BASE,
 		.bit_shift	= 10,
 		.no_debug	= true,
 	}, {
 		.genpd.name	= "A3SP",
+		.base		= SYSC_BASE,
 		.bit_shift	= 11,
 		.gov		= &pm_domain_always_on_gov,
 		.no_debug	= true,
 		.suspend	= r8a7740_pd_a3sp_suspend,
 	}, {
 		.genpd.name	= "A3SM",
+		.base		= SYSC_BASE,
 		.bit_shift	= 12,
 		.gov		= &pm_domain_always_on_gov,
 		.suspend	= r8a7740_pd_a3sm_suspend,
 	}, {
 		.genpd.name	= "A3SG",
+		.base		= SYSC_BASE,
 		.bit_shift	= 13,
 	}, {
 		.genpd.name	= "A4SU",
+		.base		= SYSC_BASE,
 		.bit_shift	= 20,
 	},
 };
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index ae846dfcd69293f7..8b876fcf7d0fc2ba 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -20,9 +20,9 @@
 #include "pm-rmobile.h"
 
 /* SYSC */
-#define SPDCR		IOMEM(0xe6180008)
-#define SWUCR		IOMEM(0xe6180014)
-#define PSTR		IOMEM(0xe6180080)
+#define SPDCR	0x08	/* SYS Power Down Control Register */
+#define SWUCR	0x14	/* SYS Wakeup Control Register */
+#define PSTR	0x80	/* Power Status Register */
 
 #define PSTR_RETRIES	100
 #define PSTR_DELAY_US	10
@@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 			return ret;
 	}
 
-	if (__raw_readl(PSTR) & mask) {
+	if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
 		unsigned int retry_count;
-		__raw_writel(mask, SPDCR);
+		__raw_writel(mask, rmobile_pd->base + SPDCR);
 
 		for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
-			if (!(__raw_readl(SPDCR) & mask))
+			if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
 				break;
 			cpu_relax();
 		}
@@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 
 	if (!rmobile_pd->no_debug)
 		pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
-			 genpd->name, mask, __raw_readl(PSTR));
+			 genpd->name, mask,
+			 __raw_readl(rmobile_pd->base + PSTR));
 
 	return 0;
 }
@@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 	unsigned int retry_count;
 	int ret = 0;
 
-	if (__raw_readl(PSTR) & mask)
+	if (__raw_readl(rmobile_pd->base + PSTR) & mask)
 		goto out;
 
-	__raw_writel(mask, SWUCR);
+	__raw_writel(mask, rmobile_pd->base + SWUCR);
 
 	for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
-		if (!(__raw_readl(SWUCR) & mask))
+		if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
 			break;
 		if (retry_count > PSTR_RETRIES)
 			udelay(PSTR_DELAY_US);
@@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 
 	if (!rmobile_pd->no_debug)
 		pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
-			 rmobile_pd->genpd.name, mask, __raw_readl(PSTR));
+			 rmobile_pd->genpd.name, mask,
+			 __raw_readl(rmobile_pd->base + PSTR));
 
 out:
 	if (ret == 0 && rmobile_pd->resume && do_resume)
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 8f66b343162b0411..0602130bb260c31d 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -21,6 +21,7 @@ struct rmobile_pm_domain {
 	struct dev_power_governor *gov;
 	int (*suspend)(void);
 	void (*resume)(void);
+	void __iomem *base;
 	unsigned int bit_shift;
 	bool no_debug;
 };
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 7e5c2676c48902f1..7181a280b3b541af 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -45,6 +45,8 @@
 #define PLLC01STPCR IOMEM(0xe61500c8)
 
 /* SYSC */
+#define SYSC_BASE IOMEM(0xe6180000)
+
 #define SBAR IOMEM(0xe6180020)
 #define WUPRMSK IOMEM(0xe6180028)
 #define WUPSMSK IOMEM(0xe618002c)
@@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A4LC",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 1,
 	},
 	{
 		.genpd.name = "A4MP",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 2,
 	},
 	{
 		.genpd.name = "D4",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 3,
 	},
 	{
 		.genpd.name = "A4R",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 5,
 		.suspend = sh7372_a4r_pd_suspend,
 		.resume = sh7372_intcs_resume,
@@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3RV",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 6,
 	},
 	{
 		.genpd.name = "A3RI",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 8,
 	},
 	{
 		.genpd.name = "A4S",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 10,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3SP",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 11,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3SG",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 13,
 	},
 };
-- 
1.9.1


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

* [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Replace the hardcoded addresses for accessing the SYSC PM domain
registers by register offsets, relative to the SYSC base address stored
in struct rmobile_pm_domain.

In the future, the SYSC base address will come from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - No changes

 arch/arm/mach-shmobile/pm-r8a7740.c | 14 ++++++++++++++
 arch/arm/mach-shmobile/pm-rmobile.c | 24 +++++++++++++-----------
 arch/arm/mach-shmobile/pm-rmobile.h |  1 +
 arch/arm/mach-shmobile/pm-sh7372.c  | 11 +++++++++++
 4 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index 41e61f1b5d44f00d..f92e64fd91de5631 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -9,10 +9,14 @@
  * for more details.
  */
 #include <linux/console.h>
+#include <linux/io.h>
 #include <linux/suspend.h>
+
 #include "common.h"
 #include "pm-rmobile.h"
 
+#define SYSC_BASE	IOMEM(0xe6180000)
+
 #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
 static int r8a7740_pd_a3sm_suspend(void)
 {
@@ -35,39 +39,49 @@ static int r8a7740_pd_a3sp_suspend(void)
 static struct rmobile_pm_domain r8a7740_pm_domains[] = {
 	{
 		.genpd.name	= "A4LC",
+		.base		= SYSC_BASE,
 		.bit_shift	= 1,
 	}, {
 		.genpd.name	= "A4MP",
+		.base		= SYSC_BASE,
 		.bit_shift	= 2,
 	}, {
 		.genpd.name	= "D4",
+		.base		= SYSC_BASE,
 		.bit_shift	= 3,
 	}, {
 		.genpd.name	= "A4R",
+		.base		= SYSC_BASE,
 		.bit_shift	= 5,
 	}, {
 		.genpd.name	= "A3RV",
+		.base		= SYSC_BASE,
 		.bit_shift	= 6,
 	}, {
 		.genpd.name	= "A4S",
+		.base		= SYSC_BASE,
 		.bit_shift	= 10,
 		.no_debug	= true,
 	}, {
 		.genpd.name	= "A3SP",
+		.base		= SYSC_BASE,
 		.bit_shift	= 11,
 		.gov		= &pm_domain_always_on_gov,
 		.no_debug	= true,
 		.suspend	= r8a7740_pd_a3sp_suspend,
 	}, {
 		.genpd.name	= "A3SM",
+		.base		= SYSC_BASE,
 		.bit_shift	= 12,
 		.gov		= &pm_domain_always_on_gov,
 		.suspend	= r8a7740_pd_a3sm_suspend,
 	}, {
 		.genpd.name	= "A3SG",
+		.base		= SYSC_BASE,
 		.bit_shift	= 13,
 	}, {
 		.genpd.name	= "A4SU",
+		.base		= SYSC_BASE,
 		.bit_shift	= 20,
 	},
 };
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index ae846dfcd69293f7..8b876fcf7d0fc2ba 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -20,9 +20,9 @@
 #include "pm-rmobile.h"
 
 /* SYSC */
-#define SPDCR		IOMEM(0xe6180008)
-#define SWUCR		IOMEM(0xe6180014)
-#define PSTR		IOMEM(0xe6180080)
+#define SPDCR	0x08	/* SYS Power Down Control Register */
+#define SWUCR	0x14	/* SYS Wakeup Control Register */
+#define PSTR	0x80	/* Power Status Register */
 
 #define PSTR_RETRIES	100
 #define PSTR_DELAY_US	10
@@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 			return ret;
 	}
 
-	if (__raw_readl(PSTR) & mask) {
+	if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
 		unsigned int retry_count;
-		__raw_writel(mask, SPDCR);
+		__raw_writel(mask, rmobile_pd->base + SPDCR);
 
 		for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
-			if (!(__raw_readl(SPDCR) & mask))
+			if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
 				break;
 			cpu_relax();
 		}
@@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 
 	if (!rmobile_pd->no_debug)
 		pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
-			 genpd->name, mask, __raw_readl(PSTR));
+			 genpd->name, mask,
+			 __raw_readl(rmobile_pd->base + PSTR));
 
 	return 0;
 }
@@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 	unsigned int retry_count;
 	int ret = 0;
 
-	if (__raw_readl(PSTR) & mask)
+	if (__raw_readl(rmobile_pd->base + PSTR) & mask)
 		goto out;
 
-	__raw_writel(mask, SWUCR);
+	__raw_writel(mask, rmobile_pd->base + SWUCR);
 
 	for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
-		if (!(__raw_readl(SWUCR) & mask))
+		if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
 			break;
 		if (retry_count > PSTR_RETRIES)
 			udelay(PSTR_DELAY_US);
@@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 
 	if (!rmobile_pd->no_debug)
 		pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
-			 rmobile_pd->genpd.name, mask, __raw_readl(PSTR));
+			 rmobile_pd->genpd.name, mask,
+			 __raw_readl(rmobile_pd->base + PSTR));
 
 out:
 	if (ret == 0 && rmobile_pd->resume && do_resume)
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 8f66b343162b0411..0602130bb260c31d 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -21,6 +21,7 @@ struct rmobile_pm_domain {
 	struct dev_power_governor *gov;
 	int (*suspend)(void);
 	void (*resume)(void);
+	void __iomem *base;
 	unsigned int bit_shift;
 	bool no_debug;
 };
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 7e5c2676c48902f1..7181a280b3b541af 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -45,6 +45,8 @@
 #define PLLC01STPCR IOMEM(0xe61500c8)
 
 /* SYSC */
+#define SYSC_BASE IOMEM(0xe6180000)
+
 #define SBAR IOMEM(0xe6180020)
 #define WUPRMSK IOMEM(0xe6180028)
 #define WUPSMSK IOMEM(0xe618002c)
@@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A4LC",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 1,
 	},
 	{
 		.genpd.name = "A4MP",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 2,
 	},
 	{
 		.genpd.name = "D4",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 3,
 	},
 	{
 		.genpd.name = "A4R",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 5,
 		.suspend = sh7372_a4r_pd_suspend,
 		.resume = sh7372_intcs_resume,
@@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3RV",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 6,
 	},
 	{
 		.genpd.name = "A3RI",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 8,
 	},
 	{
 		.genpd.name = "A4S",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 10,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3SP",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 11,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
 		.genpd.name = "A3SG",
 		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.base = SYSC_BASE,
 		.bit_shift = 13,
 	},
 };
-- 
1.9.1

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

* [PATCH v3 09/13] ARM: shmobile: R-Mobile: Add DT support for PM domains
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Populate the PM domains from DT, and provide support to hook up devices
to their respective PM domain.

The always-on power area (e.g. C5 on r8a7740) is created as a PM domain
without software control, to allow Run-Time management of module clocks
for hardware blocks inside this area.

Power-on/off latencies are supported.

Special cases like PM domains containing CPUs and the console device are
handled by scanning the DT topology.

Initialization is done from core_initcall(), as the
"renesas,intc-irqpin" driver uses postcore_initcall().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
shmobile: armadillo800eva dts: Add chosen/stdout-path".

v3:
  - Remove limitations, as fixes for the interrupt storm (A4MP) and
    crash (D4) are available,
  - Scan DT topology to identify special PM domains,
  - Add dependency on chosen/stdout-path,
v2:
  - Fix typo "CPU is _not_ in use",
  - Include build glue,
  - Remove paragraph about missing functionality compared to the legacy
    case, as it is no longer missing (runtime management of module
    clocks, device latencies).

 arch/arm/mach-shmobile/Kconfig      |   3 +-
 arch/arm/mach-shmobile/pm-rmobile.c | 197 +++++++++++++++++++++++++++++++++++-
 arch/arm/mach-shmobile/pm-rmobile.h |   2 +-
 3 files changed, 198 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index f59019dd986e7c94..9523c88fd4b3b9bb 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -6,6 +6,7 @@ config PM_RCAR
 
 config PM_RMOBILE
 	bool
+	select PM_GENERIC_DOMAINS
 
 config ARCH_RCAR_GEN1
 	bool
@@ -21,7 +22,7 @@ config ARCH_RCAR_GEN2
 
 config ARCH_RMOBILE
 	bool
-	select PM_RMOBILE if PM && !ARCH_SHMOBILE_MULTI
+	select PM_RMOBILE if PM
 	select SYS_SUPPORTS_SH_CMT
 	select SYS_SUPPORTS_SH_TMU
 
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 8b876fcf7d0fc2ba..b1aa0e8541feaea4 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2012  Renesas Solutions Corp.
  * Copyright (C) 2012  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ * Copyright (C) 2014  Glider bvba
  *
  * based on pm-sh7372.c
  *  Copyright (C) 2011 Magnus Damm
@@ -13,9 +14,13 @@
  */
 #include <linux/console.h>
 #include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pm_clock.h>
+#include <linux/slab.h>
 #include <asm/io.h>
 #include "pm-rmobile.h"
 
@@ -30,8 +35,12 @@
 static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 {
 	struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd);
-	unsigned int mask = 1 << rmobile_pd->bit_shift;
+	unsigned int mask;
 
+	if (rmobile_pd->bit_shift = ~0)
+		return -EBUSY;
+
+	mask = 1 << rmobile_pd->bit_shift;
 	if (rmobile_pd->suspend) {
 		int ret = rmobile_pd->suspend();
 
@@ -61,10 +70,14 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 				 bool do_resume)
 {
-	unsigned int mask = 1 << rmobile_pd->bit_shift;
+	unsigned int mask;
 	unsigned int retry_count;
 	int ret = 0;
 
+	if (rmobile_pd->bit_shift = ~0)
+		return 0;
+
+	mask = 1 << rmobile_pd->bit_shift;
 	if (__raw_readl(rmobile_pd->base + PSTR) & mask)
 		goto out;
 
@@ -130,6 +143,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 	__rmobile_pd_power_up(rmobile_pd, false);
 }
 
+#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
+
 void rmobile_init_domains(struct rmobile_pm_domain domains[], int num)
 {
 	int j;
@@ -162,3 +177,181 @@ void rmobile_add_devices_to_domains(struct pm_domain_device data[],
 		rmobile_add_device_to_domain_td(data[j].domain_name,
 						data[j].pdev, &latencies);
 }
+
+#else /* !CONFIG_ARCH_SHMOBILE_LEGACY */
+
+static int rmobile_pd_suspend_cpu(void)
+{
+	/*
+	 * This domain contains the CPU core and therefore it should
+	 * only be turned off if the CPU is not in use.
+	 */
+	return -EBUSY;
+}
+
+static int rmobile_pd_suspend_console(void)
+{
+	/*
+	 * Serial consoles make use of SCIF hardware located in this domain,
+	 * hence keep the power domain on if "no_console_suspend" is set.
+	 */
+	return console_suspend_enabled ? 0 : -EBUSY;
+}
+
+#define MAX_NUM_CPU_PDS		8
+
+static unsigned int num_cpu_pds __initdata;
+static struct device_node *cpu_pds[MAX_NUM_CPU_PDS] __initdata;
+static struct device_node *console_pd __initdata;
+
+static void __init get_special_pds(void)
+{
+	struct device_node *cpu, *pd;
+	unsigned int i;
+
+	/* PM domains containing CPUs */
+	for_each_node_by_type(cpu, "cpu") {
+		pd = of_parse_phandle(cpu, "power-domains", 0);
+		if (!pd)
+			continue;
+
+		for (i = 0; i < num_cpu_pds; i++)
+			if (pd = cpu_pds[i])
+				break;
+
+		if (i < num_cpu_pds) {
+			of_node_put(pd);
+			continue;
+		}
+
+		if (num_cpu_pds = MAX_NUM_CPU_PDS) {
+			pr_warn("Too many CPU PM domains\n");
+			of_node_put(pd);
+			continue;
+		}
+
+		cpu_pds[num_cpu_pds++] = pd;
+	}
+
+	/* PM domain containing console */
+	if (of_stdout)
+		console_pd = of_parse_phandle(of_stdout, "power-domains", 0);
+}
+
+static void __init put_special_pds(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < num_cpu_pds; i++)
+		of_node_put(cpu_pds[i]);
+	of_node_put(console_pd);
+}
+
+static bool __init pd_contains_cpu(const struct device_node *pd)
+{
+	unsigned int i;
+
+	for (i = 0; i < num_cpu_pds; i++)
+		if (pd = cpu_pds[i])
+			return true;
+
+	return false;
+}
+
+static void __init rmobile_setup_pm_domain(struct device_node *np,
+					   struct rmobile_pm_domain *pd)
+{
+	const char *name = pd->genpd.name;
+
+	if (pd_contains_cpu(np)) {
+		pr_debug("PM domain %s contains CPU\n", name);
+		pd->gov = &pm_domain_always_on_gov;
+		pd->suspend = rmobile_pd_suspend_cpu;
+	} else if (np = console_pd) {
+		pr_debug("PM domain %s contains serial console\n", name);
+		pd->gov = &pm_domain_always_on_gov;
+		pd->suspend = rmobile_pd_suspend_console;
+	}
+
+	rmobile_init_pm_domain(pd);
+}
+
+static int __init rmobile_add_pm_domains(void __iomem *base,
+					 struct device_node *parent,
+					 struct generic_pm_domain *genpd_parent)
+{
+	struct device_node *np;
+
+	for_each_child_of_node(parent, np) {
+		struct rmobile_pm_domain *pd;
+		u32 idx = ~0;
+		u32 latency;
+
+		if (of_property_read_u32(np, "reg", &idx)) {
+			/* always-on domain */
+		}
+
+		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+		if (!pd)
+			return -ENOMEM;
+
+		pd->genpd.name = np->name;
+		if (!of_property_read_u32(np, "power-on-latency", &latency))
+			pd->genpd.power_on_latency_ns = latency;
+		if (!of_property_read_u32(np, "power-off-latency", &latency))
+			pd->genpd.power_off_latency_ns = latency;
+		pd->base = base;
+		pd->bit_shift = idx;
+
+		rmobile_setup_pm_domain(np, pd);
+		if (genpd_parent)
+			pm_genpd_add_subdomain(genpd_parent, &pd->genpd);
+		of_genpd_add_provider_simple(np, &pd->genpd);
+
+		rmobile_add_pm_domains(base, np, &pd->genpd);
+	}
+	return 0;
+}
+
+static int __init rmobile_init_pm_domains(void)
+{
+	struct device_node *np, *pmd;
+	bool scanned = false;
+	void __iomem *base;
+	int ret = 0;
+
+	for_each_compatible_node(np, NULL, "renesas,sysc-rmobile") {
+		base = of_iomap(np, 0);
+		if (!base) {
+			pr_warn("%s cannot map reg 0\n", np->full_name);
+			continue;
+		}
+
+		pmd = of_find_node_by_name(np, "pm-domains");
+		if (!pmd) {
+			pr_warn("%s lacks pm-domains node\n", np->full_name);
+			continue;
+		}
+
+		if (!scanned) {
+			/* Find PM domains containing special blocks */
+			get_special_pds();
+			scanned = true;
+		}
+
+		ret = rmobile_add_pm_domains(base, pmd, NULL);
+		of_node_put(pmd);
+		if (ret) {
+			of_node_put(np);
+			break;
+		}
+	}
+
+	put_special_pds();
+
+	return ret;
+}
+
+core_initcall(rmobile_init_pm_domains);
+
+#endif /* !CONFIG_ARCH_SHMOBILE_LEGACY */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 0602130bb260c31d..53219786f539fa24 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -37,7 +37,7 @@ struct pm_domain_device {
 	struct platform_device *pdev;
 };
 
-#ifdef CONFIG_PM_RMOBILE
+#if defined(CONFIG_PM_RMOBILE) && defined(CONFIG_ARCH_SHMOBILE_LEGACY)
 extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
 extern void rmobile_add_device_to_domain_td(const char *domain_name,
 					    struct platform_device *pdev,
-- 
1.9.1


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

* [PATCH v3 09/13] ARM: shmobile: R-Mobile: Add DT support for PM domains
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

Populate the PM domains from DT, and provide support to hook up devices
to their respective PM domain.

The always-on power area (e.g. C5 on r8a7740) is created as a PM domain
without software control, to allow Run-Time management of module clocks
for hardware blocks inside this area.

Power-on/off latencies are supported.

Special cases like PM domains containing CPUs and the console device are
handled by scanning the DT topology.

Initialization is done from core_initcall(), as the
"renesas,intc-irqpin" driver uses postcore_initcall().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
shmobile: armadillo800eva dts: Add chosen/stdout-path".

v3:
  - Remove limitations, as fixes for the interrupt storm (A4MP) and
    crash (D4) are available,
  - Scan DT topology to identify special PM domains,
  - Add dependency on chosen/stdout-path,
v2:
  - Fix typo "CPU is _not_ in use",
  - Include build glue,
  - Remove paragraph about missing functionality compared to the legacy
    case, as it is no longer missing (runtime management of module
    clocks, device latencies).

 arch/arm/mach-shmobile/Kconfig      |   3 +-
 arch/arm/mach-shmobile/pm-rmobile.c | 197 +++++++++++++++++++++++++++++++++++-
 arch/arm/mach-shmobile/pm-rmobile.h |   2 +-
 3 files changed, 198 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index f59019dd986e7c94..9523c88fd4b3b9bb 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -6,6 +6,7 @@ config PM_RCAR
 
 config PM_RMOBILE
 	bool
+	select PM_GENERIC_DOMAINS
 
 config ARCH_RCAR_GEN1
 	bool
@@ -21,7 +22,7 @@ config ARCH_RCAR_GEN2
 
 config ARCH_RMOBILE
 	bool
-	select PM_RMOBILE if PM && !ARCH_SHMOBILE_MULTI
+	select PM_RMOBILE if PM
 	select SYS_SUPPORTS_SH_CMT
 	select SYS_SUPPORTS_SH_TMU
 
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 8b876fcf7d0fc2ba..b1aa0e8541feaea4 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2012  Renesas Solutions Corp.
  * Copyright (C) 2012  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ * Copyright (C) 2014  Glider bvba
  *
  * based on pm-sh7372.c
  *  Copyright (C) 2011 Magnus Damm
@@ -13,9 +14,13 @@
  */
 #include <linux/console.h>
 #include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pm_clock.h>
+#include <linux/slab.h>
 #include <asm/io.h>
 #include "pm-rmobile.h"
 
@@ -30,8 +35,12 @@
 static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 {
 	struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd);
-	unsigned int mask = 1 << rmobile_pd->bit_shift;
+	unsigned int mask;
 
+	if (rmobile_pd->bit_shift == ~0)
+		return -EBUSY;
+
+	mask = 1 << rmobile_pd->bit_shift;
 	if (rmobile_pd->suspend) {
 		int ret = rmobile_pd->suspend();
 
@@ -61,10 +70,14 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 				 bool do_resume)
 {
-	unsigned int mask = 1 << rmobile_pd->bit_shift;
+	unsigned int mask;
 	unsigned int retry_count;
 	int ret = 0;
 
+	if (rmobile_pd->bit_shift == ~0)
+		return 0;
+
+	mask = 1 << rmobile_pd->bit_shift;
 	if (__raw_readl(rmobile_pd->base + PSTR) & mask)
 		goto out;
 
@@ -130,6 +143,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 	__rmobile_pd_power_up(rmobile_pd, false);
 }
 
+#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
+
 void rmobile_init_domains(struct rmobile_pm_domain domains[], int num)
 {
 	int j;
@@ -162,3 +177,181 @@ void rmobile_add_devices_to_domains(struct pm_domain_device data[],
 		rmobile_add_device_to_domain_td(data[j].domain_name,
 						data[j].pdev, &latencies);
 }
+
+#else /* !CONFIG_ARCH_SHMOBILE_LEGACY */
+
+static int rmobile_pd_suspend_cpu(void)
+{
+	/*
+	 * This domain contains the CPU core and therefore it should
+	 * only be turned off if the CPU is not in use.
+	 */
+	return -EBUSY;
+}
+
+static int rmobile_pd_suspend_console(void)
+{
+	/*
+	 * Serial consoles make use of SCIF hardware located in this domain,
+	 * hence keep the power domain on if "no_console_suspend" is set.
+	 */
+	return console_suspend_enabled ? 0 : -EBUSY;
+}
+
+#define MAX_NUM_CPU_PDS		8
+
+static unsigned int num_cpu_pds __initdata;
+static struct device_node *cpu_pds[MAX_NUM_CPU_PDS] __initdata;
+static struct device_node *console_pd __initdata;
+
+static void __init get_special_pds(void)
+{
+	struct device_node *cpu, *pd;
+	unsigned int i;
+
+	/* PM domains containing CPUs */
+	for_each_node_by_type(cpu, "cpu") {
+		pd = of_parse_phandle(cpu, "power-domains", 0);
+		if (!pd)
+			continue;
+
+		for (i = 0; i < num_cpu_pds; i++)
+			if (pd == cpu_pds[i])
+				break;
+
+		if (i < num_cpu_pds) {
+			of_node_put(pd);
+			continue;
+		}
+
+		if (num_cpu_pds == MAX_NUM_CPU_PDS) {
+			pr_warn("Too many CPU PM domains\n");
+			of_node_put(pd);
+			continue;
+		}
+
+		cpu_pds[num_cpu_pds++] = pd;
+	}
+
+	/* PM domain containing console */
+	if (of_stdout)
+		console_pd = of_parse_phandle(of_stdout, "power-domains", 0);
+}
+
+static void __init put_special_pds(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < num_cpu_pds; i++)
+		of_node_put(cpu_pds[i]);
+	of_node_put(console_pd);
+}
+
+static bool __init pd_contains_cpu(const struct device_node *pd)
+{
+	unsigned int i;
+
+	for (i = 0; i < num_cpu_pds; i++)
+		if (pd == cpu_pds[i])
+			return true;
+
+	return false;
+}
+
+static void __init rmobile_setup_pm_domain(struct device_node *np,
+					   struct rmobile_pm_domain *pd)
+{
+	const char *name = pd->genpd.name;
+
+	if (pd_contains_cpu(np)) {
+		pr_debug("PM domain %s contains CPU\n", name);
+		pd->gov = &pm_domain_always_on_gov;
+		pd->suspend = rmobile_pd_suspend_cpu;
+	} else if (np == console_pd) {
+		pr_debug("PM domain %s contains serial console\n", name);
+		pd->gov = &pm_domain_always_on_gov;
+		pd->suspend = rmobile_pd_suspend_console;
+	}
+
+	rmobile_init_pm_domain(pd);
+}
+
+static int __init rmobile_add_pm_domains(void __iomem *base,
+					 struct device_node *parent,
+					 struct generic_pm_domain *genpd_parent)
+{
+	struct device_node *np;
+
+	for_each_child_of_node(parent, np) {
+		struct rmobile_pm_domain *pd;
+		u32 idx = ~0;
+		u32 latency;
+
+		if (of_property_read_u32(np, "reg", &idx)) {
+			/* always-on domain */
+		}
+
+		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+		if (!pd)
+			return -ENOMEM;
+
+		pd->genpd.name = np->name;
+		if (!of_property_read_u32(np, "power-on-latency", &latency))
+			pd->genpd.power_on_latency_ns = latency;
+		if (!of_property_read_u32(np, "power-off-latency", &latency))
+			pd->genpd.power_off_latency_ns = latency;
+		pd->base = base;
+		pd->bit_shift = idx;
+
+		rmobile_setup_pm_domain(np, pd);
+		if (genpd_parent)
+			pm_genpd_add_subdomain(genpd_parent, &pd->genpd);
+		of_genpd_add_provider_simple(np, &pd->genpd);
+
+		rmobile_add_pm_domains(base, np, &pd->genpd);
+	}
+	return 0;
+}
+
+static int __init rmobile_init_pm_domains(void)
+{
+	struct device_node *np, *pmd;
+	bool scanned = false;
+	void __iomem *base;
+	int ret = 0;
+
+	for_each_compatible_node(np, NULL, "renesas,sysc-rmobile") {
+		base = of_iomap(np, 0);
+		if (!base) {
+			pr_warn("%s cannot map reg 0\n", np->full_name);
+			continue;
+		}
+
+		pmd = of_find_node_by_name(np, "pm-domains");
+		if (!pmd) {
+			pr_warn("%s lacks pm-domains node\n", np->full_name);
+			continue;
+		}
+
+		if (!scanned) {
+			/* Find PM domains containing special blocks */
+			get_special_pds();
+			scanned = true;
+		}
+
+		ret = rmobile_add_pm_domains(base, pmd, NULL);
+		of_node_put(pmd);
+		if (ret) {
+			of_node_put(np);
+			break;
+		}
+	}
+
+	put_special_pds();
+
+	return ret;
+}
+
+core_initcall(rmobile_init_pm_domains);
+
+#endif /* !CONFIG_ARCH_SHMOBILE_LEGACY */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 0602130bb260c31d..53219786f539fa24 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -37,7 +37,7 @@ struct pm_domain_device {
 	struct platform_device *pdev;
 };
 
-#ifdef CONFIG_PM_RMOBILE
+#if defined(CONFIG_PM_RMOBILE) && defined(CONFIG_ARCH_SHMOBILE_LEGACY)
 extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
 extern void rmobile_add_device_to_domain_td(const char *domain_name,
 					    struct platform_device *pdev,
-- 
1.9.1


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

* [PATCH v3 09/13] ARM: shmobile: R-Mobile: Add DT support for PM domains
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Populate the PM domains from DT, and provide support to hook up devices
to their respective PM domain.

The always-on power area (e.g. C5 on r8a7740) is created as a PM domain
without software control, to allow Run-Time management of module clocks
for hardware blocks inside this area.

Power-on/off latencies are supported.

Special cases like PM domains containing CPUs and the console device are
handled by scanning the DT topology.

Initialization is done from core_initcall(), as the
"renesas,intc-irqpin" driver uses postcore_initcall().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
shmobile: armadillo800eva dts: Add chosen/stdout-path".

v3:
  - Remove limitations, as fixes for the interrupt storm (A4MP) and
    crash (D4) are available,
  - Scan DT topology to identify special PM domains,
  - Add dependency on chosen/stdout-path,
v2:
  - Fix typo "CPU is _not_ in use",
  - Include build glue,
  - Remove paragraph about missing functionality compared to the legacy
    case, as it is no longer missing (runtime management of module
    clocks, device latencies).

 arch/arm/mach-shmobile/Kconfig      |   3 +-
 arch/arm/mach-shmobile/pm-rmobile.c | 197 +++++++++++++++++++++++++++++++++++-
 arch/arm/mach-shmobile/pm-rmobile.h |   2 +-
 3 files changed, 198 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index f59019dd986e7c94..9523c88fd4b3b9bb 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -6,6 +6,7 @@ config PM_RCAR
 
 config PM_RMOBILE
 	bool
+	select PM_GENERIC_DOMAINS
 
 config ARCH_RCAR_GEN1
 	bool
@@ -21,7 +22,7 @@ config ARCH_RCAR_GEN2
 
 config ARCH_RMOBILE
 	bool
-	select PM_RMOBILE if PM && !ARCH_SHMOBILE_MULTI
+	select PM_RMOBILE if PM
 	select SYS_SUPPORTS_SH_CMT
 	select SYS_SUPPORTS_SH_TMU
 
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 8b876fcf7d0fc2ba..b1aa0e8541feaea4 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2012  Renesas Solutions Corp.
  * Copyright (C) 2012  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ * Copyright (C) 2014  Glider bvba
  *
  * based on pm-sh7372.c
  *  Copyright (C) 2011 Magnus Damm
@@ -13,9 +14,13 @@
  */
 #include <linux/console.h>
 #include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pm_clock.h>
+#include <linux/slab.h>
 #include <asm/io.h>
 #include "pm-rmobile.h"
 
@@ -30,8 +35,12 @@
 static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 {
 	struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd);
-	unsigned int mask = 1 << rmobile_pd->bit_shift;
+	unsigned int mask;
 
+	if (rmobile_pd->bit_shift == ~0)
+		return -EBUSY;
+
+	mask = 1 << rmobile_pd->bit_shift;
 	if (rmobile_pd->suspend) {
 		int ret = rmobile_pd->suspend();
 
@@ -61,10 +70,14 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
 				 bool do_resume)
 {
-	unsigned int mask = 1 << rmobile_pd->bit_shift;
+	unsigned int mask;
 	unsigned int retry_count;
 	int ret = 0;
 
+	if (rmobile_pd->bit_shift == ~0)
+		return 0;
+
+	mask = 1 << rmobile_pd->bit_shift;
 	if (__raw_readl(rmobile_pd->base + PSTR) & mask)
 		goto out;
 
@@ -130,6 +143,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
 	__rmobile_pd_power_up(rmobile_pd, false);
 }
 
+#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
+
 void rmobile_init_domains(struct rmobile_pm_domain domains[], int num)
 {
 	int j;
@@ -162,3 +177,181 @@ void rmobile_add_devices_to_domains(struct pm_domain_device data[],
 		rmobile_add_device_to_domain_td(data[j].domain_name,
 						data[j].pdev, &latencies);
 }
+
+#else /* !CONFIG_ARCH_SHMOBILE_LEGACY */
+
+static int rmobile_pd_suspend_cpu(void)
+{
+	/*
+	 * This domain contains the CPU core and therefore it should
+	 * only be turned off if the CPU is not in use.
+	 */
+	return -EBUSY;
+}
+
+static int rmobile_pd_suspend_console(void)
+{
+	/*
+	 * Serial consoles make use of SCIF hardware located in this domain,
+	 * hence keep the power domain on if "no_console_suspend" is set.
+	 */
+	return console_suspend_enabled ? 0 : -EBUSY;
+}
+
+#define MAX_NUM_CPU_PDS		8
+
+static unsigned int num_cpu_pds __initdata;
+static struct device_node *cpu_pds[MAX_NUM_CPU_PDS] __initdata;
+static struct device_node *console_pd __initdata;
+
+static void __init get_special_pds(void)
+{
+	struct device_node *cpu, *pd;
+	unsigned int i;
+
+	/* PM domains containing CPUs */
+	for_each_node_by_type(cpu, "cpu") {
+		pd = of_parse_phandle(cpu, "power-domains", 0);
+		if (!pd)
+			continue;
+
+		for (i = 0; i < num_cpu_pds; i++)
+			if (pd == cpu_pds[i])
+				break;
+
+		if (i < num_cpu_pds) {
+			of_node_put(pd);
+			continue;
+		}
+
+		if (num_cpu_pds == MAX_NUM_CPU_PDS) {
+			pr_warn("Too many CPU PM domains\n");
+			of_node_put(pd);
+			continue;
+		}
+
+		cpu_pds[num_cpu_pds++] = pd;
+	}
+
+	/* PM domain containing console */
+	if (of_stdout)
+		console_pd = of_parse_phandle(of_stdout, "power-domains", 0);
+}
+
+static void __init put_special_pds(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < num_cpu_pds; i++)
+		of_node_put(cpu_pds[i]);
+	of_node_put(console_pd);
+}
+
+static bool __init pd_contains_cpu(const struct device_node *pd)
+{
+	unsigned int i;
+
+	for (i = 0; i < num_cpu_pds; i++)
+		if (pd == cpu_pds[i])
+			return true;
+
+	return false;
+}
+
+static void __init rmobile_setup_pm_domain(struct device_node *np,
+					   struct rmobile_pm_domain *pd)
+{
+	const char *name = pd->genpd.name;
+
+	if (pd_contains_cpu(np)) {
+		pr_debug("PM domain %s contains CPU\n", name);
+		pd->gov = &pm_domain_always_on_gov;
+		pd->suspend = rmobile_pd_suspend_cpu;
+	} else if (np == console_pd) {
+		pr_debug("PM domain %s contains serial console\n", name);
+		pd->gov = &pm_domain_always_on_gov;
+		pd->suspend = rmobile_pd_suspend_console;
+	}
+
+	rmobile_init_pm_domain(pd);
+}
+
+static int __init rmobile_add_pm_domains(void __iomem *base,
+					 struct device_node *parent,
+					 struct generic_pm_domain *genpd_parent)
+{
+	struct device_node *np;
+
+	for_each_child_of_node(parent, np) {
+		struct rmobile_pm_domain *pd;
+		u32 idx = ~0;
+		u32 latency;
+
+		if (of_property_read_u32(np, "reg", &idx)) {
+			/* always-on domain */
+		}
+
+		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+		if (!pd)
+			return -ENOMEM;
+
+		pd->genpd.name = np->name;
+		if (!of_property_read_u32(np, "power-on-latency", &latency))
+			pd->genpd.power_on_latency_ns = latency;
+		if (!of_property_read_u32(np, "power-off-latency", &latency))
+			pd->genpd.power_off_latency_ns = latency;
+		pd->base = base;
+		pd->bit_shift = idx;
+
+		rmobile_setup_pm_domain(np, pd);
+		if (genpd_parent)
+			pm_genpd_add_subdomain(genpd_parent, &pd->genpd);
+		of_genpd_add_provider_simple(np, &pd->genpd);
+
+		rmobile_add_pm_domains(base, np, &pd->genpd);
+	}
+	return 0;
+}
+
+static int __init rmobile_init_pm_domains(void)
+{
+	struct device_node *np, *pmd;
+	bool scanned = false;
+	void __iomem *base;
+	int ret = 0;
+
+	for_each_compatible_node(np, NULL, "renesas,sysc-rmobile") {
+		base = of_iomap(np, 0);
+		if (!base) {
+			pr_warn("%s cannot map reg 0\n", np->full_name);
+			continue;
+		}
+
+		pmd = of_find_node_by_name(np, "pm-domains");
+		if (!pmd) {
+			pr_warn("%s lacks pm-domains node\n", np->full_name);
+			continue;
+		}
+
+		if (!scanned) {
+			/* Find PM domains containing special blocks */
+			get_special_pds();
+			scanned = true;
+		}
+
+		ret = rmobile_add_pm_domains(base, pmd, NULL);
+		of_node_put(pmd);
+		if (ret) {
+			of_node_put(np);
+			break;
+		}
+	}
+
+	put_special_pds();
+
+	return ret;
+}
+
+core_initcall(rmobile_init_pm_domains);
+
+#endif /* !CONFIG_ARCH_SHMOBILE_LEGACY */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 0602130bb260c31d..53219786f539fa24 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -37,7 +37,7 @@ struct pm_domain_device {
 	struct platform_device *pdev;
 };
 
-#ifdef CONFIG_PM_RMOBILE
+#if defined(CONFIG_PM_RMOBILE) && defined(CONFIG_ARCH_SHMOBILE_LEGACY)
 extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
 extern void rmobile_add_device_to_domain_td(const char *domain_name,
 					    struct platform_device *pdev,
-- 
1.9.1

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

* [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Add a device node for the System Controller, with subnodes that
represent the hardware power area hierarchy.
Hook up all devices to their respective PM domains.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "[PATCH] ARM: hw_breakpoint: Trap undef instruction
exceptions on wake-up", or an alternative solution. Else resuming from
s2ram will cause a crash.
As the HDMI-Link device is not yet instantiated from DT, this does not
depend on "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq
re-enable on resume".

v3:
  - Move power-on/off latencies to a separate patch,
  - Add dependencies,
v2:
  - Insert power-domains property after clock-names property in the cmt1
    node.

 arch/arm/boot/dts/r8a7740.dtsi | 101 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 502483f4dccb2f45..4fead480a405bebe 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -25,6 +25,7 @@
 			device_type = "cpu";
 			reg = <0x0>;
 			clock-frequency = <800000000>;
+			power-domains = <&pd_a3sm>;
 		};
 	};
 
@@ -47,6 +48,7 @@
 		interrupts = <0 58 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_CMT1>;
 		clock-names = "fck";
+		power-domains = <&pd_c5>;
 
 		renesas,channels-mask = <0x3f>;
 
@@ -72,6 +74,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin1: IRQ8 - IRQ15 */
@@ -93,6 +96,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin2: IRQ16 - IRQ23 */
@@ -114,6 +118,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin3: IRQ24 - IRQ31 */
@@ -135,6 +140,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	ether: ethernet@e9a00000 {
@@ -143,6 +149,7 @@
 		      <0xe9a01800 0x800>;
 		interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_GETHER>;
+		power-domains = <&pd_a4s>;
 		phy-mode = "mii";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -159,6 +166,7 @@
 			      0 203 IRQ_TYPE_LEVEL_HIGH
 			      0 204 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp1_clks R8A7740_CLK_IIC0>;
+		power-domains = <&pd_a4r>;
 		status = "disabled";
 	};
 
@@ -172,6 +180,7 @@
 			      0 72 IRQ_TYPE_LEVEL_HIGH
 			      0 73 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_IIC1>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -181,6 +190,7 @@
 		interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -190,6 +200,7 @@
 		interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA1>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -199,6 +210,7 @@
 		interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -208,6 +220,7 @@
 		interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA3>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -217,6 +230,7 @@
 		interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA4>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -226,6 +240,7 @@
 		interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA5>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -235,6 +250,7 @@
 		interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA6>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -244,6 +260,7 @@
 		interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA7>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -253,6 +270,7 @@
 		interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFB>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -271,12 +289,14 @@
 			<&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
 			<&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
 			<&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
+			power-domains = <&pd_c5>;
 	};
 
 	tpu: pwm@e6600000 {
 		compatible = "renesas,tpu-r8a7740", "renesas,tpu";
 		reg = <0xe6600000 0x100>;
 		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 		#pwm-cells = <3>;
 	};
@@ -287,6 +307,7 @@
 		interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH
 			      0 57 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_MMC>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -297,6 +318,7 @@
 			      0 118 IRQ_TYPE_LEVEL_HIGH
 			      0 119 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI0>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -309,6 +331,7 @@
 			      0 122 IRQ_TYPE_LEVEL_HIGH
 			      0 123 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI1>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -321,6 +344,7 @@
 			      0 126 IRQ_TYPE_LEVEL_HIGH
 			      0 127 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp4_clks R8A7740_CLK_SDHI2>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -332,6 +356,7 @@
 		reg = <0xfe1f0000 0x400>;
 		interrupts = <0 9 0x4>;
 		clocks = <&mstp3_clks R8A7740_CLK_FSI>;
+		power-domains = <&pd_a4mp>;
 		status = "disabled";
 	};
 
@@ -383,6 +408,7 @@
 			compatible = "renesas,r8a7740-cpg-clocks";
 			reg = <0xe6150000 0x10000>;
 			clocks = <&extal1_clk>, <&extalr_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			clock-output-names = "system", "pllc0", "pllc1",
 					     "pllc2", "r",
@@ -397,6 +423,7 @@
 			compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
 			reg = <0xe6150080 4>;
 			clocks = <&pllc1_div2_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-output-names = "sub";
 		};
@@ -405,6 +432,7 @@
 		pllc1_div2_clk: pllc1_div2_clk {
 			compatible = "fixed-factor-clock";
 			clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -413,6 +441,7 @@
 		extal1_div2_clk: extal1_div2_clk {
 			compatible = "fixed-factor-clock";
 			clocks = <&extal1_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -424,6 +453,7 @@
 			compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0xe6150080 4>;
 			clocks = <&sub_clk>, <&sub_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
@@ -439,6 +469,7 @@
 				 <&cpg_clocks R8A7740_CLK_B>,
 				 <&sub_clk>, <&sub_clk>,
 				 <&cpg_clocks R8A7740_CLK_B>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
@@ -460,6 +491,7 @@
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
@@ -489,6 +521,7 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
@@ -506,6 +539,7 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_USBH R8A7740_CLK_SDHI2
@@ -515,4 +549,71 @@
 				"usbhost", "sdhi2", "usbfunc", "usphy";
 		};
 	};
+
+	sysc: system-controller@e6180000 {
+		compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
+		reg = <0xe6180000 8000>, <0xe6188000 8000>;
+
+		pm-domains {
+			pd_c5: c5 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				#power-domain-cells = <0>;
+
+				pd_a4lc: a4lc@1 {
+					reg = <1>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_a4mp: a4mp@2 {
+					reg = <2>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_d4: d4@3 {
+					reg = <3>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_a4r: a4r@5 {
+					reg = <5>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+
+					pd_a3rv: a3rv@6 {
+						reg = <6>;
+						#power-domain-cells = <0>;
+					};
+				};
+
+				pd_a4s: a4s@10 {
+					reg = <10>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+
+					pd_a3sp: a3sp@11 {
+						reg = <11>;
+						#power-domain-cells = <0>;
+					};
+
+					pd_a3sm: a3sm@12 {
+						reg = <12>;
+						#power-domain-cells = <0>;
+					};
+
+					pd_a3sg: a3sg@13 {
+						reg = <13>;
+						#power-domain-cells = <0>;
+					};
+				};
+
+				pd_a4su: a4su@20 {
+					reg = <20>;
+					#power-domain-cells = <0>;
+				};
+			};
+		};
+	};
 };
-- 
1.9.1


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

* [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

Add a device node for the System Controller, with subnodes that
represent the hardware power area hierarchy.
Hook up all devices to their respective PM domains.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "[PATCH] ARM: hw_breakpoint: Trap undef instruction
exceptions on wake-up", or an alternative solution. Else resuming from
s2ram will cause a crash.
As the HDMI-Link device is not yet instantiated from DT, this does not
depend on "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq
re-enable on resume".

v3:
  - Move power-on/off latencies to a separate patch,
  - Add dependencies,
v2:
  - Insert power-domains property after clock-names property in the cmt1
    node.

 arch/arm/boot/dts/r8a7740.dtsi | 101 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 502483f4dccb2f45..4fead480a405bebe 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -25,6 +25,7 @@
 			device_type = "cpu";
 			reg = <0x0>;
 			clock-frequency = <800000000>;
+			power-domains = <&pd_a3sm>;
 		};
 	};
 
@@ -47,6 +48,7 @@
 		interrupts = <0 58 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_CMT1>;
 		clock-names = "fck";
+		power-domains = <&pd_c5>;
 
 		renesas,channels-mask = <0x3f>;
 
@@ -72,6 +74,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin1: IRQ8 - IRQ15 */
@@ -93,6 +96,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin2: IRQ16 - IRQ23 */
@@ -114,6 +118,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin3: IRQ24 - IRQ31 */
@@ -135,6 +140,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	ether: ethernet@e9a00000 {
@@ -143,6 +149,7 @@
 		      <0xe9a01800 0x800>;
 		interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_GETHER>;
+		power-domains = <&pd_a4s>;
 		phy-mode = "mii";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -159,6 +166,7 @@
 			      0 203 IRQ_TYPE_LEVEL_HIGH
 			      0 204 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp1_clks R8A7740_CLK_IIC0>;
+		power-domains = <&pd_a4r>;
 		status = "disabled";
 	};
 
@@ -172,6 +180,7 @@
 			      0 72 IRQ_TYPE_LEVEL_HIGH
 			      0 73 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_IIC1>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -181,6 +190,7 @@
 		interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -190,6 +200,7 @@
 		interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA1>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -199,6 +210,7 @@
 		interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -208,6 +220,7 @@
 		interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA3>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -217,6 +230,7 @@
 		interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA4>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -226,6 +240,7 @@
 		interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA5>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -235,6 +250,7 @@
 		interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA6>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -244,6 +260,7 @@
 		interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA7>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -253,6 +270,7 @@
 		interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFB>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -271,12 +289,14 @@
 			<&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
 			<&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
 			<&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
+			power-domains = <&pd_c5>;
 	};
 
 	tpu: pwm@e6600000 {
 		compatible = "renesas,tpu-r8a7740", "renesas,tpu";
 		reg = <0xe6600000 0x100>;
 		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 		#pwm-cells = <3>;
 	};
@@ -287,6 +307,7 @@
 		interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH
 			      0 57 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_MMC>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -297,6 +318,7 @@
 			      0 118 IRQ_TYPE_LEVEL_HIGH
 			      0 119 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI0>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -309,6 +331,7 @@
 			      0 122 IRQ_TYPE_LEVEL_HIGH
 			      0 123 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI1>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -321,6 +344,7 @@
 			      0 126 IRQ_TYPE_LEVEL_HIGH
 			      0 127 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp4_clks R8A7740_CLK_SDHI2>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -332,6 +356,7 @@
 		reg = <0xfe1f0000 0x400>;
 		interrupts = <0 9 0x4>;
 		clocks = <&mstp3_clks R8A7740_CLK_FSI>;
+		power-domains = <&pd_a4mp>;
 		status = "disabled";
 	};
 
@@ -383,6 +408,7 @@
 			compatible = "renesas,r8a7740-cpg-clocks";
 			reg = <0xe6150000 0x10000>;
 			clocks = <&extal1_clk>, <&extalr_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			clock-output-names = "system", "pllc0", "pllc1",
 					     "pllc2", "r",
@@ -397,6 +423,7 @@
 			compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
 			reg = <0xe6150080 4>;
 			clocks = <&pllc1_div2_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-output-names = "sub";
 		};
@@ -405,6 +432,7 @@
 		pllc1_div2_clk: pllc1_div2_clk {
 			compatible = "fixed-factor-clock";
 			clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -413,6 +441,7 @@
 		extal1_div2_clk: extal1_div2_clk {
 			compatible = "fixed-factor-clock";
 			clocks = <&extal1_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -424,6 +453,7 @@
 			compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0xe6150080 4>;
 			clocks = <&sub_clk>, <&sub_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
@@ -439,6 +469,7 @@
 				 <&cpg_clocks R8A7740_CLK_B>,
 				 <&sub_clk>, <&sub_clk>,
 				 <&cpg_clocks R8A7740_CLK_B>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
@@ -460,6 +491,7 @@
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
@@ -489,6 +521,7 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
@@ -506,6 +539,7 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_USBH R8A7740_CLK_SDHI2
@@ -515,4 +549,71 @@
 				"usbhost", "sdhi2", "usbfunc", "usphy";
 		};
 	};
+
+	sysc: system-controller@e6180000 {
+		compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
+		reg = <0xe6180000 8000>, <0xe6188000 8000>;
+
+		pm-domains {
+			pd_c5: c5 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				#power-domain-cells = <0>;
+
+				pd_a4lc: a4lc@1 {
+					reg = <1>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_a4mp: a4mp@2 {
+					reg = <2>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_d4: d4@3 {
+					reg = <3>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_a4r: a4r@5 {
+					reg = <5>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+
+					pd_a3rv: a3rv@6 {
+						reg = <6>;
+						#power-domain-cells = <0>;
+					};
+				};
+
+				pd_a4s: a4s@10 {
+					reg = <10>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+
+					pd_a3sp: a3sp@11 {
+						reg = <11>;
+						#power-domain-cells = <0>;
+					};
+
+					pd_a3sm: a3sm@12 {
+						reg = <12>;
+						#power-domain-cells = <0>;
+					};
+
+					pd_a3sg: a3sg@13 {
+						reg = <13>;
+						#power-domain-cells = <0>;
+					};
+				};
+
+				pd_a4su: a4su@20 {
+					reg = <20>;
+					#power-domain-cells = <0>;
+				};
+			};
+		};
+	};
 };
-- 
1.9.1


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

* [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Add a device node for the System Controller, with subnodes that
represent the hardware power area hierarchy.
Hook up all devices to their respective PM domains.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "[PATCH] ARM: hw_breakpoint: Trap undef instruction
exceptions on wake-up", or an alternative solution. Else resuming from
s2ram will cause a crash.
As the HDMI-Link device is not yet instantiated from DT, this does not
depend on "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq
re-enable on resume".

v3:
  - Move power-on/off latencies to a separate patch,
  - Add dependencies,
v2:
  - Insert power-domains property after clock-names property in the cmt1
    node.

 arch/arm/boot/dts/r8a7740.dtsi | 101 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 502483f4dccb2f45..4fead480a405bebe 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -25,6 +25,7 @@
 			device_type = "cpu";
 			reg = <0x0>;
 			clock-frequency = <800000000>;
+			power-domains = <&pd_a3sm>;
 		};
 	};
 
@@ -47,6 +48,7 @@
 		interrupts = <0 58 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_CMT1>;
 		clock-names = "fck";
+		power-domains = <&pd_c5>;
 
 		renesas,channels-mask = <0x3f>;
 
@@ -72,6 +74,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin1: IRQ8 - IRQ15 */
@@ -93,6 +96,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin2: IRQ16 - IRQ23 */
@@ -114,6 +118,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	/* irqpin3: IRQ24 - IRQ31 */
@@ -135,6 +140,7 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+		power-domains = <&pd_a4s>;
 	};
 
 	ether: ethernet at e9a00000 {
@@ -143,6 +149,7 @@
 		      <0xe9a01800 0x800>;
 		interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_GETHER>;
+		power-domains = <&pd_a4s>;
 		phy-mode = "mii";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -159,6 +166,7 @@
 			      0 203 IRQ_TYPE_LEVEL_HIGH
 			      0 204 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp1_clks R8A7740_CLK_IIC0>;
+		power-domains = <&pd_a4r>;
 		status = "disabled";
 	};
 
@@ -172,6 +180,7 @@
 			      0 72 IRQ_TYPE_LEVEL_HIGH
 			      0 73 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_IIC1>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -181,6 +190,7 @@
 		interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -190,6 +200,7 @@
 		interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA1>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -199,6 +210,7 @@
 		interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -208,6 +220,7 @@
 		interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA3>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -217,6 +230,7 @@
 		interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA4>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -226,6 +240,7 @@
 		interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA5>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -235,6 +250,7 @@
 		interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA6>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -244,6 +260,7 @@
 		interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA7>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -253,6 +270,7 @@
 		interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFB>;
 		clock-names = "sci_ick";
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -271,12 +289,14 @@
 			<&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
 			<&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
 			<&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
+			power-domains = <&pd_c5>;
 	};
 
 	tpu: pwm at e6600000 {
 		compatible = "renesas,tpu-r8a7740", "renesas,tpu";
 		reg = <0xe6600000 0x100>;
 		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 		#pwm-cells = <3>;
 	};
@@ -287,6 +307,7 @@
 		interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH
 			      0 57 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_MMC>;
+		power-domains = <&pd_a3sp>;
 		status = "disabled";
 	};
 
@@ -297,6 +318,7 @@
 			      0 118 IRQ_TYPE_LEVEL_HIGH
 			      0 119 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI0>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -309,6 +331,7 @@
 			      0 122 IRQ_TYPE_LEVEL_HIGH
 			      0 123 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI1>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -321,6 +344,7 @@
 			      0 126 IRQ_TYPE_LEVEL_HIGH
 			      0 127 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp4_clks R8A7740_CLK_SDHI2>;
+		power-domains = <&pd_a3sp>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -332,6 +356,7 @@
 		reg = <0xfe1f0000 0x400>;
 		interrupts = <0 9 0x4>;
 		clocks = <&mstp3_clks R8A7740_CLK_FSI>;
+		power-domains = <&pd_a4mp>;
 		status = "disabled";
 	};
 
@@ -383,6 +408,7 @@
 			compatible = "renesas,r8a7740-cpg-clocks";
 			reg = <0xe6150000 0x10000>;
 			clocks = <&extal1_clk>, <&extalr_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			clock-output-names = "system", "pllc0", "pllc1",
 					     "pllc2", "r",
@@ -397,6 +423,7 @@
 			compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
 			reg = <0xe6150080 4>;
 			clocks = <&pllc1_div2_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-output-names = "sub";
 		};
@@ -405,6 +432,7 @@
 		pllc1_div2_clk: pllc1_div2_clk {
 			compatible = "fixed-factor-clock";
 			clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -413,6 +441,7 @@
 		extal1_div2_clk: extal1_div2_clk {
 			compatible = "fixed-factor-clock";
 			clocks = <&extal1_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -424,6 +453,7 @@
 			compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0xe6150080 4>;
 			clocks = <&sub_clk>, <&sub_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
@@ -439,6 +469,7 @@
 				 <&cpg_clocks R8A7740_CLK_B>,
 				 <&sub_clk>, <&sub_clk>,
 				 <&cpg_clocks R8A7740_CLK_B>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
@@ -460,6 +491,7 @@
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
@@ -489,6 +521,7 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
@@ -506,6 +539,7 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
+			power-domains = <&pd_c5>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_USBH R8A7740_CLK_SDHI2
@@ -515,4 +549,71 @@
 				"usbhost", "sdhi2", "usbfunc", "usphy";
 		};
 	};
+
+	sysc: system-controller@e6180000 {
+		compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
+		reg = <0xe6180000 8000>, <0xe6188000 8000>;
+
+		pm-domains {
+			pd_c5: c5 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				#power-domain-cells = <0>;
+
+				pd_a4lc: a4lc at 1 {
+					reg = <1>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_a4mp: a4mp at 2 {
+					reg = <2>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_d4: d4 at 3 {
+					reg = <3>;
+					#power-domain-cells = <0>;
+				};
+
+				pd_a4r: a4r at 5 {
+					reg = <5>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+
+					pd_a3rv: a3rv at 6 {
+						reg = <6>;
+						#power-domain-cells = <0>;
+					};
+				};
+
+				pd_a4s: a4s at 10 {
+					reg = <10>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#power-domain-cells = <0>;
+
+					pd_a3sp: a3sp at 11 {
+						reg = <11>;
+						#power-domain-cells = <0>;
+					};
+
+					pd_a3sm: a3sm at 12 {
+						reg = <12>;
+						#power-domain-cells = <0>;
+					};
+
+					pd_a3sg: a3sg at 13 {
+						reg = <13>;
+						#power-domain-cells = <0>;
+					};
+				};
+
+				pd_a4su: a4su at 20 {
+					reg = <20>;
+					#power-domain-cells = <0>;
+				};
+			};
+		};
+	};
 };
-- 
1.9.1

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

* [PATCH v3 11/13] drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

If the default PM domain using PM_CLK is used for PM runtime, the real PM
domain(s) cannot be registered from DT later.

Hence do not enable it when running a multi-platform kernel with genpd
support on an r8a7740. The R-Mobile PM domain driver will take care of
PM runtime management of the module clocks.

The default PM domain is still needed for:
  - platforms without genpd support,
  - the legacy (non-DT) case, where genpd may take over later, except
    for the C5 "always on" PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword
v2:
  - New

 drivers/sh/pm_runtime.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
index fe2c2d595f599b2f..85cc89fd3e7d7cb7 100644
--- a/drivers/sh/pm_runtime.c
+++ b/drivers/sh/pm_runtime.c
@@ -81,7 +81,9 @@ static int __init sh_pm_runtime_init(void)
 		if (!of_machine_is_compatible("renesas,emev2") &&
 		    !of_machine_is_compatible("renesas,r7s72100") &&
 		    !of_machine_is_compatible("renesas,r8a73a4") &&
+#ifndef CONFIG_PM_GENERIC_DOMAINS_OF
 		    !of_machine_is_compatible("renesas,r8a7740") &&
+#endif
 		    !of_machine_is_compatible("renesas,r8a7778") &&
 		    !of_machine_is_compatible("renesas,r8a7779") &&
 		    !of_machine_is_compatible("renesas,r8a7790") &&
-- 
1.9.1


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

* [PATCH v3 11/13] drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

If the default PM domain using PM_CLK is used for PM runtime, the real PM
domain(s) cannot be registered from DT later.

Hence do not enable it when running a multi-platform kernel with genpd
support on an r8a7740. The R-Mobile PM domain driver will take care of
PM runtime management of the module clocks.

The default PM domain is still needed for:
  - platforms without genpd support,
  - the legacy (non-DT) case, where genpd may take over later, except
    for the C5 "always on" PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword
v2:
  - New

 drivers/sh/pm_runtime.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
index fe2c2d595f599b2f..85cc89fd3e7d7cb7 100644
--- a/drivers/sh/pm_runtime.c
+++ b/drivers/sh/pm_runtime.c
@@ -81,7 +81,9 @@ static int __init sh_pm_runtime_init(void)
 		if (!of_machine_is_compatible("renesas,emev2") &&
 		    !of_machine_is_compatible("renesas,r7s72100") &&
 		    !of_machine_is_compatible("renesas,r8a73a4") &&
+#ifndef CONFIG_PM_GENERIC_DOMAINS_OF
 		    !of_machine_is_compatible("renesas,r8a7740") &&
+#endif
 		    !of_machine_is_compatible("renesas,r8a7778") &&
 		    !of_machine_is_compatible("renesas,r8a7779") &&
 		    !of_machine_is_compatible("renesas,r8a7790") &&
-- 
1.9.1


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

* [PATCH v3 11/13] drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: devicetree, Ulf Hansson, Kevin Hilman, Geert Uytterhoeven,
	linux-sh, linux-pm, Tomasz Figa, linux-kernel, Grygorii Strashko,
	Philipp Zabel, linux-arm-kernel

If the default PM domain using PM_CLK is used for PM runtime, the real PM
domain(s) cannot be registered from DT later.

Hence do not enable it when running a multi-platform kernel with genpd
support on an r8a7740. The R-Mobile PM domain driver will take care of
PM runtime management of the module clocks.

The default PM domain is still needed for:
  - platforms without genpd support,
  - the legacy (non-DT) case, where genpd may take over later, except
    for the C5 "always on" PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword
v2:
  - New

 drivers/sh/pm_runtime.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
index fe2c2d595f599b2f..85cc89fd3e7d7cb7 100644
--- a/drivers/sh/pm_runtime.c
+++ b/drivers/sh/pm_runtime.c
@@ -81,7 +81,9 @@ static int __init sh_pm_runtime_init(void)
 		if (!of_machine_is_compatible("renesas,emev2") &&
 		    !of_machine_is_compatible("renesas,r7s72100") &&
 		    !of_machine_is_compatible("renesas,r8a73a4") &&
+#ifndef CONFIG_PM_GENERIC_DOMAINS_OF
 		    !of_machine_is_compatible("renesas,r8a7740") &&
+#endif
 		    !of_machine_is_compatible("renesas,r8a7778") &&
 		    !of_machine_is_compatible("renesas,r8a7779") &&
 		    !of_machine_is_compatible("renesas,r8a7790") &&
-- 
1.9.1

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

* [PATCH v3 11/13] drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

If the default PM domain using PM_CLK is used for PM runtime, the real PM
domain(s) cannot be registered from DT later.

Hence do not enable it when running a multi-platform kernel with genpd
support on an r8a7740. The R-Mobile PM domain driver will take care of
PM runtime management of the module clocks.

The default PM domain is still needed for:
  - platforms without genpd support,
  - the legacy (non-DT) case, where genpd may take over later, except
    for the C5 "always on" PM domain.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Reword
v2:
  - New

 drivers/sh/pm_runtime.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
index fe2c2d595f599b2f..85cc89fd3e7d7cb7 100644
--- a/drivers/sh/pm_runtime.c
+++ b/drivers/sh/pm_runtime.c
@@ -81,7 +81,9 @@ static int __init sh_pm_runtime_init(void)
 		if (!of_machine_is_compatible("renesas,emev2") &&
 		    !of_machine_is_compatible("renesas,r7s72100") &&
 		    !of_machine_is_compatible("renesas,r8a73a4") &&
+#ifndef CONFIG_PM_GENERIC_DOMAINS_OF
 		    !of_machine_is_compatible("renesas,r8a7740") &&
+#endif
 		    !of_machine_is_compatible("renesas,r8a7778") &&
 		    !of_machine_is_compatible("renesas,r8a7779") &&
 		    !of_machine_is_compatible("renesas,r8a7790") &&
-- 
1.9.1

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

* [PATCH v3 12/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

For now use 250 µs, just like the legacy platform code does.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - New, split off from "ARM: shmobile: r8a7740 dtsi: Add PM domain
    support".

 arch/arm/boot/dts/r8a7740.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 4fead480a405bebe..ed0adeb61a1ad8ec 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -563,16 +563,22 @@
 				pd_a4lc: a4lc@1 {
 					reg = <1>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4mp: a4mp@2 {
 					reg = <2>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_d4: d4@3 {
 					reg = <3>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4r: a4r@5 {
@@ -580,10 +586,14 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3rv: a3rv@6 {
 						reg = <6>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
@@ -592,26 +602,36 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3sp: a3sp@11 {
 						reg = <11>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sm: a3sm@12 {
 						reg = <12>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sg: a3sg@13 {
 						reg = <13>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
 				pd_a4su: a4su@20 {
 					reg = <20>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 			};
 		};
-- 
1.9.1


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

* [PATCH v3 12/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

For now use 250 µs, just like the legacy platform code does.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - New, split off from "ARM: shmobile: r8a7740 dtsi: Add PM domain
    support".

 arch/arm/boot/dts/r8a7740.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 4fead480a405bebe..ed0adeb61a1ad8ec 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -563,16 +563,22 @@
 				pd_a4lc: a4lc@1 {
 					reg = <1>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4mp: a4mp@2 {
 					reg = <2>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_d4: d4@3 {
 					reg = <3>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4r: a4r@5 {
@@ -580,10 +586,14 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3rv: a3rv@6 {
 						reg = <6>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
@@ -592,26 +602,36 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3sp: a3sp@11 {
 						reg = <11>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sm: a3sm@12 {
 						reg = <12>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sg: a3sg@13 {
 						reg = <13>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
 				pd_a4su: a4su@20 {
 					reg = <20>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 			};
 		};
-- 
1.9.1


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

* [PATCH v3 12/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: devicetree, Ulf Hansson, Kevin Hilman, Geert Uytterhoeven,
	linux-sh, linux-pm, Tomasz Figa, linux-kernel, Grygorii Strashko,
	Philipp Zabel, linux-arm-kernel

For now use 250 µs, just like the legacy platform code does.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - New, split off from "ARM: shmobile: r8a7740 dtsi: Add PM domain
    support".

 arch/arm/boot/dts/r8a7740.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 4fead480a405bebe..ed0adeb61a1ad8ec 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -563,16 +563,22 @@
 				pd_a4lc: a4lc@1 {
 					reg = <1>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4mp: a4mp@2 {
 					reg = <2>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_d4: d4@3 {
 					reg = <3>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4r: a4r@5 {
@@ -580,10 +586,14 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3rv: a3rv@6 {
 						reg = <6>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
@@ -592,26 +602,36 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3sp: a3sp@11 {
 						reg = <11>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sm: a3sm@12 {
 						reg = <12>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sg: a3sg@13 {
 						reg = <13>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
 				pd_a4su: a4su@20 {
 					reg = <20>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 			};
 		};
-- 
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v3 12/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

For now use 250 ?s, just like the legacy platform code does.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - New, split off from "ARM: shmobile: r8a7740 dtsi: Add PM domain
    support".

 arch/arm/boot/dts/r8a7740.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 4fead480a405bebe..ed0adeb61a1ad8ec 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -563,16 +563,22 @@
 				pd_a4lc: a4lc at 1 {
 					reg = <1>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4mp: a4mp at 2 {
 					reg = <2>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_d4: d4 at 3 {
 					reg = <3>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 
 				pd_a4r: a4r at 5 {
@@ -580,10 +586,14 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3rv: a3rv at 6 {
 						reg = <6>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
@@ -592,26 +602,36 @@
 					#address-cells = <1>;
 					#size-cells = <0>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 
 					pd_a3sp: a3sp at 11 {
 						reg = <11>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sm: a3sm at 12 {
 						reg = <12>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 
 					pd_a3sg: a3sg at 13 {
 						reg = <13>;
 						#power-domain-cells = <0>;
+						power-on-latency = <250000>;
+						power-off-latency = <250000>;
 					};
 				};
 
 				pd_a4su: a4su at 20 {
 					reg = <20>;
 					#power-domain-cells = <0>;
+					power-on-latency = <250000>;
+					power-off-latency = <250000>;
 				};
 			};
 		};
-- 
1.9.1

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

* [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

For now use 250 µs, just like the legacy platform code does.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 arch/arm/boot/dts/r8a7740.dtsi | 136 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 136 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index ed0adeb61a1ad8ec..713170442b7bd4b2 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -26,6 +26,10 @@
 			reg = <0x0>;
 			clock-frequency = <800000000>;
 			power-domains = <&pd_a3sm>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 		};
 	};
 
@@ -49,6 +53,10 @@
 		clocks = <&mstp3_clks R8A7740_CLK_CMT1>;
 		clock-names = "fck";
 		power-domains = <&pd_c5>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 
 		renesas,channels-mask = <0x3f>;
 
@@ -75,6 +83,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin1: IRQ8 - IRQ15 */
@@ -97,6 +109,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin2: IRQ16 - IRQ23 */
@@ -119,6 +135,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin3: IRQ24 - IRQ31 */
@@ -141,6 +161,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	ether: ethernet@e9a00000 {
@@ -150,6 +174,10 @@
 		interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_GETHER>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		phy-mode = "mii";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -167,6 +195,10 @@
 			      0 204 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp1_clks R8A7740_CLK_IIC0>;
 		power-domains = <&pd_a4r>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -181,6 +213,10 @@
 			      0 73 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_IIC1>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -191,6 +227,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -201,6 +241,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA1>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -211,6 +255,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -221,6 +269,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA3>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -231,6 +283,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA4>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -241,6 +297,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA5>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -251,6 +311,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA6>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -261,6 +325,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA7>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -271,6 +339,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFB>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -290,6 +362,10 @@
 			<&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
 			<&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 	};
 
 	tpu: pwm@e6600000 {
@@ -297,6 +373,10 @@
 		reg = <0xe6600000 0x100>;
 		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 		#pwm-cells = <3>;
 	};
@@ -308,6 +388,10 @@
 			      0 57 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_MMC>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -319,6 +403,10 @@
 			      0 119 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI0>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -332,6 +420,10 @@
 			      0 123 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI1>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -345,6 +437,10 @@
 			      0 127 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp4_clks R8A7740_CLK_SDHI2>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -357,6 +453,10 @@
 		interrupts = <0 9 0x4>;
 		clocks = <&mstp3_clks R8A7740_CLK_FSI>;
 		power-domains = <&pd_a4mp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -409,6 +509,10 @@
 			reg = <0xe6150000 0x10000>;
 			clocks = <&extal1_clk>, <&extalr_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			clock-output-names = "system", "pllc0", "pllc1",
 					     "pllc2", "r",
@@ -424,6 +528,10 @@
 			reg = <0xe6150080 4>;
 			clocks = <&pllc1_div2_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-output-names = "sub";
 		};
@@ -433,6 +541,10 @@
 			compatible = "fixed-factor-clock";
 			clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -442,6 +554,10 @@
 			compatible = "fixed-factor-clock";
 			clocks = <&extal1_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -454,6 +570,10 @@
 			reg = <0xe6150080 4>;
 			clocks = <&sub_clk>, <&sub_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
@@ -470,6 +590,10 @@
 				 <&sub_clk>, <&sub_clk>,
 				 <&cpg_clocks R8A7740_CLK_B>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
@@ -492,6 +616,10 @@
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
@@ -522,6 +650,10 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
@@ -540,6 +672,10 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_USBH R8A7740_CLK_SDHI2
-- 
1.9.1


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

* [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: Rafael J. Wysocki, Simon Horman, Magnus Damm
  Cc: Ulf Hansson, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, linux-sh, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel, Geert Uytterhoeven

For now use 250 µs, just like the legacy platform code does.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 arch/arm/boot/dts/r8a7740.dtsi | 136 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 136 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index ed0adeb61a1ad8ec..713170442b7bd4b2 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -26,6 +26,10 @@
 			reg = <0x0>;
 			clock-frequency = <800000000>;
 			power-domains = <&pd_a3sm>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 		};
 	};
 
@@ -49,6 +53,10 @@
 		clocks = <&mstp3_clks R8A7740_CLK_CMT1>;
 		clock-names = "fck";
 		power-domains = <&pd_c5>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 
 		renesas,channels-mask = <0x3f>;
 
@@ -75,6 +83,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin1: IRQ8 - IRQ15 */
@@ -97,6 +109,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin2: IRQ16 - IRQ23 */
@@ -119,6 +135,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin3: IRQ24 - IRQ31 */
@@ -141,6 +161,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	ether: ethernet@e9a00000 {
@@ -150,6 +174,10 @@
 		interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_GETHER>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		phy-mode = "mii";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -167,6 +195,10 @@
 			      0 204 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp1_clks R8A7740_CLK_IIC0>;
 		power-domains = <&pd_a4r>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -181,6 +213,10 @@
 			      0 73 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_IIC1>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -191,6 +227,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -201,6 +241,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA1>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -211,6 +255,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -221,6 +269,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA3>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -231,6 +283,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA4>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -241,6 +297,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA5>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -251,6 +311,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA6>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -261,6 +325,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA7>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -271,6 +339,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFB>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -290,6 +362,10 @@
 			<&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
 			<&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 	};
 
 	tpu: pwm@e6600000 {
@@ -297,6 +373,10 @@
 		reg = <0xe6600000 0x100>;
 		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 		#pwm-cells = <3>;
 	};
@@ -308,6 +388,10 @@
 			      0 57 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_MMC>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -319,6 +403,10 @@
 			      0 119 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI0>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -332,6 +420,10 @@
 			      0 123 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI1>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -345,6 +437,10 @@
 			      0 127 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp4_clks R8A7740_CLK_SDHI2>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -357,6 +453,10 @@
 		interrupts = <0 9 0x4>;
 		clocks = <&mstp3_clks R8A7740_CLK_FSI>;
 		power-domains = <&pd_a4mp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -409,6 +509,10 @@
 			reg = <0xe6150000 0x10000>;
 			clocks = <&extal1_clk>, <&extalr_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			clock-output-names = "system", "pllc0", "pllc1",
 					     "pllc2", "r",
@@ -424,6 +528,10 @@
 			reg = <0xe6150080 4>;
 			clocks = <&pllc1_div2_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-output-names = "sub";
 		};
@@ -433,6 +541,10 @@
 			compatible = "fixed-factor-clock";
 			clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -442,6 +554,10 @@
 			compatible = "fixed-factor-clock";
 			clocks = <&extal1_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -454,6 +570,10 @@
 			reg = <0xe6150080 4>;
 			clocks = <&sub_clk>, <&sub_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
@@ -470,6 +590,10 @@
 				 <&sub_clk>, <&sub_clk>,
 				 <&cpg_clocks R8A7740_CLK_B>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
@@ -492,6 +616,10 @@
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
@@ -522,6 +650,10 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
@@ -540,6 +672,10 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_USBH R8A7740_CLK_SDHI2
-- 
1.9.1


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

* [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies
@ 2014-09-25 16:28   ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-25 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

For now use 250 ?s, just like the legacy platform code does.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - No changes
v2:
  - New

 arch/arm/boot/dts/r8a7740.dtsi | 136 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 136 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index ed0adeb61a1ad8ec..713170442b7bd4b2 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -26,6 +26,10 @@
 			reg = <0x0>;
 			clock-frequency = <800000000>;
 			power-domains = <&pd_a3sm>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 		};
 	};
 
@@ -49,6 +53,10 @@
 		clocks = <&mstp3_clks R8A7740_CLK_CMT1>;
 		clock-names = "fck";
 		power-domains = <&pd_c5>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 
 		renesas,channels-mask = <0x3f>;
 
@@ -75,6 +83,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin1: IRQ8 - IRQ15 */
@@ -97,6 +109,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin2: IRQ16 - IRQ23 */
@@ -119,6 +135,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	/* irqpin3: IRQ24 - IRQ31 */
@@ -141,6 +161,10 @@
 			      0 149 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 	};
 
 	ether: ethernet at e9a00000 {
@@ -150,6 +174,10 @@
 		interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_GETHER>;
 		power-domains = <&pd_a4s>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		phy-mode = "mii";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -167,6 +195,10 @@
 			      0 204 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp1_clks R8A7740_CLK_IIC0>;
 		power-domains = <&pd_a4r>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -181,6 +213,10 @@
 			      0 73 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_IIC1>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -191,6 +227,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -201,6 +241,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA1>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -211,6 +255,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -221,6 +269,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA3>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -231,6 +283,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA4>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -241,6 +297,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA5>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -251,6 +311,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA6>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -261,6 +325,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFA7>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -271,6 +339,10 @@
 		clocks = <&mstp2_clks R8A7740_CLK_SCIFB>;
 		clock-names = "sci_ick";
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -290,6 +362,10 @@
 			<&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
 			<&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 	};
 
 	tpu: pwm at e6600000 {
@@ -297,6 +373,10 @@
 		reg = <0xe6600000 0x100>;
 		clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 		#pwm-cells = <3>;
 	};
@@ -308,6 +388,10 @@
 			      0 57 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_MMC>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -319,6 +403,10 @@
 			      0 119 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI0>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -332,6 +420,10 @@
 			      0 123 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks R8A7740_CLK_SDHI1>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -345,6 +437,10 @@
 			      0 127 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp4_clks R8A7740_CLK_SDHI2>;
 		power-domains = <&pd_a3sp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -357,6 +453,10 @@
 		interrupts = <0 9 0x4>;
 		clocks = <&mstp3_clks R8A7740_CLK_FSI>;
 		power-domains = <&pd_a4mp>;
+		stop-latency = <250000>;
+		start-latency = <250000>;
+		save-state-latency = <250000>;
+		restore-state-latency = <250000>;
 		status = "disabled";
 	};
 
@@ -409,6 +509,10 @@
 			reg = <0xe6150000 0x10000>;
 			clocks = <&extal1_clk>, <&extalr_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			clock-output-names = "system", "pllc0", "pllc1",
 					     "pllc2", "r",
@@ -424,6 +528,10 @@
 			reg = <0xe6150080 4>;
 			clocks = <&pllc1_div2_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-output-names = "sub";
 		};
@@ -433,6 +541,10 @@
 			compatible = "fixed-factor-clock";
 			clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -442,6 +554,10 @@
 			compatible = "fixed-factor-clock";
 			clocks = <&extal1_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <0>;
 			clock-div = <2>;
 			clock-mult = <1>;
@@ -454,6 +570,10 @@
 			reg = <0xe6150080 4>;
 			clocks = <&sub_clk>, <&sub_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
@@ -470,6 +590,10 @@
 				 <&sub_clk>, <&sub_clk>,
 				 <&cpg_clocks R8A7740_CLK_B>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
@@ -492,6 +616,10 @@
 				 <&sub_clk>, <&sub_clk>, <&sub_clk>,
 				 <&sub_clk>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
@@ -522,6 +650,10 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
@@ -540,6 +672,10 @@
 				 <&cpg_clocks R8A7740_CLK_HP>,
 				 <&cpg_clocks R8A7740_CLK_HP>;
 			power-domains = <&pd_c5>;
+			stop-latency = <250000>;
+			start-latency = <250000>;
+			save-state-latency = <250000>;
+			restore-state-latency = <250000>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
 				R8A7740_CLK_USBH R8A7740_CLK_SDHI2
-- 
1.9.1

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

* Re: [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
  2014-09-25 16:28 ` Geert Uytterhoeven
  (?)
@ 2014-09-25 20:19   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 111+ messages in thread
From: Rafael J. Wysocki @ 2014-09-25 19:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, September 25, 2014 06:28:27 PM Geert Uytterhoeven wrote:
> 	Hi Rafael, Simon, Magnus,
> 
> This patch series enables DT support for PM domains on Renesas R-Mobile SoCs.
> 
> Currently it's limited to R-Mobile A1 (r8a7740), but given the similarity of
> the SYSC System-Controller on the various SH-Mobile/R-Mobile SoCs, and the
> abstraction of PM domains in DT, it should be sufficiently generic to handle
> other SoCs in the future (e.g. SH-Mobile AP4 (sh7372), SH-Mobile AG5 (sh73a0),
> R-Mobile APE6 (r8a73a4)).
> 
> Changes compared to v2 (more detailed changelogs in the individual patches):
>   - Minor changes to attach/detach callbacks,
>   - Really add the A4MP and D4 PM domains, as fixes are available (see
>     dependencies below),
>   - Scan DT topology to identify special PM domains (CPUs and console),
>   - Move PM domain power-on/off latencies to a separate patch.
> 
> Changes compared to v1 (more detailed changelogs in the individual patches):
>   - Several new patches: PM QoS device latencies in DT, attach/detach
>     callbacks,
>   - Run-Time management of the module clocks, making the hack in
>     drivers/sh/pm_runtime.c obsolete for DT platforms using genpd,
>   - Addition of PM QoS device latencies, specified from DT,
>   - Addition of build glue, so this builds and runs without additional
>     changes, incl. s2ram.
> 
> This means that functionality-wise, the DT version is now on par with the
> legacy version ("[PATCH v2 00/11] ARM: shmobile: r8a7740/armadillo800eva legacy
> PM domain support").
> 
> Dependencies:
>   - Simon Horman's renesas-devel-20140924-v3.17-rc6,
>   - Rafael J. Wysocki's linux-pm.git#linux-next,
>   - Jason Cooper's linux.git#irqchip/for-next.
>   - "ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain"
>     depends on the legacy version of this series, but if the legacy version
>     will never be accepted, the conflicts are trivial to resolve (drop changes
>     to non-existing PM domains),
>   - Working resume from s2ram depends on:
>       - "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq re-enable
> 	on resume",
>       - "[PATCH] ARM: hw_breakpoint: Trap undef instruction exceptions on
> 	wake-up", or an alternative solution.
>   - Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
>     shmobile: armadillo800eva dts: Add chosen/stdout-path".
> 
> For your convenience, I've also pushed this (incl. its dependencies) to
> git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git#rmobile-genpd
> 
> Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
> would be good to get this patch in v3.18-rc1, as it's the only hard dependency
> on linux-pm.git for the rest of this series. The other parts have relaxed
> ordering constraints due to the separation of code and DTS.

OK, this one looks good to me, so I can push it for 3.18.

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-25 20:19   ` Rafael J. Wysocki
  0 siblings, 0 replies; 111+ messages in thread
From: Rafael J. Wysocki @ 2014-09-25 20:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Simon Horman, Magnus Damm, Ulf Hansson, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, linux-sh,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On Thursday, September 25, 2014 06:28:27 PM Geert Uytterhoeven wrote:
> 	Hi Rafael, Simon, Magnus,
> 
> This patch series enables DT support for PM domains on Renesas R-Mobile SoCs.
> 
> Currently it's limited to R-Mobile A1 (r8a7740), but given the similarity of
> the SYSC System-Controller on the various SH-Mobile/R-Mobile SoCs, and the
> abstraction of PM domains in DT, it should be sufficiently generic to handle
> other SoCs in the future (e.g. SH-Mobile AP4 (sh7372), SH-Mobile AG5 (sh73a0),
> R-Mobile APE6 (r8a73a4)).
> 
> Changes compared to v2 (more detailed changelogs in the individual patches):
>   - Minor changes to attach/detach callbacks,
>   - Really add the A4MP and D4 PM domains, as fixes are available (see
>     dependencies below),
>   - Scan DT topology to identify special PM domains (CPUs and console),
>   - Move PM domain power-on/off latencies to a separate patch.
> 
> Changes compared to v1 (more detailed changelogs in the individual patches):
>   - Several new patches: PM QoS device latencies in DT, attach/detach
>     callbacks,
>   - Run-Time management of the module clocks, making the hack in
>     drivers/sh/pm_runtime.c obsolete for DT platforms using genpd,
>   - Addition of PM QoS device latencies, specified from DT,
>   - Addition of build glue, so this builds and runs without additional
>     changes, incl. s2ram.
> 
> This means that functionality-wise, the DT version is now on par with the
> legacy version ("[PATCH v2 00/11] ARM: shmobile: r8a7740/armadillo800eva legacy
> PM domain support").
> 
> Dependencies:
>   - Simon Horman's renesas-devel-20140924-v3.17-rc6,
>   - Rafael J. Wysocki's linux-pm.git#linux-next,
>   - Jason Cooper's linux.git#irqchip/for-next.
>   - "ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain"
>     depends on the legacy version of this series, but if the legacy version
>     will never be accepted, the conflicts are trivial to resolve (drop changes
>     to non-existing PM domains),
>   - Working resume from s2ram depends on:
>       - "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq re-enable
> 	on resume",
>       - "[PATCH] ARM: hw_breakpoint: Trap undef instruction exceptions on
> 	wake-up", or an alternative solution.
>   - Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
>     shmobile: armadillo800eva dts: Add chosen/stdout-path".
> 
> For your convenience, I've also pushed this (incl. its dependencies) to
> git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git#rmobile-genpd
> 
> Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
> would be good to get this patch in v3.18-rc1, as it's the only hard dependency
> on linux-pm.git for the rest of this series. The other parts have relaxed
> ordering constraints due to the separation of code and DTS.

OK, this one looks good to me, so I can push it for 3.18.

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-25 20:19   ` Rafael J. Wysocki
  0 siblings, 0 replies; 111+ messages in thread
From: Rafael J. Wysocki @ 2014-09-25 20:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, September 25, 2014 06:28:27 PM Geert Uytterhoeven wrote:
> 	Hi Rafael, Simon, Magnus,
> 
> This patch series enables DT support for PM domains on Renesas R-Mobile SoCs.
> 
> Currently it's limited to R-Mobile A1 (r8a7740), but given the similarity of
> the SYSC System-Controller on the various SH-Mobile/R-Mobile SoCs, and the
> abstraction of PM domains in DT, it should be sufficiently generic to handle
> other SoCs in the future (e.g. SH-Mobile AP4 (sh7372), SH-Mobile AG5 (sh73a0),
> R-Mobile APE6 (r8a73a4)).
> 
> Changes compared to v2 (more detailed changelogs in the individual patches):
>   - Minor changes to attach/detach callbacks,
>   - Really add the A4MP and D4 PM domains, as fixes are available (see
>     dependencies below),
>   - Scan DT topology to identify special PM domains (CPUs and console),
>   - Move PM domain power-on/off latencies to a separate patch.
> 
> Changes compared to v1 (more detailed changelogs in the individual patches):
>   - Several new patches: PM QoS device latencies in DT, attach/detach
>     callbacks,
>   - Run-Time management of the module clocks, making the hack in
>     drivers/sh/pm_runtime.c obsolete for DT platforms using genpd,
>   - Addition of PM QoS device latencies, specified from DT,
>   - Addition of build glue, so this builds and runs without additional
>     changes, incl. s2ram.
> 
> This means that functionality-wise, the DT version is now on par with the
> legacy version ("[PATCH v2 00/11] ARM: shmobile: r8a7740/armadillo800eva legacy
> PM domain support").
> 
> Dependencies:
>   - Simon Horman's renesas-devel-20140924-v3.17-rc6,
>   - Rafael J. Wysocki's linux-pm.git#linux-next,
>   - Jason Cooper's linux.git#irqchip/for-next.
>   - "ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain"
>     depends on the legacy version of this series, but if the legacy version
>     will never be accepted, the conflicts are trivial to resolve (drop changes
>     to non-existing PM domains),
>   - Working resume from s2ram depends on:
>       - "[PATCH/RFC] fbdev: sh_mobile_hdmi: Re-init regs before irq re-enable
> 	on resume",
>       - "[PATCH] ARM: hw_breakpoint: Trap undef instruction exceptions on
> 	wake-up", or an alternative solution.
>   - Working "no_console_suspend" handling depends on "[PATCH 06/13] ARM:
>     shmobile: armadillo800eva dts: Add chosen/stdout-path".
> 
> For your convenience, I've also pushed this (incl. its dependencies) to
> git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git#rmobile-genpd
> 
> Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
> would be good to get this patch in v3.18-rc1, as it's the only hard dependency
> on linux-pm.git for the rest of this series. The other parts have relaxed
> ordering constraints due to the separation of code and DTS.

OK, this one looks good to me, so I can push it for 3.18.

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:13     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Add a device node for the System Controller, with subnodes that
> represent the hardware power area hierarchy.
> Hook up all devices to their respective PM domains.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index 502483f4dccb2f45..4fead480a405bebe 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -383,6 +408,7 @@
>                         compatible = "renesas,r8a7740-cpg-clocks";
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -397,6 +423,7 @@
>                         compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -405,6 +432,7 @@
>                 pllc1_div2_clk: pllc1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -413,6 +441,7 @@
>                 extal1_div2_clk: extal1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -424,6 +453,7 @@
>                         compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -439,6 +469,7 @@
>                                  <&cpg_clocks R8A7740_CLK_B>,
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -460,6 +491,7 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -489,6 +521,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -506,6 +539,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Woosh, looks like I've been too eager adding links to the pd_c5 "always on"
PM domain to any node that has a clocks property. This must not be done for
the clocks. They are not instantiated as platform devices.

Thanks to Grygorii for questioning me.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support
@ 2014-09-26  8:13     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:13 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Add a device node for the System Controller, with subnodes that
> represent the hardware power area hierarchy.
> Hook up all devices to their respective PM domains.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index 502483f4dccb2f45..4fead480a405bebe 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -383,6 +408,7 @@
>                         compatible = "renesas,r8a7740-cpg-clocks";
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -397,6 +423,7 @@
>                         compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -405,6 +432,7 @@
>                 pllc1_div2_clk: pllc1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -413,6 +441,7 @@
>                 extal1_div2_clk: extal1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -424,6 +453,7 @@
>                         compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -439,6 +469,7 @@
>                                  <&cpg_clocks R8A7740_CLK_B>,
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -460,6 +491,7 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -489,6 +521,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -506,6 +539,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Woosh, looks like I've been too eager adding links to the pd_c5 "always on"
PM domain to any node that has a clocks property. This must not be done for
the clocks. They are not instantiated as platform devices.

Thanks to Grygorii for questioning me.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support
@ 2014-09-26  8:13     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:13 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Add a device node for the System Controller, with subnodes that
> represent the hardware power area hierarchy.
> Hook up all devices to their respective PM domains.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index 502483f4dccb2f45..4fead480a405bebe 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -383,6 +408,7 @@
>                         compatible = "renesas,r8a7740-cpg-clocks";
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -397,6 +423,7 @@
>                         compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -405,6 +432,7 @@
>                 pllc1_div2_clk: pllc1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -413,6 +441,7 @@
>                 extal1_div2_clk: extal1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -424,6 +453,7 @@
>                         compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -439,6 +469,7 @@
>                                  <&cpg_clocks R8A7740_CLK_B>,
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -460,6 +491,7 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -489,6 +521,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -506,6 +539,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Woosh, looks like I've been too eager adding links to the pd_c5 "always on"
PM domain to any node that has a clocks property. This must not be done for
the clocks. They are not instantiated as platform devices.

Thanks to Grygorii for questioning me.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support
@ 2014-09-26  8:13     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Add a device node for the System Controller, with subnodes that
> represent the hardware power area hierarchy.
> Hook up all devices to their respective PM domains.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index 502483f4dccb2f45..4fead480a405bebe 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -383,6 +408,7 @@
>                         compatible = "renesas,r8a7740-cpg-clocks";
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -397,6 +423,7 @@
>                         compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -405,6 +432,7 @@
>                 pllc1_div2_clk: pllc1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -413,6 +441,7 @@
>                 extal1_div2_clk: extal1_div2_clk {
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -424,6 +453,7 @@
>                         compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -439,6 +469,7 @@
>                                  <&cpg_clocks R8A7740_CLK_B>,
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -460,6 +491,7 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -489,6 +521,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -506,6 +539,7 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
> +                       power-domains = <&pd_c5>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Woosh, looks like I've been too eager adding links to the pd_c5 "always on"
PM domain to any node that has a clocks property. This must not be done for
the clocks. They are not instantiated as platform devices.

Thanks to Grygorii for questioning me.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:16     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index ed0adeb61a1ad8ec..713170442b7bd4b2 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -409,6 +509,10 @@
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -424,6 +528,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -433,6 +541,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -442,6 +554,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -454,6 +570,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -470,6 +590,10 @@
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -492,6 +616,10 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -522,6 +650,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -540,6 +672,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Same here, as there should be no power-domains properties in the clocks
nodes, there should be no latencies specified neither.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies
@ 2014-09-26  8:16     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index ed0adeb61a1ad8ec..713170442b7bd4b2 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -409,6 +509,10 @@
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -424,6 +528,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -433,6 +541,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -442,6 +554,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -454,6 +570,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -470,6 +590,10 @@
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -492,6 +616,10 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -522,6 +650,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -540,6 +672,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Same here, as there should be no power-domains properties in the clocks
nodes, there should be no latencies specified neither.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies
@ 2014-09-26  8:16     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index ed0adeb61a1ad8ec..713170442b7bd4b2 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -409,6 +509,10 @@
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -424,6 +528,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -433,6 +541,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -442,6 +554,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -454,6 +570,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -470,6 +590,10 @@
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -492,6 +616,10 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -522,6 +650,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -540,6 +672,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Same here, as there should be no power-domains properties in the clocks
nodes, there should be no latencies specified neither.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies
@ 2014-09-26  8:16     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
> index ed0adeb61a1ad8ec..713170442b7bd4b2 100644
> --- a/arch/arm/boot/dts/r8a7740.dtsi
> +++ b/arch/arm/boot/dts/r8a7740.dtsi

> @@ -409,6 +509,10 @@
>                         reg = <0xe6150000 0x10000>;
>                         clocks = <&extal1_clk>, <&extalr_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         clock-output-names = "system", "pllc0", "pllc1",
>                                              "pllc2", "r",
> @@ -424,6 +528,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&pllc1_div2_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-output-names = "sub";
>                 };
> @@ -433,6 +541,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -442,6 +554,10 @@
>                         compatible = "fixed-factor-clock";
>                         clocks = <&extal1_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <0>;
>                         clock-div = <2>;
>                         clock-mult = <1>;
> @@ -454,6 +570,10 @@
>                         reg = <0xe6150080 4>;
>                         clocks = <&sub_clk>, <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
> @@ -470,6 +590,10 @@
>                                  <&sub_clk>, <&sub_clk>,
>                                  <&cpg_clocks R8A7740_CLK_B>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
> @@ -492,6 +616,10 @@
>                                  <&sub_clk>, <&sub_clk>, <&sub_clk>,
>                                  <&sub_clk>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
> @@ -522,6 +650,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
> @@ -540,6 +672,10 @@
>                                  <&cpg_clocks R8A7740_CLK_HP>,
>                                  <&cpg_clocks R8A7740_CLK_HP>;
>                         power-domains = <&pd_c5>;
> +                       stop-latency = <250000>;
> +                       start-latency = <250000>;
> +                       save-state-latency = <250000>;
> +                       restore-state-latency = <250000>;
>                         #clock-cells = <1>;
>                         renesas,clock-indices = <
>                                 R8A7740_CLK_USBH R8A7740_CLK_SDHI2

Same here, as there should be no power-domains properties in the clocks
nodes, there should be no latencies specified neither.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:19     ` Ulf Hansson
  -1 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM domain power on/off-latencies are properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Acked-by: Kevin Hilman <khilman@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - Add Acked-by
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 98c16672ab5f49e0..7bc421d84367d636 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -19,12 +19,18 @@ Required properties:
>     providing multiple PM domains (e.g. power controllers), but can be any value
>     as specified by device tree binding documentation of particular provider.
>
> +Optional properties:
> + - power-on-latency: Power-on latency of the PM domain, in ns,
> + - power-off-latency: Power-off latency of the PM domain, in ns.
> +
>  Example:
>
>         power: power-controller@12340000 {
>                 compatible = "foo,power-controller";
>                 reg = <0x12340000 0x1000>;
>                 #power-domain-cells = <1>;
> +               power-on-latency = <250000>;
> +               power-off-latency = <250000>;
>         };
>
>  The node above defines a power controller that is a PM domain provider and
> --
> 1.9.1
>

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26  8:19     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM domain power on/off-latencies are properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Acked-by: Kevin Hilman <khilman@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - Add Acked-by
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 98c16672ab5f49e0..7bc421d84367d636 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -19,12 +19,18 @@ Required properties:
>     providing multiple PM domains (e.g. power controllers), but can be any value
>     as specified by device tree binding documentation of particular provider.
>
> +Optional properties:
> + - power-on-latency: Power-on latency of the PM domain, in ns,
> + - power-off-latency: Power-off latency of the PM domain, in ns.
> +
>  Example:
>
>         power: power-controller@12340000 {
>                 compatible = "foo,power-controller";
>                 reg = <0x12340000 0x1000>;
>                 #power-domain-cells = <1>;
> +               power-on-latency = <250000>;
> +               power-off-latency = <250000>;
>         };
>
>  The node above defines a power controller that is a PM domain provider and
> --
> 1.9.1
>

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26  8:19     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM domain power on/off-latencies are properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Acked-by: Kevin Hilman <khilman@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - Add Acked-by
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 98c16672ab5f49e0..7bc421d84367d636 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -19,12 +19,18 @@ Required properties:
>     providing multiple PM domains (e.g. power controllers), but can be any value
>     as specified by device tree binding documentation of particular provider.
>
> +Optional properties:
> + - power-on-latency: Power-on latency of the PM domain, in ns,
> + - power-off-latency: Power-off latency of the PM domain, in ns.
> +
>  Example:
>
>         power: power-controller@12340000 {
>                 compatible = "foo,power-controller";
>                 reg = <0x12340000 0x1000>;
>                 #power-domain-cells = <1>;
> +               power-on-latency = <250000>;
> +               power-off-latency = <250000>;
>         };
>
>  The node above defines a power controller that is a PM domain provider and
> --
> 1.9.1
>

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

* [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26  8:19     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM domain power on/off-latencies are properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Acked-by: Kevin Hilman <khilman@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - Add Acked-by
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 98c16672ab5f49e0..7bc421d84367d636 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -19,12 +19,18 @@ Required properties:
>     providing multiple PM domains (e.g. power controllers), but can be any value
>     as specified by device tree binding documentation of particular provider.
>
> +Optional properties:
> + - power-on-latency: Power-on latency of the PM domain, in ns,
> + - power-off-latency: Power-off latency of the PM domain, in ns.
> +
>  Example:
>
>         power: power-controller at 12340000 {
>                 compatible = "foo,power-controller";
>                 reg = <0x12340000 0x1000>;
>                 #power-domain-cells = <1>;
> +               power-on-latency = <250000>;
> +               power-off-latency = <250000>;
>         };
>
>  The node above defines a power controller that is a PM domain provider and
> --
> 1.9.1
>

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

* Re: [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:28     ` Ulf Hansson
  -1 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM QoS device start/stop and save/restore state latencies are more or
> less properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.

I am not so sure about this.

First, I think there a too much software affecting these latencies to
call them hardware properties.

Second, I am not sure that the future version of genpd will have all
these four latencies, but maybe only two. Let's see. I would thus
suggest to put this patch on hold for a while.

Kind regards
Uffe

>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Should these properties be called "linux,*-latency"?
>
> v3:
>   - No changes
> v2:
>   - New
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 7bc421d84367d636..024815bc257723b1 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -42,12 +42,22 @@ Required properties:
>   - power-domains : A phandle and PM domain specifier as defined by bindings of
>                     the power controller specified by phandle.
>
> +Optional properties:
> + - stop-latency: Stop latency of the device, in ns,
> + - start-latency: Start latency of the device, in ns,
> + - save-state-latency: Save-state latency of the device, in ns,
> + - restore-state-latency: Restore-state latency of the device, in ns.
> +
>  Example:
>
>         leaky-device@12350000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12350000 0x1000>;
>                 power-domains = <&power 0>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;
>         };
>
>  The node above defines a typical PM domain consumer device, which is located
> --
> 1.9.1
>

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

* Re: [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
@ 2014-09-26  8:28     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM QoS device start/stop and save/restore state latencies are more or
> less properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.

I am not so sure about this.

First, I think there a too much software affecting these latencies to
call them hardware properties.

Second, I am not sure that the future version of genpd will have all
these four latencies, but maybe only two. Let's see. I would thus
suggest to put this patch on hold for a while.

Kind regards
Uffe

>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Should these properties be called "linux,*-latency"?
>
> v3:
>   - No changes
> v2:
>   - New
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 7bc421d84367d636..024815bc257723b1 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -42,12 +42,22 @@ Required properties:
>   - power-domains : A phandle and PM domain specifier as defined by bindings of
>                     the power controller specified by phandle.
>
> +Optional properties:
> + - stop-latency: Stop latency of the device, in ns,
> + - start-latency: Start latency of the device, in ns,
> + - save-state-latency: Save-state latency of the device, in ns,
> + - restore-state-latency: Restore-state latency of the device, in ns.
> +
>  Example:
>
>         leaky-device@12350000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12350000 0x1000>;
>                 power-domains = <&power 0>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;
>         };
>
>  The node above defines a typical PM domain consumer device, which is located
> --
> 1.9.1
>

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

* Re: [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
@ 2014-09-26  8:28     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM QoS device start/stop and save/restore state latencies are more or
> less properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.

I am not so sure about this.

First, I think there a too much software affecting these latencies to
call them hardware properties.

Second, I am not sure that the future version of genpd will have all
these four latencies, but maybe only two. Let's see. I would thus
suggest to put this patch on hold for a while.

Kind regards
Uffe

>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Should these properties be called "linux,*-latency"?
>
> v3:
>   - No changes
> v2:
>   - New
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 7bc421d84367d636..024815bc257723b1 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -42,12 +42,22 @@ Required properties:
>   - power-domains : A phandle and PM domain specifier as defined by bindings of
>                     the power controller specified by phandle.
>
> +Optional properties:
> + - stop-latency: Stop latency of the device, in ns,
> + - start-latency: Start latency of the device, in ns,
> + - save-state-latency: Save-state latency of the device, in ns,
> + - restore-state-latency: Restore-state latency of the device, in ns.
> +
>  Example:
>
>         leaky-device@12350000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12350000 0x1000>;
>                 power-domains = <&power 0>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;
>         };
>
>  The node above defines a typical PM domain consumer device, which is located
> --
> 1.9.1
>

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

* [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies
@ 2014-09-26  8:28     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> PM QoS device start/stop and save/restore state latencies are more or
> less properties of the hardware.
> In legacy code, they're specified from platform code.
> On DT platforms, their values should come from DT.

I am not so sure about this.

First, I think there a too much software affecting these latencies to
call them hardware properties.

Second, I am not sure that the future version of genpd will have all
these four latencies, but maybe only two. Let's see. I would thus
suggest to put this patch on hold for a while.

Kind regards
Uffe

>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Should these properties be called "linux,*-latency"?
>
> v3:
>   - No changes
> v2:
>   - New
>
>  Documentation/devicetree/bindings/power/power_domain.txt | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 7bc421d84367d636..024815bc257723b1 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -42,12 +42,22 @@ Required properties:
>   - power-domains : A phandle and PM domain specifier as defined by bindings of
>                     the power controller specified by phandle.
>
> +Optional properties:
> + - stop-latency: Stop latency of the device, in ns,
> + - start-latency: Start latency of the device, in ns,
> + - save-state-latency: Save-state latency of the device, in ns,
> + - restore-state-latency: Restore-state latency of the device, in ns.
> +
>  Example:
>
>         leaky-device at 12350000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12350000 0x1000>;
>                 power-domains = <&power 0>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;
>         };
>
>  The node above defines a typical PM domain consumer device, which is located
> --
> 1.9.1
>

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

* Re: [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:32     ` Ulf Hansson
  -1 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> The Renesas R-Mobile System Controller provides a.o. power management
> support, following the generic PM domain bindings in
> Documentation/devicetree/bindings/power/power_domain.txt.
>
> For now this supports the R-Mobile A1 (r8a7740) only, but it should be
> sufficiently generic to handle other members of the SH-Mobile/R-Mobile
> family in the future.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
>   - Reword,
> v2:
>   - Fix copy-and-paste s/#address-cells/#size-cells/,
>   - Add optional PM QoS device latencies.
>
>  .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
>  1 file changed, 111 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
>
> diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> new file mode 100644
> index 0000000000000000..0b1e56d6ed1ab9a2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> @@ -0,0 +1,111 @@
> +DT bindings for the Renesas R-Mobile System Controller
> +
> += System Controller Node =
> +
> +The R-Mobile System Controller provides the following functions:
> +  - Boot mode management,
> +  - Reset generation,
> +  - Power management.
> +
> +Required properties:
> +- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
> +             fallback.
> +             Examples with soctypes are:
> +               - "renesas,sysc-r8a7740" (R-Mobile A1)
> +- reg: Two address start and address range blocks for the device:
> +         - The first block refers to the normally accessible registers,
> +         - the second block refers to the registers protected by the HPB
> +          semaphore.
> +
> +Optional nodes:
> +- pm-domains: This node contains a hierarchy of PM domain nodes, which should
> +  match the Power Area Hierarchy in the Power Domain Specifications section of
> +  the device's datasheet.
> +
> +
> += PM Domain Nodes =
> +
> +Each of the PM domain nodes represents a PM domain, as documented by the
> +generic PM domain bindings in
> +Documentation/devicetree/bindings/power/power_domain.txt.
> +
> +The nodes should be named by the real power area names, and thus their names
> +should be unique.
> +
> +Required properties:
> +  - #power-domain-cells: Must be 0.
> +
> +Optional properties:
> +- reg: If the PM domain is not always-on, this property must contain the bit
> +       index number for the corresponding power area in the various Power
> +       Control and Status Registers. The parent's node must contain the
> +       following two properties:
> +        - #address-cells: Must be 1,
> +        - #size-cells: Must be 0.
> +       If the PM domain is always-on, this property must be omitted.
> +- power-on-latency: Power-on latency of the PM domain, in ns,
> +- power-off-latency: Power-off latency of the PM domain, in ns.
> +
> +
> +Example:
> +
> +This shows a subset of the r8a7740 PM domain hierarchy, containing the
> +C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
> +which is a subdomain of A4S.
> +
> +       sysc: system-controller@e6180000 {
> +               compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
> +               reg = <0xe6180000 8000>, <0xe6188000 8000>;
> +
> +               pm-domains {
> +                       pd_c5: c5 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               #power-domain-cells = <0>;
> +
> +                               pd_a4s: a4s@10 {
> +                                       reg = <10>;
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +
> +                                       pd_a3sp: a3sp@11 {
> +                                               reg = <11>;
> +                                               #power-domain-cells = <0>;
> +                                               power-on-latency = <250000>;
> +                                               power-off-latency = <250000>;
> +                                       };
> +                               };
> +
> +                               pd_a4su: a4su@20 {
> +                                       reg = <20>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +                               };
> +                       };
> +               };
> +       };
> +
> +
> += PM Domain Consumers =
> +
> +Hardware blocks belonging to a PM domain should contain a "power-domains"
> +property that is a phandle pointing to the corresponding PM domain node,
> +and optional PM QoS device latencies:
> +
> +Example:
> +
> +       tpu: pwm@e6600000 {
> +               compatible = "renesas,tpu-r8a7740", "renesas,tpu";
> +               reg = <0xe6600000 0x100>;
> +               clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
> +               power-domains = <&pd_a3sp>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;

As per comment for the previous patch, I think you should remove these
latencies.

> +               #pwm-cells = <3>;
> +       };
> --
> 1.9.1
>

When you fixed the above you may add my reviewed by tag for this patch.

Kind regards
Uffe

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

* Re: [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
@ 2014-09-26  8:32     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:32 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> The Renesas R-Mobile System Controller provides a.o. power management
> support, following the generic PM domain bindings in
> Documentation/devicetree/bindings/power/power_domain.txt.
>
> For now this supports the R-Mobile A1 (r8a7740) only, but it should be
> sufficiently generic to handle other members of the SH-Mobile/R-Mobile
> family in the future.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
>   - Reword,
> v2:
>   - Fix copy-and-paste s/#address-cells/#size-cells/,
>   - Add optional PM QoS device latencies.
>
>  .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
>  1 file changed, 111 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
>
> diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> new file mode 100644
> index 0000000000000000..0b1e56d6ed1ab9a2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> @@ -0,0 +1,111 @@
> +DT bindings for the Renesas R-Mobile System Controller
> +
> +== System Controller Node ==
> +
> +The R-Mobile System Controller provides the following functions:
> +  - Boot mode management,
> +  - Reset generation,
> +  - Power management.
> +
> +Required properties:
> +- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
> +             fallback.
> +             Examples with soctypes are:
> +               - "renesas,sysc-r8a7740" (R-Mobile A1)
> +- reg: Two address start and address range blocks for the device:
> +         - The first block refers to the normally accessible registers,
> +         - the second block refers to the registers protected by the HPB
> +          semaphore.
> +
> +Optional nodes:
> +- pm-domains: This node contains a hierarchy of PM domain nodes, which should
> +  match the Power Area Hierarchy in the Power Domain Specifications section of
> +  the device's datasheet.
> +
> +
> +== PM Domain Nodes ==
> +
> +Each of the PM domain nodes represents a PM domain, as documented by the
> +generic PM domain bindings in
> +Documentation/devicetree/bindings/power/power_domain.txt.
> +
> +The nodes should be named by the real power area names, and thus their names
> +should be unique.
> +
> +Required properties:
> +  - #power-domain-cells: Must be 0.
> +
> +Optional properties:
> +- reg: If the PM domain is not always-on, this property must contain the bit
> +       index number for the corresponding power area in the various Power
> +       Control and Status Registers. The parent's node must contain the
> +       following two properties:
> +        - #address-cells: Must be 1,
> +        - #size-cells: Must be 0.
> +       If the PM domain is always-on, this property must be omitted.
> +- power-on-latency: Power-on latency of the PM domain, in ns,
> +- power-off-latency: Power-off latency of the PM domain, in ns.
> +
> +
> +Example:
> +
> +This shows a subset of the r8a7740 PM domain hierarchy, containing the
> +C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
> +which is a subdomain of A4S.
> +
> +       sysc: system-controller@e6180000 {
> +               compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
> +               reg = <0xe6180000 8000>, <0xe6188000 8000>;
> +
> +               pm-domains {
> +                       pd_c5: c5 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               #power-domain-cells = <0>;
> +
> +                               pd_a4s: a4s@10 {
> +                                       reg = <10>;
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +
> +                                       pd_a3sp: a3sp@11 {
> +                                               reg = <11>;
> +                                               #power-domain-cells = <0>;
> +                                               power-on-latency = <250000>;
> +                                               power-off-latency = <250000>;
> +                                       };
> +                               };
> +
> +                               pd_a4su: a4su@20 {
> +                                       reg = <20>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +                               };
> +                       };
> +               };
> +       };
> +
> +
> +== PM Domain Consumers ==
> +
> +Hardware blocks belonging to a PM domain should contain a "power-domains"
> +property that is a phandle pointing to the corresponding PM domain node,
> +and optional PM QoS device latencies:
> +
> +Example:
> +
> +       tpu: pwm@e6600000 {
> +               compatible = "renesas,tpu-r8a7740", "renesas,tpu";
> +               reg = <0xe6600000 0x100>;
> +               clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
> +               power-domains = <&pd_a3sp>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;

As per comment for the previous patch, I think you should remove these
latencies.

> +               #pwm-cells = <3>;
> +       };
> --
> 1.9.1
>

When you fixed the above you may add my reviewed by tag for this patch.

Kind regards
Uffe

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

* Re: [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
@ 2014-09-26  8:32     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:32 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> The Renesas R-Mobile System Controller provides a.o. power management
> support, following the generic PM domain bindings in
> Documentation/devicetree/bindings/power/power_domain.txt.
>
> For now this supports the R-Mobile A1 (r8a7740) only, but it should be
> sufficiently generic to handle other members of the SH-Mobile/R-Mobile
> family in the future.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
>   - Reword,
> v2:
>   - Fix copy-and-paste s/#address-cells/#size-cells/,
>   - Add optional PM QoS device latencies.
>
>  .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
>  1 file changed, 111 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
>
> diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> new file mode 100644
> index 0000000000000000..0b1e56d6ed1ab9a2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> @@ -0,0 +1,111 @@
> +DT bindings for the Renesas R-Mobile System Controller
> +
> +== System Controller Node ==
> +
> +The R-Mobile System Controller provides the following functions:
> +  - Boot mode management,
> +  - Reset generation,
> +  - Power management.
> +
> +Required properties:
> +- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
> +             fallback.
> +             Examples with soctypes are:
> +               - "renesas,sysc-r8a7740" (R-Mobile A1)
> +- reg: Two address start and address range blocks for the device:
> +         - The first block refers to the normally accessible registers,
> +         - the second block refers to the registers protected by the HPB
> +          semaphore.
> +
> +Optional nodes:
> +- pm-domains: This node contains a hierarchy of PM domain nodes, which should
> +  match the Power Area Hierarchy in the Power Domain Specifications section of
> +  the device's datasheet.
> +
> +
> +== PM Domain Nodes ==
> +
> +Each of the PM domain nodes represents a PM domain, as documented by the
> +generic PM domain bindings in
> +Documentation/devicetree/bindings/power/power_domain.txt.
> +
> +The nodes should be named by the real power area names, and thus their names
> +should be unique.
> +
> +Required properties:
> +  - #power-domain-cells: Must be 0.
> +
> +Optional properties:
> +- reg: If the PM domain is not always-on, this property must contain the bit
> +       index number for the corresponding power area in the various Power
> +       Control and Status Registers. The parent's node must contain the
> +       following two properties:
> +        - #address-cells: Must be 1,
> +        - #size-cells: Must be 0.
> +       If the PM domain is always-on, this property must be omitted.
> +- power-on-latency: Power-on latency of the PM domain, in ns,
> +- power-off-latency: Power-off latency of the PM domain, in ns.
> +
> +
> +Example:
> +
> +This shows a subset of the r8a7740 PM domain hierarchy, containing the
> +C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
> +which is a subdomain of A4S.
> +
> +       sysc: system-controller@e6180000 {
> +               compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
> +               reg = <0xe6180000 8000>, <0xe6188000 8000>;
> +
> +               pm-domains {
> +                       pd_c5: c5 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               #power-domain-cells = <0>;
> +
> +                               pd_a4s: a4s@10 {
> +                                       reg = <10>;
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +
> +                                       pd_a3sp: a3sp@11 {
> +                                               reg = <11>;
> +                                               #power-domain-cells = <0>;
> +                                               power-on-latency = <250000>;
> +                                               power-off-latency = <250000>;
> +                                       };
> +                               };
> +
> +                               pd_a4su: a4su@20 {
> +                                       reg = <20>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +                               };
> +                       };
> +               };
> +       };
> +
> +
> +== PM Domain Consumers ==
> +
> +Hardware blocks belonging to a PM domain should contain a "power-domains"
> +property that is a phandle pointing to the corresponding PM domain node,
> +and optional PM QoS device latencies:
> +
> +Example:
> +
> +       tpu: pwm@e6600000 {
> +               compatible = "renesas,tpu-r8a7740", "renesas,tpu";
> +               reg = <0xe6600000 0x100>;
> +               clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
> +               power-domains = <&pd_a3sp>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;

As per comment for the previous patch, I think you should remove these
latencies.

> +               #pwm-cells = <3>;
> +       };
> --
> 1.9.1
>

When you fixed the above you may add my reviewed by tag for this patch.

Kind regards
Uffe

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

* [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller
@ 2014-09-26  8:32     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> The Renesas R-Mobile System Controller provides a.o. power management
> support, following the generic PM domain bindings in
> Documentation/devicetree/bindings/power/power_domain.txt.
>
> For now this supports the R-Mobile A1 (r8a7740) only, but it should be
> sufficiently generic to handle other members of the SH-Mobile/R-Mobile
> family in the future.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
>   - Reword,
> v2:
>   - Fix copy-and-paste s/#address-cells/#size-cells/,
>   - Add optional PM QoS device latencies.
>
>  .../bindings/power/renesas,sysc-rmobile.txt        | 111 +++++++++++++++++++++
>  1 file changed, 111 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
>
> diff --git a/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> new file mode 100644
> index 0000000000000000..0b1e56d6ed1ab9a2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/renesas,sysc-rmobile.txt
> @@ -0,0 +1,111 @@
> +DT bindings for the Renesas R-Mobile System Controller
> +
> +== System Controller Node ==
> +
> +The R-Mobile System Controller provides the following functions:
> +  - Boot mode management,
> +  - Reset generation,
> +  - Power management.
> +
> +Required properties:
> +- compatible: Should be "renesas,sysc-<soctype>", "renesas,sysc-rmobile" as
> +             fallback.
> +             Examples with soctypes are:
> +               - "renesas,sysc-r8a7740" (R-Mobile A1)
> +- reg: Two address start and address range blocks for the device:
> +         - The first block refers to the normally accessible registers,
> +         - the second block refers to the registers protected by the HPB
> +          semaphore.
> +
> +Optional nodes:
> +- pm-domains: This node contains a hierarchy of PM domain nodes, which should
> +  match the Power Area Hierarchy in the Power Domain Specifications section of
> +  the device's datasheet.
> +
> +
> +== PM Domain Nodes ==
> +
> +Each of the PM domain nodes represents a PM domain, as documented by the
> +generic PM domain bindings in
> +Documentation/devicetree/bindings/power/power_domain.txt.
> +
> +The nodes should be named by the real power area names, and thus their names
> +should be unique.
> +
> +Required properties:
> +  - #power-domain-cells: Must be 0.
> +
> +Optional properties:
> +- reg: If the PM domain is not always-on, this property must contain the bit
> +       index number for the corresponding power area in the various Power
> +       Control and Status Registers. The parent's node must contain the
> +       following two properties:
> +        - #address-cells: Must be 1,
> +        - #size-cells: Must be 0.
> +       If the PM domain is always-on, this property must be omitted.
> +- power-on-latency: Power-on latency of the PM domain, in ns,
> +- power-off-latency: Power-off latency of the PM domain, in ns.
> +
> +
> +Example:
> +
> +This shows a subset of the r8a7740 PM domain hierarchy, containing the
> +C5 "always-on" domain, 2 of its subdomains (A4S and A4SU), and the A3SP domain,
> +which is a subdomain of A4S.
> +
> +       sysc: system-controller at e6180000 {
> +               compatible = "renesas,sysc-r8a7740", "renesas,sysc-rmobile";
> +               reg = <0xe6180000 8000>, <0xe6188000 8000>;
> +
> +               pm-domains {
> +                       pd_c5: c5 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               #power-domain-cells = <0>;
> +
> +                               pd_a4s: a4s at 10 {
> +                                       reg = <10>;
> +                                       #address-cells = <1>;
> +                                       #size-cells = <0>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +
> +                                       pd_a3sp: a3sp at 11 {
> +                                               reg = <11>;
> +                                               #power-domain-cells = <0>;
> +                                               power-on-latency = <250000>;
> +                                               power-off-latency = <250000>;
> +                                       };
> +                               };
> +
> +                               pd_a4su: a4su at 20 {
> +                                       reg = <20>;
> +                                       #power-domain-cells = <0>;
> +                                       power-on-latency = <250000>;
> +                                       power-off-latency = <250000>;
> +                               };
> +                       };
> +               };
> +       };
> +
> +
> +== PM Domain Consumers ==
> +
> +Hardware blocks belonging to a PM domain should contain a "power-domains"
> +property that is a phandle pointing to the corresponding PM domain node,
> +and optional PM QoS device latencies:
> +
> +Example:
> +
> +       tpu: pwm at e6600000 {
> +               compatible = "renesas,tpu-r8a7740", "renesas,tpu";
> +               reg = <0xe6600000 0x100>;
> +               clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
> +               power-domains = <&pd_a3sp>;
> +               stop-latency = <250000>;
> +               start-latency = <250000>;
> +               save-state-latency = <250000>;
> +               restore-state-latency = <250000>;

As per comment for the previous patch, I think you should remove these
latencies.

> +               #pwm-cells = <3>;
> +       };
> --
> 1.9.1
>

When you fixed the above you may add my reviewed by tag for this patch.

Kind regards
Uffe

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

* Re: [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:43     ` Ulf Hansson
  -1 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:

Why?

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Normally I think this kind of cleanup patches is a bit unnecessary,
but I don't have strong opinions.

Kind regards
Uffe

> ---
> v3:
>   - No changes
> v2:
>   - New
>
>  drivers/base/power/domain.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 6e36bb09e7d9c144..0ebc6bb31c9c227f 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2171,17 +2171,18 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
>   */
>  int genpd_dev_pm_attach(struct device *dev)
>  {
> +       struct device_node *np = dev->of_node;
>         struct of_phandle_args pd_args;
>         struct generic_pm_domain *pd;
>         int ret;
>
> -       if (!dev->of_node)
> +       if (!np)
>                 return -ENODEV;
>
>         if (dev->pm_domain)
>                 return -EEXIST;
>
> -       ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
> +       ret = of_parse_phandle_with_args(np, "power-domains",
>                                         "#power-domain-cells", 0, &pd_args);
>         if (ret < 0) {
>                 if (ret != -ENOENT)
> @@ -2192,8 +2193,7 @@ int genpd_dev_pm_attach(struct device *dev)
>                  * (for backwards compatibility of DT ABI)
>                  */
>                 pd_args.args_count = 0;
> -               pd_args.np = of_parse_phandle(dev->of_node,
> -                                               "samsung,power-domain", 0);
> +               pd_args.np = of_parse_phandle(np, "samsung,power-domain", 0);
>                 if (!pd_args.np)
>                         return -ENOENT;
>         }
> @@ -2202,7 +2202,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (IS_ERR(pd)) {
>                 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
>                         __func__, PTR_ERR(pd));
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return PTR_ERR(pd);
>         }
>
> @@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (ret < 0) {
>                 dev_err(dev, "failed to add to PM domain %s: %d",
>                         pd->name, ret);
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return ret;
>         }
>
> --
> 1.9.1
>

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

* Re: [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-26  8:43     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:43 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:

Why?

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Normally I think this kind of cleanup patches is a bit unnecessary,
but I don't have strong opinions.

Kind regards
Uffe

> ---
> v3:
>   - No changes
> v2:
>   - New
>
>  drivers/base/power/domain.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 6e36bb09e7d9c144..0ebc6bb31c9c227f 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2171,17 +2171,18 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
>   */
>  int genpd_dev_pm_attach(struct device *dev)
>  {
> +       struct device_node *np = dev->of_node;
>         struct of_phandle_args pd_args;
>         struct generic_pm_domain *pd;
>         int ret;
>
> -       if (!dev->of_node)
> +       if (!np)
>                 return -ENODEV;
>
>         if (dev->pm_domain)
>                 return -EEXIST;
>
> -       ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
> +       ret = of_parse_phandle_with_args(np, "power-domains",
>                                         "#power-domain-cells", 0, &pd_args);
>         if (ret < 0) {
>                 if (ret != -ENOENT)
> @@ -2192,8 +2193,7 @@ int genpd_dev_pm_attach(struct device *dev)
>                  * (for backwards compatibility of DT ABI)
>                  */
>                 pd_args.args_count = 0;
> -               pd_args.np = of_parse_phandle(dev->of_node,
> -                                               "samsung,power-domain", 0);
> +               pd_args.np = of_parse_phandle(np, "samsung,power-domain", 0);
>                 if (!pd_args.np)
>                         return -ENOENT;
>         }
> @@ -2202,7 +2202,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (IS_ERR(pd)) {
>                 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
>                         __func__, PTR_ERR(pd));
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return PTR_ERR(pd);
>         }
>
> @@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (ret < 0) {
>                 dev_err(dev, "failed to add to PM domain %s: %d",
>                         pd->name, ret);
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return ret;
>         }
>
> --
> 1.9.1
>

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

* Re: [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-26  8:43     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:43 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:

Why?

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Normally I think this kind of cleanup patches is a bit unnecessary,
but I don't have strong opinions.

Kind regards
Uffe

> ---
> v3:
>   - No changes
> v2:
>   - New
>
>  drivers/base/power/domain.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 6e36bb09e7d9c144..0ebc6bb31c9c227f 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2171,17 +2171,18 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
>   */
>  int genpd_dev_pm_attach(struct device *dev)
>  {
> +       struct device_node *np = dev->of_node;
>         struct of_phandle_args pd_args;
>         struct generic_pm_domain *pd;
>         int ret;
>
> -       if (!dev->of_node)
> +       if (!np)
>                 return -ENODEV;
>
>         if (dev->pm_domain)
>                 return -EEXIST;
>
> -       ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
> +       ret = of_parse_phandle_with_args(np, "power-domains",
>                                         "#power-domain-cells", 0, &pd_args);
>         if (ret < 0) {
>                 if (ret != -ENOENT)
> @@ -2192,8 +2193,7 @@ int genpd_dev_pm_attach(struct device *dev)
>                  * (for backwards compatibility of DT ABI)
>                  */
>                 pd_args.args_count = 0;
> -               pd_args.np = of_parse_phandle(dev->of_node,
> -                                               "samsung,power-domain", 0);
> +               pd_args.np = of_parse_phandle(np, "samsung,power-domain", 0);
>                 if (!pd_args.np)
>                         return -ENOENT;
>         }
> @@ -2202,7 +2202,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (IS_ERR(pd)) {
>                 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
>                         __func__, PTR_ERR(pd));
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return PTR_ERR(pd);
>         }
>
> @@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (ret < 0) {
>                 dev_err(dev, "failed to add to PM domain %s: %d",
>                         pd->name, ret);
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return ret;
>         }
>
> --
> 1.9.1
>

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

* [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-26  8:43     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:

Why?

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Normally I think this kind of cleanup patches is a bit unnecessary,
but I don't have strong opinions.

Kind regards
Uffe

> ---
> v3:
>   - No changes
> v2:
>   - New
>
>  drivers/base/power/domain.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 6e36bb09e7d9c144..0ebc6bb31c9c227f 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2171,17 +2171,18 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
>   */
>  int genpd_dev_pm_attach(struct device *dev)
>  {
> +       struct device_node *np = dev->of_node;
>         struct of_phandle_args pd_args;
>         struct generic_pm_domain *pd;
>         int ret;
>
> -       if (!dev->of_node)
> +       if (!np)
>                 return -ENODEV;
>
>         if (dev->pm_domain)
>                 return -EEXIST;
>
> -       ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
> +       ret = of_parse_phandle_with_args(np, "power-domains",
>                                         "#power-domain-cells", 0, &pd_args);
>         if (ret < 0) {
>                 if (ret != -ENOENT)
> @@ -2192,8 +2193,7 @@ int genpd_dev_pm_attach(struct device *dev)
>                  * (for backwards compatibility of DT ABI)
>                  */
>                 pd_args.args_count = 0;
> -               pd_args.np = of_parse_phandle(dev->of_node,
> -                                               "samsung,power-domain", 0);
> +               pd_args.np = of_parse_phandle(np, "samsung,power-domain", 0);
>                 if (!pd_args.np)
>                         return -ENOENT;
>         }
> @@ -2202,7 +2202,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (IS_ERR(pd)) {
>                 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
>                         __func__, PTR_ERR(pd));
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return PTR_ERR(pd);
>         }
>
> @@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)
>         if (ret < 0) {
>                 dev_err(dev, "failed to add to PM domain %s: %d",
>                         pd->name, ret);
> -               of_node_put(dev->of_node);
> +               of_node_put(np);
>                 return ret;
>         }
>
> --
> 1.9.1
>

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:45     ` Ulf Hansson
  -1 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:45 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Use the just introduced genpd attach/detach callbacks to register the
> devices' module clocks, instead of doing it directly, to make it
> DT-proof.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - Update for callback signature changes,
> v2:
>   - New
>
>  arch/arm/mach-shmobile/pm-rmobile.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);
> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],
> --
> 1.9.1
>

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-26  8:45     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:45 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Use the just introduced genpd attach/detach callbacks to register the
> devices' module clocks, instead of doing it directly, to make it
> DT-proof.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - Update for callback signature changes,
> v2:
>   - New
>
>  arch/arm/mach-shmobile/pm-rmobile.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);
> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],
> --
> 1.9.1
>

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-26  8:45     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:45 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Use the just introduced genpd attach/detach callbacks to register the
> devices' module clocks, instead of doing it directly, to make it
> DT-proof.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - Update for callback signature changes,
> v2:
>   - New
>
>  arch/arm/mach-shmobile/pm-rmobile.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);
> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],
> --
> 1.9.1
>

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

* [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-26  8:45     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:45 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Use the just introduced genpd attach/detach callbacks to register the
> devices' module clocks, instead of doing it directly, to make it
> DT-proof.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - Update for callback signature changes,
> v2:
>   - New
>
>  arch/arm/mach-shmobile/pm-rmobile.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);
> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],
> --
> 1.9.1
>

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

* Re: [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26  8:47     ` Ulf Hansson
  -1 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:47 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Replace the hardcoded addresses for accessing the SYSC PM domain
> registers by register offsets, relative to the SYSC base address stored
> in struct rmobile_pm_domain.
>
> In the future, the SYSC base address will come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - No changes
>
>  arch/arm/mach-shmobile/pm-r8a7740.c | 14 ++++++++++++++
>  arch/arm/mach-shmobile/pm-rmobile.c | 24 +++++++++++++-----------
>  arch/arm/mach-shmobile/pm-rmobile.h |  1 +
>  arch/arm/mach-shmobile/pm-sh7372.c  | 11 +++++++++++
>  4 files changed, 39 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
> index 41e61f1b5d44f00d..f92e64fd91de5631 100644
> --- a/arch/arm/mach-shmobile/pm-r8a7740.c
> +++ b/arch/arm/mach-shmobile/pm-r8a7740.c
> @@ -9,10 +9,14 @@
>   * for more details.
>   */
>  #include <linux/console.h>
> +#include <linux/io.h>
>  #include <linux/suspend.h>
> +
>  #include "common.h"
>  #include "pm-rmobile.h"
>
> +#define SYSC_BASE      IOMEM(0xe6180000)
> +
>  #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
>  static int r8a7740_pd_a3sm_suspend(void)
>  {
> @@ -35,39 +39,49 @@ static int r8a7740_pd_a3sp_suspend(void)
>  static struct rmobile_pm_domain r8a7740_pm_domains[] = {
>         {
>                 .genpd.name     = "A4LC",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 1,
>         }, {
>                 .genpd.name     = "A4MP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 2,
>         }, {
>                 .genpd.name     = "D4",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 3,
>         }, {
>                 .genpd.name     = "A4R",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 5,
>         }, {
>                 .genpd.name     = "A3RV",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 6,
>         }, {
>                 .genpd.name     = "A4S",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 10,
>                 .no_debug       = true,
>         }, {
>                 .genpd.name     = "A3SP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 11,
>                 .gov            = &pm_domain_always_on_gov,
>                 .no_debug       = true,
>                 .suspend        = r8a7740_pd_a3sp_suspend,
>         }, {
>                 .genpd.name     = "A3SM",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 12,
>                 .gov            = &pm_domain_always_on_gov,
>                 .suspend        = r8a7740_pd_a3sm_suspend,
>         }, {
>                 .genpd.name     = "A3SG",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 13,
>         }, {
>                 .genpd.name     = "A4SU",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 20,
>         },
>  };
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index ae846dfcd69293f7..8b876fcf7d0fc2ba 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -20,9 +20,9 @@
>  #include "pm-rmobile.h"
>
>  /* SYSC */
> -#define SPDCR          IOMEM(0xe6180008)
> -#define SWUCR          IOMEM(0xe6180014)
> -#define PSTR           IOMEM(0xe6180080)
> +#define SPDCR  0x08    /* SYS Power Down Control Register */
> +#define SWUCR  0x14    /* SYS Wakeup Control Register */
> +#define PSTR   0x80    /* Power Status Register */
>
>  #define PSTR_RETRIES   100
>  #define PSTR_DELAY_US  10
> @@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>                         return ret;
>         }
>
> -       if (__raw_readl(PSTR) & mask) {
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
>                 unsigned int retry_count;
> -               __raw_writel(mask, SPDCR);
> +               __raw_writel(mask, rmobile_pd->base + SPDCR);
>
>                 for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
> -                       if (!(__raw_readl(SPDCR) & mask))
> +                       if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
>                                 break;
>                         cpu_relax();
>                 }
> @@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
> -                        genpd->name, mask, __raw_readl(PSTR));
> +                        genpd->name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>         return 0;
>  }
> @@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>         unsigned int retry_count;
>         int ret = 0;
>
> -       if (__raw_readl(PSTR) & mask)
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask)
>                 goto out;
>
> -       __raw_writel(mask, SWUCR);
> +       __raw_writel(mask, rmobile_pd->base + SWUCR);
>
>         for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
> -               if (!(__raw_readl(SWUCR) & mask))
> +               if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
>                         break;
>                 if (retry_count > PSTR_RETRIES)
>                         udelay(PSTR_DELAY_US);
> @@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
> -                        rmobile_pd->genpd.name, mask, __raw_readl(PSTR));
> +                        rmobile_pd->genpd.name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>  out:
>         if (ret = 0 && rmobile_pd->resume && do_resume)
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
> index 8f66b343162b0411..0602130bb260c31d 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.h
> +++ b/arch/arm/mach-shmobile/pm-rmobile.h
> @@ -21,6 +21,7 @@ struct rmobile_pm_domain {
>         struct dev_power_governor *gov;
>         int (*suspend)(void);
>         void (*resume)(void);
> +       void __iomem *base;
>         unsigned int bit_shift;
>         bool no_debug;
>  };
> diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
> index 7e5c2676c48902f1..7181a280b3b541af 100644
> --- a/arch/arm/mach-shmobile/pm-sh7372.c
> +++ b/arch/arm/mach-shmobile/pm-sh7372.c
> @@ -45,6 +45,8 @@
>  #define PLLC01STPCR IOMEM(0xe61500c8)
>
>  /* SYSC */
> +#define SYSC_BASE IOMEM(0xe6180000)
> +
>  #define SBAR IOMEM(0xe6180020)
>  #define WUPRMSK IOMEM(0xe6180028)
>  #define WUPSMSK IOMEM(0xe618002c)
> @@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A4LC",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 1,
>         },
>         {
>                 .genpd.name = "A4MP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 2,
>         },
>         {
>                 .genpd.name = "D4",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 3,
>         },
>         {
>                 .genpd.name = "A4R",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 5,
>                 .suspend = sh7372_a4r_pd_suspend,
>                 .resume = sh7372_intcs_resume,
> @@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3RV",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 6,
>         },
>         {
>                 .genpd.name = "A3RI",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 8,
>         },
>         {
>                 .genpd.name = "A4S",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 10,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 11,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SG",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 13,
>         },
>  };
> --
> 1.9.1
>

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

* Re: [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
@ 2014-09-26  8:47     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:47 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Replace the hardcoded addresses for accessing the SYSC PM domain
> registers by register offsets, relative to the SYSC base address stored
> in struct rmobile_pm_domain.
>
> In the future, the SYSC base address will come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - No changes
>
>  arch/arm/mach-shmobile/pm-r8a7740.c | 14 ++++++++++++++
>  arch/arm/mach-shmobile/pm-rmobile.c | 24 +++++++++++++-----------
>  arch/arm/mach-shmobile/pm-rmobile.h |  1 +
>  arch/arm/mach-shmobile/pm-sh7372.c  | 11 +++++++++++
>  4 files changed, 39 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
> index 41e61f1b5d44f00d..f92e64fd91de5631 100644
> --- a/arch/arm/mach-shmobile/pm-r8a7740.c
> +++ b/arch/arm/mach-shmobile/pm-r8a7740.c
> @@ -9,10 +9,14 @@
>   * for more details.
>   */
>  #include <linux/console.h>
> +#include <linux/io.h>
>  #include <linux/suspend.h>
> +
>  #include "common.h"
>  #include "pm-rmobile.h"
>
> +#define SYSC_BASE      IOMEM(0xe6180000)
> +
>  #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
>  static int r8a7740_pd_a3sm_suspend(void)
>  {
> @@ -35,39 +39,49 @@ static int r8a7740_pd_a3sp_suspend(void)
>  static struct rmobile_pm_domain r8a7740_pm_domains[] = {
>         {
>                 .genpd.name     = "A4LC",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 1,
>         }, {
>                 .genpd.name     = "A4MP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 2,
>         }, {
>                 .genpd.name     = "D4",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 3,
>         }, {
>                 .genpd.name     = "A4R",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 5,
>         }, {
>                 .genpd.name     = "A3RV",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 6,
>         }, {
>                 .genpd.name     = "A4S",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 10,
>                 .no_debug       = true,
>         }, {
>                 .genpd.name     = "A3SP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 11,
>                 .gov            = &pm_domain_always_on_gov,
>                 .no_debug       = true,
>                 .suspend        = r8a7740_pd_a3sp_suspend,
>         }, {
>                 .genpd.name     = "A3SM",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 12,
>                 .gov            = &pm_domain_always_on_gov,
>                 .suspend        = r8a7740_pd_a3sm_suspend,
>         }, {
>                 .genpd.name     = "A3SG",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 13,
>         }, {
>                 .genpd.name     = "A4SU",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 20,
>         },
>  };
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index ae846dfcd69293f7..8b876fcf7d0fc2ba 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -20,9 +20,9 @@
>  #include "pm-rmobile.h"
>
>  /* SYSC */
> -#define SPDCR          IOMEM(0xe6180008)
> -#define SWUCR          IOMEM(0xe6180014)
> -#define PSTR           IOMEM(0xe6180080)
> +#define SPDCR  0x08    /* SYS Power Down Control Register */
> +#define SWUCR  0x14    /* SYS Wakeup Control Register */
> +#define PSTR   0x80    /* Power Status Register */
>
>  #define PSTR_RETRIES   100
>  #define PSTR_DELAY_US  10
> @@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>                         return ret;
>         }
>
> -       if (__raw_readl(PSTR) & mask) {
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
>                 unsigned int retry_count;
> -               __raw_writel(mask, SPDCR);
> +               __raw_writel(mask, rmobile_pd->base + SPDCR);
>
>                 for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
> -                       if (!(__raw_readl(SPDCR) & mask))
> +                       if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
>                                 break;
>                         cpu_relax();
>                 }
> @@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
> -                        genpd->name, mask, __raw_readl(PSTR));
> +                        genpd->name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>         return 0;
>  }
> @@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>         unsigned int retry_count;
>         int ret = 0;
>
> -       if (__raw_readl(PSTR) & mask)
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask)
>                 goto out;
>
> -       __raw_writel(mask, SWUCR);
> +       __raw_writel(mask, rmobile_pd->base + SWUCR);
>
>         for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
> -               if (!(__raw_readl(SWUCR) & mask))
> +               if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
>                         break;
>                 if (retry_count > PSTR_RETRIES)
>                         udelay(PSTR_DELAY_US);
> @@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
> -                        rmobile_pd->genpd.name, mask, __raw_readl(PSTR));
> +                        rmobile_pd->genpd.name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>  out:
>         if (ret == 0 && rmobile_pd->resume && do_resume)
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
> index 8f66b343162b0411..0602130bb260c31d 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.h
> +++ b/arch/arm/mach-shmobile/pm-rmobile.h
> @@ -21,6 +21,7 @@ struct rmobile_pm_domain {
>         struct dev_power_governor *gov;
>         int (*suspend)(void);
>         void (*resume)(void);
> +       void __iomem *base;
>         unsigned int bit_shift;
>         bool no_debug;
>  };
> diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
> index 7e5c2676c48902f1..7181a280b3b541af 100644
> --- a/arch/arm/mach-shmobile/pm-sh7372.c
> +++ b/arch/arm/mach-shmobile/pm-sh7372.c
> @@ -45,6 +45,8 @@
>  #define PLLC01STPCR IOMEM(0xe61500c8)
>
>  /* SYSC */
> +#define SYSC_BASE IOMEM(0xe6180000)
> +
>  #define SBAR IOMEM(0xe6180020)
>  #define WUPRMSK IOMEM(0xe6180028)
>  #define WUPSMSK IOMEM(0xe618002c)
> @@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A4LC",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 1,
>         },
>         {
>                 .genpd.name = "A4MP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 2,
>         },
>         {
>                 .genpd.name = "D4",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 3,
>         },
>         {
>                 .genpd.name = "A4R",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 5,
>                 .suspend = sh7372_a4r_pd_suspend,
>                 .resume = sh7372_intcs_resume,
> @@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3RV",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 6,
>         },
>         {
>                 .genpd.name = "A3RI",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 8,
>         },
>         {
>                 .genpd.name = "A4S",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 10,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 11,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SG",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 13,
>         },
>  };
> --
> 1.9.1
>

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

* Re: [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
@ 2014-09-26  8:47     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:47 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Tomasz Figa,
	Philipp Zabel, Grygorii Strashko, Kevin Hilman, Linux-sh list,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Replace the hardcoded addresses for accessing the SYSC PM domain
> registers by register offsets, relative to the SYSC base address stored
> in struct rmobile_pm_domain.
>
> In the future, the SYSC base address will come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - No changes
>
>  arch/arm/mach-shmobile/pm-r8a7740.c | 14 ++++++++++++++
>  arch/arm/mach-shmobile/pm-rmobile.c | 24 +++++++++++++-----------
>  arch/arm/mach-shmobile/pm-rmobile.h |  1 +
>  arch/arm/mach-shmobile/pm-sh7372.c  | 11 +++++++++++
>  4 files changed, 39 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
> index 41e61f1b5d44f00d..f92e64fd91de5631 100644
> --- a/arch/arm/mach-shmobile/pm-r8a7740.c
> +++ b/arch/arm/mach-shmobile/pm-r8a7740.c
> @@ -9,10 +9,14 @@
>   * for more details.
>   */
>  #include <linux/console.h>
> +#include <linux/io.h>
>  #include <linux/suspend.h>
> +
>  #include "common.h"
>  #include "pm-rmobile.h"
>
> +#define SYSC_BASE      IOMEM(0xe6180000)
> +
>  #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
>  static int r8a7740_pd_a3sm_suspend(void)
>  {
> @@ -35,39 +39,49 @@ static int r8a7740_pd_a3sp_suspend(void)
>  static struct rmobile_pm_domain r8a7740_pm_domains[] = {
>         {
>                 .genpd.name     = "A4LC",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 1,
>         }, {
>                 .genpd.name     = "A4MP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 2,
>         }, {
>                 .genpd.name     = "D4",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 3,
>         }, {
>                 .genpd.name     = "A4R",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 5,
>         }, {
>                 .genpd.name     = "A3RV",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 6,
>         }, {
>                 .genpd.name     = "A4S",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 10,
>                 .no_debug       = true,
>         }, {
>                 .genpd.name     = "A3SP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 11,
>                 .gov            = &pm_domain_always_on_gov,
>                 .no_debug       = true,
>                 .suspend        = r8a7740_pd_a3sp_suspend,
>         }, {
>                 .genpd.name     = "A3SM",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 12,
>                 .gov            = &pm_domain_always_on_gov,
>                 .suspend        = r8a7740_pd_a3sm_suspend,
>         }, {
>                 .genpd.name     = "A3SG",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 13,
>         }, {
>                 .genpd.name     = "A4SU",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 20,
>         },
>  };
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index ae846dfcd69293f7..8b876fcf7d0fc2ba 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -20,9 +20,9 @@
>  #include "pm-rmobile.h"
>
>  /* SYSC */
> -#define SPDCR          IOMEM(0xe6180008)
> -#define SWUCR          IOMEM(0xe6180014)
> -#define PSTR           IOMEM(0xe6180080)
> +#define SPDCR  0x08    /* SYS Power Down Control Register */
> +#define SWUCR  0x14    /* SYS Wakeup Control Register */
> +#define PSTR   0x80    /* Power Status Register */
>
>  #define PSTR_RETRIES   100
>  #define PSTR_DELAY_US  10
> @@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>                         return ret;
>         }
>
> -       if (__raw_readl(PSTR) & mask) {
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
>                 unsigned int retry_count;
> -               __raw_writel(mask, SPDCR);
> +               __raw_writel(mask, rmobile_pd->base + SPDCR);
>
>                 for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
> -                       if (!(__raw_readl(SPDCR) & mask))
> +                       if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
>                                 break;
>                         cpu_relax();
>                 }
> @@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
> -                        genpd->name, mask, __raw_readl(PSTR));
> +                        genpd->name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>         return 0;
>  }
> @@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>         unsigned int retry_count;
>         int ret = 0;
>
> -       if (__raw_readl(PSTR) & mask)
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask)
>                 goto out;
>
> -       __raw_writel(mask, SWUCR);
> +       __raw_writel(mask, rmobile_pd->base + SWUCR);
>
>         for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
> -               if (!(__raw_readl(SWUCR) & mask))
> +               if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
>                         break;
>                 if (retry_count > PSTR_RETRIES)
>                         udelay(PSTR_DELAY_US);
> @@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
> -                        rmobile_pd->genpd.name, mask, __raw_readl(PSTR));
> +                        rmobile_pd->genpd.name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>  out:
>         if (ret == 0 && rmobile_pd->resume && do_resume)
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
> index 8f66b343162b0411..0602130bb260c31d 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.h
> +++ b/arch/arm/mach-shmobile/pm-rmobile.h
> @@ -21,6 +21,7 @@ struct rmobile_pm_domain {
>         struct dev_power_governor *gov;
>         int (*suspend)(void);
>         void (*resume)(void);
> +       void __iomem *base;
>         unsigned int bit_shift;
>         bool no_debug;
>  };
> diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
> index 7e5c2676c48902f1..7181a280b3b541af 100644
> --- a/arch/arm/mach-shmobile/pm-sh7372.c
> +++ b/arch/arm/mach-shmobile/pm-sh7372.c
> @@ -45,6 +45,8 @@
>  #define PLLC01STPCR IOMEM(0xe61500c8)
>
>  /* SYSC */
> +#define SYSC_BASE IOMEM(0xe6180000)
> +
>  #define SBAR IOMEM(0xe6180020)
>  #define WUPRMSK IOMEM(0xe6180028)
>  #define WUPSMSK IOMEM(0xe618002c)
> @@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A4LC",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 1,
>         },
>         {
>                 .genpd.name = "A4MP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 2,
>         },
>         {
>                 .genpd.name = "D4",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 3,
>         },
>         {
>                 .genpd.name = "A4R",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 5,
>                 .suspend = sh7372_a4r_pd_suspend,
>                 .resume = sh7372_intcs_resume,
> @@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3RV",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 6,
>         },
>         {
>                 .genpd.name = "A3RI",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 8,
>         },
>         {
>                 .genpd.name = "A4S",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 10,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 11,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SG",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 13,
>         },
>  };
> --
> 1.9.1
>

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

* [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
@ 2014-09-26  8:47     ` Ulf Hansson
  0 siblings, 0 replies; 111+ messages in thread
From: Ulf Hansson @ 2014-09-26  8:47 UTC (permalink / raw)
  To: linux-arm-kernel

On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Replace the hardcoded addresses for accessing the SYSC PM domain
> registers by register offsets, relative to the SYSC base address stored
> in struct rmobile_pm_domain.
>
> In the future, the SYSC base address will come from DT.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
> v3:
>   - No changes
> v2:
>   - No changes
>
>  arch/arm/mach-shmobile/pm-r8a7740.c | 14 ++++++++++++++
>  arch/arm/mach-shmobile/pm-rmobile.c | 24 +++++++++++++-----------
>  arch/arm/mach-shmobile/pm-rmobile.h |  1 +
>  arch/arm/mach-shmobile/pm-sh7372.c  | 11 +++++++++++
>  4 files changed, 39 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
> index 41e61f1b5d44f00d..f92e64fd91de5631 100644
> --- a/arch/arm/mach-shmobile/pm-r8a7740.c
> +++ b/arch/arm/mach-shmobile/pm-r8a7740.c
> @@ -9,10 +9,14 @@
>   * for more details.
>   */
>  #include <linux/console.h>
> +#include <linux/io.h>
>  #include <linux/suspend.h>
> +
>  #include "common.h"
>  #include "pm-rmobile.h"
>
> +#define SYSC_BASE      IOMEM(0xe6180000)
> +
>  #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
>  static int r8a7740_pd_a3sm_suspend(void)
>  {
> @@ -35,39 +39,49 @@ static int r8a7740_pd_a3sp_suspend(void)
>  static struct rmobile_pm_domain r8a7740_pm_domains[] = {
>         {
>                 .genpd.name     = "A4LC",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 1,
>         }, {
>                 .genpd.name     = "A4MP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 2,
>         }, {
>                 .genpd.name     = "D4",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 3,
>         }, {
>                 .genpd.name     = "A4R",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 5,
>         }, {
>                 .genpd.name     = "A3RV",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 6,
>         }, {
>                 .genpd.name     = "A4S",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 10,
>                 .no_debug       = true,
>         }, {
>                 .genpd.name     = "A3SP",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 11,
>                 .gov            = &pm_domain_always_on_gov,
>                 .no_debug       = true,
>                 .suspend        = r8a7740_pd_a3sp_suspend,
>         }, {
>                 .genpd.name     = "A3SM",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 12,
>                 .gov            = &pm_domain_always_on_gov,
>                 .suspend        = r8a7740_pd_a3sm_suspend,
>         }, {
>                 .genpd.name     = "A3SG",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 13,
>         }, {
>                 .genpd.name     = "A4SU",
> +               .base           = SYSC_BASE,
>                 .bit_shift      = 20,
>         },
>  };
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index ae846dfcd69293f7..8b876fcf7d0fc2ba 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -20,9 +20,9 @@
>  #include "pm-rmobile.h"
>
>  /* SYSC */
> -#define SPDCR          IOMEM(0xe6180008)
> -#define SWUCR          IOMEM(0xe6180014)
> -#define PSTR           IOMEM(0xe6180080)
> +#define SPDCR  0x08    /* SYS Power Down Control Register */
> +#define SWUCR  0x14    /* SYS Wakeup Control Register */
> +#define PSTR   0x80    /* Power Status Register */
>
>  #define PSTR_RETRIES   100
>  #define PSTR_DELAY_US  10
> @@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>                         return ret;
>         }
>
> -       if (__raw_readl(PSTR) & mask) {
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
>                 unsigned int retry_count;
> -               __raw_writel(mask, SPDCR);
> +               __raw_writel(mask, rmobile_pd->base + SPDCR);
>
>                 for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
> -                       if (!(__raw_readl(SPDCR) & mask))
> +                       if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
>                                 break;
>                         cpu_relax();
>                 }
> @@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
> -                        genpd->name, mask, __raw_readl(PSTR));
> +                        genpd->name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>         return 0;
>  }
> @@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>         unsigned int retry_count;
>         int ret = 0;
>
> -       if (__raw_readl(PSTR) & mask)
> +       if (__raw_readl(rmobile_pd->base + PSTR) & mask)
>                 goto out;
>
> -       __raw_writel(mask, SWUCR);
> +       __raw_writel(mask, rmobile_pd->base + SWUCR);
>
>         for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
> -               if (!(__raw_readl(SWUCR) & mask))
> +               if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
>                         break;
>                 if (retry_count > PSTR_RETRIES)
>                         udelay(PSTR_DELAY_US);
> @@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
>
>         if (!rmobile_pd->no_debug)
>                 pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
> -                        rmobile_pd->genpd.name, mask, __raw_readl(PSTR));
> +                        rmobile_pd->genpd.name, mask,
> +                        __raw_readl(rmobile_pd->base + PSTR));
>
>  out:
>         if (ret == 0 && rmobile_pd->resume && do_resume)
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
> index 8f66b343162b0411..0602130bb260c31d 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.h
> +++ b/arch/arm/mach-shmobile/pm-rmobile.h
> @@ -21,6 +21,7 @@ struct rmobile_pm_domain {
>         struct dev_power_governor *gov;
>         int (*suspend)(void);
>         void (*resume)(void);
> +       void __iomem *base;
>         unsigned int bit_shift;
>         bool no_debug;
>  };
> diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
> index 7e5c2676c48902f1..7181a280b3b541af 100644
> --- a/arch/arm/mach-shmobile/pm-sh7372.c
> +++ b/arch/arm/mach-shmobile/pm-sh7372.c
> @@ -45,6 +45,8 @@
>  #define PLLC01STPCR IOMEM(0xe61500c8)
>
>  /* SYSC */
> +#define SYSC_BASE IOMEM(0xe6180000)
> +
>  #define SBAR IOMEM(0xe6180020)
>  #define WUPRMSK IOMEM(0xe6180028)
>  #define WUPSMSK IOMEM(0xe618002c)
> @@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A4LC",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 1,
>         },
>         {
>                 .genpd.name = "A4MP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 2,
>         },
>         {
>                 .genpd.name = "D4",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 3,
>         },
>         {
>                 .genpd.name = "A4R",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 5,
>                 .suspend = sh7372_a4r_pd_suspend,
>                 .resume = sh7372_intcs_resume,
> @@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3RV",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 6,
>         },
>         {
>                 .genpd.name = "A3RI",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 8,
>         },
>         {
>                 .genpd.name = "A4S",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 10,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SP",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 11,
>                 .gov = &pm_domain_always_on_gov,
>                 .no_debug = true,
> @@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
>                 .genpd.name = "A3SG",
>                 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
>                 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
> +               .base = SYSC_BASE,
>                 .bit_shift = 13,
>         },
>  };
> --
> 1.9.1
>

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

* Re: [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
  2014-09-26  8:43     ` Ulf Hansson
  (?)
  (?)
@ 2014-09-26  8:47       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Sep 26, 2014 at 10:43 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> Why?

Because else the next patch would add a few more users of dev->of_node.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-26  8:47       ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:47 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Geert Uytterhoeven, Rafael J. Wysocki, Simon Horman, Magnus Damm,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel

On Fri, Sep 26, 2014 at 10:43 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> Why?

Because else the next patch would add a few more users of dev->of_node.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-26  8:47       ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:47 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Geert Uytterhoeven, Rafael J. Wysocki, Simon Horman, Magnus Damm,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel

On Fri, Sep 26, 2014 at 10:43 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> Why?

Because else the next patch would add a few more users of dev->of_node.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node
@ 2014-09-26  8:47       ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  8:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Sep 26, 2014 at 10:43 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> Why?

Because else the next patch would add a few more users of dev->of_node.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
  2014-09-25 20:19   ` Rafael J. Wysocki
  (?)
  (?)
@ 2014-09-26  9:27     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  9:27 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rafael,

On Thu, Sep 25, 2014 at 10:19 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
>> would be good to get this patch in v3.18-rc1, as it's the only hard dependency
>> on linux-pm.git for the rest of this series. The other parts have relaxed
>> ordering constraints due to the separation of code and DTS.
>
> OK, this one looks good to me, so I can push it for 3.18.

Thank you very much!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-26  9:27     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  9:27 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Geert Uytterhoeven, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

Hi Rafael,

On Thu, Sep 25, 2014 at 10:19 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
>> would be good to get this patch in v3.18-rc1, as it's the only hard dependency
>> on linux-pm.git for the rest of this series. The other parts have relaxed
>> ordering constraints due to the separation of code and DTS.
>
> OK, this one looks good to me, so I can push it for 3.18.

Thank you very much!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-26  9:27     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  9:27 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Geert Uytterhoeven, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Hi Rafael,

On Thu, Sep 25, 2014 at 10:19 PM, Rafael J. Wysocki <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> wrote:
>> Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
>> would be good to get this patch in v3.18-rc1, as it's the only hard dependency
>> on linux-pm.git for the rest of this series. The other parts have relaxed
>> ordering constraints due to the separation of code and DTS.
>
> OK, this one looks good to me, so I can push it for 3.18.

Thank you very much!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support
@ 2014-09-26  9:27     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26  9:27 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rafael,

On Thu, Sep 25, 2014 at 10:19 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> Rafael: If you accept "PM / Domains: Add genpd attach/detach callbacks", it
>> would be good to get this patch in v3.18-rc1, as it's the only hard dependency
>> on linux-pm.git for the rest of this series. The other parts have relaxed
>> ordering constraints due to the separation of code and DTS.
>
> OK, this one looks good to me, so I can push it for 3.18.

Thank you very much!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
  2014-09-26  8:19     ` Ulf Hansson
  (?)
  (?)
@ 2014-09-26 15:28       ` Stephen Boyd
  -1 siblings, 0 replies; 111+ messages in thread
From: Stephen Boyd @ 2014-09-26 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> > +Optional properties:
> > + - power-on-latency: Power-on latency of the PM domain, in ns,
> > + - power-off-latency: Power-off latency of the PM domain, in ns.
> > +
> >  Example:
> >
> >         power: power-controller@12340000 {
> >                 compatible = "foo,power-controller";
> >                 reg = <0x12340000 0x1000>;
> >                 #power-domain-cells = <1>;
> > +               power-on-latency = <250000>;
> > +               power-off-latency = <250000>;

This assumes every power domain within a power controller has the
same latencies? That isn't always true. This should be an array
of values corresponding to the number of power domains if
#power-domain-cells is 1, or just one value if the cell count is
0.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26 15:28       ` Stephen Boyd
  0 siblings, 0 replies; 111+ messages in thread
From: Stephen Boyd @ 2014-09-26 15:28 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Geert Uytterhoeven, Rafael J. Wysocki, Simon Horman, Magnus Damm,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel

> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> > +Optional properties:
> > + - power-on-latency: Power-on latency of the PM domain, in ns,
> > + - power-off-latency: Power-off latency of the PM domain, in ns.
> > +
> >  Example:
> >
> >         power: power-controller@12340000 {
> >                 compatible = "foo,power-controller";
> >                 reg = <0x12340000 0x1000>;
> >                 #power-domain-cells = <1>;
> > +               power-on-latency = <250000>;
> > +               power-off-latency = <250000>;

This assumes every power domain within a power controller has the
same latencies? That isn't always true. This should be an array
of values corresponding to the number of power domains if
#power-domain-cells is 1, or just one value if the cell count is
0.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26 15:28       ` Stephen Boyd
  0 siblings, 0 replies; 111+ messages in thread
From: Stephen Boyd @ 2014-09-26 15:28 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Geert Uytterhoeven, Rafael J. Wysocki, Simon Horman, Magnus Damm,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, linux-pm, devicetree, linux-arm-kernel,
	linux-kernel

> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> > +Optional properties:
> > + - power-on-latency: Power-on latency of the PM domain, in ns,
> > + - power-off-latency: Power-off latency of the PM domain, in ns.
> > +
> >  Example:
> >
> >         power: power-controller@12340000 {
> >                 compatible = "foo,power-controller";
> >                 reg = <0x12340000 0x1000>;
> >                 #power-domain-cells = <1>;
> > +               power-on-latency = <250000>;
> > +               power-off-latency = <250000>;

This assumes every power domain within a power controller has the
same latencies? That isn't always true. This should be an array
of values corresponding to the number of power domains if
#power-domain-cells is 1, or just one value if the cell count is
0.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26 15:28       ` Stephen Boyd
  0 siblings, 0 replies; 111+ messages in thread
From: Stephen Boyd @ 2014-09-26 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> > +Optional properties:
> > + - power-on-latency: Power-on latency of the PM domain, in ns,
> > + - power-off-latency: Power-off latency of the PM domain, in ns.
> > +
> >  Example:
> >
> >         power: power-controller at 12340000 {
> >                 compatible = "foo,power-controller";
> >                 reg = <0x12340000 0x1000>;
> >                 #power-domain-cells = <1>;
> > +               power-on-latency = <250000>;
> > +               power-off-latency = <250000>;

This assumes every power domain within a power controller has the
same latencies? That isn't always true. This should be an array
of values corresponding to the number of power domains if
#power-domain-cells is 1, or just one value if the cell count is
0.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
@ 2014-09-26 15:47     ` Kevin Hilman
  -1 siblings, 0 replies; 111+ messages in thread
From: Kevin Hilman @ 2014-09-26 15:47 UTC (permalink / raw)
  To: linux-arm-kernel

Geert Uytterhoeven <geert+renesas@glider.be> writes:

> While a PM domain can enable PM runtime management of its devices' module
> clocks by setting
>
> 	genpd->dev_ops.stop = pm_clk_suspend;
> 	genpd->dev_ops.start = pm_clk_resume;
>
> this also requires registering the clocks with the pm_clk subsystem.
> In the legacy case, this is handled by the platform code, after
> attaching the device to its PM domain.
>
> When the devices are instantiated from DT, devices are attached to their
> PM domains by generic code, leaving no method for the platform-specific
> PM domain code to register their clocks.
>
> Add two callbacks, allowing a PM domain to perform platform-specific
> tasks when a device is attached to or detached from a PM domain.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

I replied to the previous RFC, but just to be thorough (and because I
like this approach):

Reviewed-by: Kevin Hilman <khilman@linaro.org>

Kevin

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

* Re: [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks
@ 2014-09-26 15:47     ` Kevin Hilman
  0 siblings, 0 replies; 111+ messages in thread
From: Kevin Hilman @ 2014-09-26 15:47 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, linux-sh,
	linux-pm, devicetree, linux-arm-kernel, linux-kernel

Geert Uytterhoeven <geert+renesas@glider.be> writes:

> While a PM domain can enable PM runtime management of its devices' module
> clocks by setting
>
> 	genpd->dev_ops.stop = pm_clk_suspend;
> 	genpd->dev_ops.start = pm_clk_resume;
>
> this also requires registering the clocks with the pm_clk subsystem.
> In the legacy case, this is handled by the platform code, after
> attaching the device to its PM domain.
>
> When the devices are instantiated from DT, devices are attached to their
> PM domains by generic code, leaving no method for the platform-specific
> PM domain code to register their clocks.
>
> Add two callbacks, allowing a PM domain to perform platform-specific
> tasks when a device is attached to or detached from a PM domain.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

I replied to the previous RFC, but just to be thorough (and because I
like this approach):

Reviewed-by: Kevin Hilman <khilman@linaro.org>

Kevin

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

* [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks
@ 2014-09-26 15:47     ` Kevin Hilman
  0 siblings, 0 replies; 111+ messages in thread
From: Kevin Hilman @ 2014-09-26 15:47 UTC (permalink / raw)
  To: linux-arm-kernel

Geert Uytterhoeven <geert+renesas@glider.be> writes:

> While a PM domain can enable PM runtime management of its devices' module
> clocks by setting
>
> 	genpd->dev_ops.stop = pm_clk_suspend;
> 	genpd->dev_ops.start = pm_clk_resume;
>
> this also requires registering the clocks with the pm_clk subsystem.
> In the legacy case, this is handled by the platform code, after
> attaching the device to its PM domain.
>
> When the devices are instantiated from DT, devices are attached to their
> PM domains by generic code, leaving no method for the platform-specific
> PM domain code to register their clocks.
>
> Add two callbacks, allowing a PM domain to perform platform-specific
> tasks when a device is attached to or detached from a PM domain.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

I replied to the previous RFC, but just to be thorough (and because I
like this approach):

Reviewed-by: Kevin Hilman <khilman@linaro.org>

Kevin

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
  2014-09-26 15:28       ` Stephen Boyd
  (?)
  (?)
@ 2014-09-26 17:52         ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stephen,

On Fri, Sep 26, 2014 at 5:28 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> > +Optional properties:
>> > + - power-on-latency: Power-on latency of the PM domain, in ns,
>> > + - power-off-latency: Power-off latency of the PM domain, in ns.
>> > +
>> >  Example:
>> >
>> >         power: power-controller@12340000 {
>> >                 compatible = "foo,power-controller";
>> >                 reg = <0x12340000 0x1000>;
>> >                 #power-domain-cells = <1>;
>> > +               power-on-latency = <250000>;
>> > +               power-off-latency = <250000>;
>
> This assumes every power domain within a power controller has the
> same latencies? That isn't always true. This should be an array
> of values corresponding to the number of power domains if
> #power-domain-cells is 1, or just one value if the cell count is
> 0.

Thanks, you're right. Will update.

However, I'd still like to allow just one value in the #power-domain-cells = <1>
case if the latencies are the same. Is that OK for you?

Thanks again.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26 17:52         ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 17:52 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Ulf Hansson, Geert Uytterhoeven, Rafael J. Wysocki, Simon Horman,
	Magnus Damm, Tomasz Figa, Philipp Zabel, Grygorii Strashko,
	Kevin Hilman, Linux-sh list, linux-pm, devicetree,
	linux-arm-kernel, linux-kernel

Hi Stephen,

On Fri, Sep 26, 2014 at 5:28 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> > +Optional properties:
>> > + - power-on-latency: Power-on latency of the PM domain, in ns,
>> > + - power-off-latency: Power-off latency of the PM domain, in ns.
>> > +
>> >  Example:
>> >
>> >         power: power-controller@12340000 {
>> >                 compatible = "foo,power-controller";
>> >                 reg = <0x12340000 0x1000>;
>> >                 #power-domain-cells = <1>;
>> > +               power-on-latency = <250000>;
>> > +               power-off-latency = <250000>;
>
> This assumes every power domain within a power controller has the
> same latencies? That isn't always true. This should be an array
> of values corresponding to the number of power domains if
> #power-domain-cells is 1, or just one value if the cell count is
> 0.

Thanks, you're right. Will update.

However, I'd still like to allow just one value in the #power-domain-cells = <1>
case if the latencies are the same. Is that OK for you?

Thanks again.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26 17:52         ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 17:52 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: devicetree, Ulf Hansson, Grygorii Strashko, Geert Uytterhoeven,
	Linux-sh list, Rafael J. Wysocki, linux-pm, Magnus Damm,
	Tomasz Figa, linux-kernel, Simon Horman, linux-arm-kernel,
	Philipp Zabel, Kevin Hilman

Hi Stephen,

On Fri, Sep 26, 2014 at 5:28 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> > +Optional properties:
>> > + - power-on-latency: Power-on latency of the PM domain, in ns,
>> > + - power-off-latency: Power-off latency of the PM domain, in ns.
>> > +
>> >  Example:
>> >
>> >         power: power-controller@12340000 {
>> >                 compatible = "foo,power-controller";
>> >                 reg = <0x12340000 0x1000>;
>> >                 #power-domain-cells = <1>;
>> > +               power-on-latency = <250000>;
>> > +               power-off-latency = <250000>;
>
> This assumes every power domain within a power controller has the
> same latencies? That isn't always true. This should be an array
> of values corresponding to the number of power domains if
> #power-domain-cells is 1, or just one value if the cell count is
> 0.

Thanks, you're right. Will update.

However, I'd still like to allow just one value in the #power-domain-cells = <1>
case if the latencies are the same. Is that OK for you?

Thanks again.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies
@ 2014-09-26 17:52         ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stephen,

On Fri, Sep 26, 2014 at 5:28 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> On 25 September 2014 18:28, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> > +Optional properties:
>> > + - power-on-latency: Power-on latency of the PM domain, in ns,
>> > + - power-off-latency: Power-off latency of the PM domain, in ns.
>> > +
>> >  Example:
>> >
>> >         power: power-controller at 12340000 {
>> >                 compatible = "foo,power-controller";
>> >                 reg = <0x12340000 0x1000>;
>> >                 #power-domain-cells = <1>;
>> > +               power-on-latency = <250000>;
>> > +               power-off-latency = <250000>;
>
> This assumes every power domain within a power controller has the
> same latencies? That isn't always true. This should be an array
> of values corresponding to the number of power domains if
> #power-domain-cells is 1, or just one value if the cell count is
> 0.

Thanks, you're right. Will update.

However, I'd still like to allow just one value in the #power-domain-cells = <1>
case if the latencies are the same. Is that OK for you?

Thanks again.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
  2014-09-25 16:28   ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-09-26 18:04     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 18:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);

With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
as the clocks are no longer enabled by runtime PM
(some clocks may have been enabled by boot loader/reset state though).

In the legacy case, this works more or less, as genpd takes over after
the pm_clk domain has been initialized, which implies enabling the clocks
if !CONFIG_PM_RUNTIME.

Will fix...

> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-26 18:04     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 18:04 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);

With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
as the clocks are no longer enabled by runtime PM
(some clocks may have been enabled by boot loader/reset state though).

In the legacy case, this works more or less, as genpd takes over after
the pm_clk domain has been initialized, which implies enabling the clocks
if !CONFIG_PM_RUNTIME.

Will fix...

> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-26 18:04     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 18:04 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org> wrote:
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);

With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
as the clocks are no longer enabled by runtime PM
(some clocks may have been enabled by boot loader/reset state though).

In the legacy case, this works more or less, as genpd takes over after
the pm_clk domain has been initialized, which implies enabling the clocks
if !CONFIG_PM_RUNTIME.

Will fix...

> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-09-26 18:04     ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-09-26 18:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 717e6413d29cb998..ae846dfcd69293f7 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
>         return true;
>  }
>
> +static void rmobile_pd_attach_dev(struct device *dev)
> +{
> +       if (pm_clk_no_clocks(dev))
> +               pm_clk_add(dev, NULL);

With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
as the clocks are no longer enabled by runtime PM
(some clocks may have been enabled by boot loader/reset state though).

In the legacy case, this works more or less, as genpd takes over after
the pm_clk domain has been initialized, which implies enabling the clocks
if !CONFIG_PM_RUNTIME.

Will fix...

> +}
> +
> +static void rmobile_pd_detach_dev(struct device *dev)
> +{
> +       pm_clk_remove(dev, NULL);
> +}
> +
>  static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>  {
>         struct generic_pm_domain *genpd = &rmobile_pd->genpd;
> @@ -112,6 +123,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
>         genpd->dev_ops.active_wakeup    = rmobile_pd_active_wakeup;
>         genpd->power_off                = rmobile_pd_power_down;
>         genpd->power_on                 = rmobile_pd_power_up;
> +       genpd->attach_dev               = rmobile_pd_attach_dev;
> +       genpd->detach_dev               = rmobile_pd_detach_dev;
>         __rmobile_pd_power_up(rmobile_pd, false);
>  }
>
> @@ -130,8 +143,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name,
>         struct device *dev = &pdev->dev;
>
>         __pm_genpd_name_add_device(domain_name, dev, td);
> -       if (pm_clk_no_clocks(dev))
> -               pm_clk_add(dev, NULL);
>  }
>
>  void rmobile_add_devices_to_domains(struct pm_domain_device data[],

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
  2014-09-26 18:04     ` Geert Uytterhoeven
  (?)
  (?)
@ 2014-10-03 16:01       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-10-03 16:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 26 Sep 2014, Geert Uytterhoeven wrote:
> On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> > index 717e6413d29cb998..ae846dfcd69293f7 100644
> > --- a/arch/arm/mach-shmobile/pm-rmobile.c
> > +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> > @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
> >         return true;
> >  }
> >
> > +static void rmobile_pd_attach_dev(struct device *dev)
> > +{
> > +       if (pm_clk_no_clocks(dev))
> > +               pm_clk_add(dev, NULL);
> 
> With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
> as the clocks are no longer enabled by runtime PM
> (some clocks may have been enabled by boot loader/reset state though).
> 
> In the legacy case, this works more or less, as genpd takes over after
> the pm_clk domain has been initialized, which implies enabling the clocks
> if !CONFIG_PM_RUNTIME.
> 
> Will fix...

The patch below fixes that.

I'll update the whole series, and will repost after v3.18-rc1, after the
prerequisites are in.

From cf40afcfab65fef8e6e6fa84bd3b49434afcb5eb Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Wed, 1 Oct 2014 20:05:53 +0200
Subject: [PATCH] ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

If CONFIG_PM_RUNTIME is not set, the clocks must be enabled before the
devices can be used.  Also add missing pm_clk_create()/pm_clk_destroy()
calls.

Currently these clocks are enabled by the !CONFIG_PM_RUNTIME version of
pm_clk_notify, activated by the hack in drivers/sh/pm_runtime.c, but
this will go away soon (at least for DT, cfr. "[PATCH] drivers: sh:
Disable PM runtime for multi-platform r8a7740 with genpd").

On detach, disabling the clocks is already handled by pm_clk_destroy().
On system suspend/resume, disabling/enabling clocks is already handled
from the genpd->dev_ops.{start,stop}() callbacks.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "PM / clock_ops: Fix crash in clocks management code if
!CONFIG_PM_RUNTIME".

 arch/arm/mach-shmobile/pm-rmobile.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 80be5848adc8f15c..e5a2c568d96cdd6b 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -121,13 +121,23 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
 
 static void rmobile_pd_attach_dev(struct device *dev)
 {
-	if (pm_clk_no_clocks(dev))
-		pm_clk_add(dev, NULL);
+	int error;
+
+	error = pm_clk_create(dev);
+	if (error) {
+		dev_err(dev, "pm_clk_create failed %d\n", error);
+		return;
+	}
+
+	pm_clk_add(dev, NULL);
+
+	if (!IS_ENABLED(CONFIG_PM_RUNTIME))
+		pm_clk_resume(dev);
 }
 
 static void rmobile_pd_detach_dev(struct device *dev)
 {
-	pm_clk_remove(dev, NULL);
+	pm_clk_destroy(dev);
 }
 
 static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-10-03 16:01       ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-10-03 16:01 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

On Fri, 26 Sep 2014, Geert Uytterhoeven wrote:
> On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> > index 717e6413d29cb998..ae846dfcd69293f7 100644
> > --- a/arch/arm/mach-shmobile/pm-rmobile.c
> > +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> > @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
> >         return true;
> >  }
> >
> > +static void rmobile_pd_attach_dev(struct device *dev)
> > +{
> > +       if (pm_clk_no_clocks(dev))
> > +               pm_clk_add(dev, NULL);
> 
> With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
> as the clocks are no longer enabled by runtime PM
> (some clocks may have been enabled by boot loader/reset state though).
> 
> In the legacy case, this works more or less, as genpd takes over after
> the pm_clk domain has been initialized, which implies enabling the clocks
> if !CONFIG_PM_RUNTIME.
> 
> Will fix...

The patch below fixes that.

I'll update the whole series, and will repost after v3.18-rc1, after the
prerequisites are in.

>From cf40afcfab65fef8e6e6fa84bd3b49434afcb5eb Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Wed, 1 Oct 2014 20:05:53 +0200
Subject: [PATCH] ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

If CONFIG_PM_RUNTIME is not set, the clocks must be enabled before the
devices can be used.  Also add missing pm_clk_create()/pm_clk_destroy()
calls.

Currently these clocks are enabled by the !CONFIG_PM_RUNTIME version of
pm_clk_notify, activated by the hack in drivers/sh/pm_runtime.c, but
this will go away soon (at least for DT, cfr. "[PATCH] drivers: sh:
Disable PM runtime for multi-platform r8a7740 with genpd").

On detach, disabling the clocks is already handled by pm_clk_destroy().
On system suspend/resume, disabling/enabling clocks is already handled
from the genpd->dev_ops.{start,stop}() callbacks.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "PM / clock_ops: Fix crash in clocks management code if
!CONFIG_PM_RUNTIME".

 arch/arm/mach-shmobile/pm-rmobile.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 80be5848adc8f15c..e5a2c568d96cdd6b 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -121,13 +121,23 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
 
 static void rmobile_pd_attach_dev(struct device *dev)
 {
-	if (pm_clk_no_clocks(dev))
-		pm_clk_add(dev, NULL);
+	int error;
+
+	error = pm_clk_create(dev);
+	if (error) {
+		dev_err(dev, "pm_clk_create failed %d\n", error);
+		return;
+	}
+
+	pm_clk_add(dev, NULL);
+
+	if (!IS_ENABLED(CONFIG_PM_RUNTIME))
+		pm_clk_resume(dev);
 }
 
 static void rmobile_pd_detach_dev(struct device *dev)
 {
-	pm_clk_remove(dev, NULL);
+	pm_clk_destroy(dev);
 }
 
 static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-10-03 16:01       ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-10-03 16:01 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Simon Horman, Magnus Damm, Ulf Hansson,
	Tomasz Figa, Philipp Zabel, Grygorii Strashko, Kevin Hilman,
	Linux-sh list, Linux PM list, devicetree, linux-arm-kernel,
	linux-kernel

On Fri, 26 Sep 2014, Geert Uytterhoeven wrote:
> On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> > index 717e6413d29cb998..ae846dfcd69293f7 100644
> > --- a/arch/arm/mach-shmobile/pm-rmobile.c
> > +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> > @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
> >         return true;
> >  }
> >
> > +static void rmobile_pd_attach_dev(struct device *dev)
> > +{
> > +       if (pm_clk_no_clocks(dev))
> > +               pm_clk_add(dev, NULL);
> 
> With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
> as the clocks are no longer enabled by runtime PM
> (some clocks may have been enabled by boot loader/reset state though).
> 
> In the legacy case, this works more or less, as genpd takes over after
> the pm_clk domain has been initialized, which implies enabling the clocks
> if !CONFIG_PM_RUNTIME.
> 
> Will fix...

The patch below fixes that.

I'll update the whole series, and will repost after v3.18-rc1, after the
prerequisites are in.

>From cf40afcfab65fef8e6e6fa84bd3b49434afcb5eb Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Wed, 1 Oct 2014 20:05:53 +0200
Subject: [PATCH] ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

If CONFIG_PM_RUNTIME is not set, the clocks must be enabled before the
devices can be used.  Also add missing pm_clk_create()/pm_clk_destroy()
calls.

Currently these clocks are enabled by the !CONFIG_PM_RUNTIME version of
pm_clk_notify, activated by the hack in drivers/sh/pm_runtime.c, but
this will go away soon (at least for DT, cfr. "[PATCH] drivers: sh:
Disable PM runtime for multi-platform r8a7740 with genpd").

On detach, disabling the clocks is already handled by pm_clk_destroy().
On system suspend/resume, disabling/enabling clocks is already handled
from the genpd->dev_ops.{start,stop}() callbacks.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "PM / clock_ops: Fix crash in clocks management code if
!CONFIG_PM_RUNTIME".

 arch/arm/mach-shmobile/pm-rmobile.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 80be5848adc8f15c..e5a2c568d96cdd6b 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -121,13 +121,23 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
 
 static void rmobile_pd_attach_dev(struct device *dev)
 {
-	if (pm_clk_no_clocks(dev))
-		pm_clk_add(dev, NULL);
+	int error;
+
+	error = pm_clk_create(dev);
+	if (error) {
+		dev_err(dev, "pm_clk_create failed %d\n", error);
+		return;
+	}
+
+	pm_clk_add(dev, NULL);
+
+	if (!IS_ENABLED(CONFIG_PM_RUNTIME))
+		pm_clk_resume(dev);
 }
 
 static void rmobile_pd_detach_dev(struct device *dev)
 {
-	pm_clk_remove(dev, NULL);
+	pm_clk_destroy(dev);
 }
 
 static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
@ 2014-10-03 16:01       ` Geert Uytterhoeven
  0 siblings, 0 replies; 111+ messages in thread
From: Geert Uytterhoeven @ 2014-10-03 16:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 26 Sep 2014, Geert Uytterhoeven wrote:
> On Thu, Sep 25, 2014 at 6:28 PM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> > index 717e6413d29cb998..ae846dfcd69293f7 100644
> > --- a/arch/arm/mach-shmobile/pm-rmobile.c
> > +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> > @@ -101,6 +101,17 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
> >         return true;
> >  }
> >
> > +static void rmobile_pd_attach_dev(struct device *dev)
> > +{
> > +       if (pm_clk_no_clocks(dev))
> > +               pm_clk_add(dev, NULL);
> 
> With !CONFIG_PM_RUNTIME, this doesn't work well in the DT case,
> as the clocks are no longer enabled by runtime PM
> (some clocks may have been enabled by boot loader/reset state though).
> 
> In the legacy case, this works more or less, as genpd takes over after
> the pm_clk domain has been initialized, which implies enabling the clocks
> if !CONFIG_PM_RUNTIME.
> 
> Will fix...

The patch below fixes that.

I'll update the whole series, and will repost after v3.18-rc1, after the
prerequisites are in.

>From cf40afcfab65fef8e6e6fa84bd3b49434afcb5eb Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Wed, 1 Oct 2014 20:05:53 +0200
Subject: [PATCH] ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

ARM: shmobile: R-Mobile: Enable module clocks if !CONFIG_PM_RUNTIME

If CONFIG_PM_RUNTIME is not set, the clocks must be enabled before the
devices can be used.  Also add missing pm_clk_create()/pm_clk_destroy()
calls.

Currently these clocks are enabled by the !CONFIG_PM_RUNTIME version of
pm_clk_notify, activated by the hack in drivers/sh/pm_runtime.c, but
this will go away soon (at least for DT, cfr. "[PATCH] drivers: sh:
Disable PM runtime for multi-platform r8a7740 with genpd").

On detach, disabling the clocks is already handled by pm_clk_destroy().
On system suspend/resume, disabling/enabling clocks is already handled
from the genpd->dev_ops.{start,stop}() callbacks.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "PM / clock_ops: Fix crash in clocks management code if
!CONFIG_PM_RUNTIME".

 arch/arm/mach-shmobile/pm-rmobile.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 80be5848adc8f15c..e5a2c568d96cdd6b 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -121,13 +121,23 @@ static bool rmobile_pd_active_wakeup(struct device *dev)
 
 static void rmobile_pd_attach_dev(struct device *dev)
 {
-	if (pm_clk_no_clocks(dev))
-		pm_clk_add(dev, NULL);
+	int error;
+
+	error = pm_clk_create(dev);
+	if (error) {
+		dev_err(dev, "pm_clk_create failed %d\n", error);
+		return;
+	}
+
+	pm_clk_add(dev, NULL);
+
+	if (!IS_ENABLED(CONFIG_PM_RUNTIME))
+		pm_clk_resume(dev);
 }
 
 static void rmobile_pd_detach_dev(struct device *dev)
 {
-	pm_clk_remove(dev, NULL);
+	pm_clk_destroy(dev);
 }
 
 static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

end of thread, other threads:[~2014-10-03 16:01 UTC | newest]

Thread overview: 111+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-25 16:28 [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support Geert Uytterhoeven
2014-09-25 16:28 ` Geert Uytterhoeven
2014-09-25 16:28 ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 01/13] PM / Domains: Add genpd attach/detach callbacks Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26 15:47   ` Kevin Hilman
2014-09-26 15:47     ` Kevin Hilman
2014-09-26 15:47     ` Kevin Hilman
2014-09-25 16:28 ` [PATCH v3 02/13] PM / Domains: Add DT bindings for power-on/off latencies Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:19   ` Ulf Hansson
2014-09-26  8:19     ` Ulf Hansson
2014-09-26  8:19     ` Ulf Hansson
2014-09-26  8:19     ` Ulf Hansson
2014-09-26 15:28     ` Stephen Boyd
2014-09-26 15:28       ` Stephen Boyd
2014-09-26 15:28       ` Stephen Boyd
2014-09-26 15:28       ` Stephen Boyd
2014-09-26 17:52       ` Geert Uytterhoeven
2014-09-26 17:52         ` Geert Uytterhoeven
2014-09-26 17:52         ` Geert Uytterhoeven
2014-09-26 17:52         ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 03/13] PM / Domains: Add DT bindings for PM QoS device latencies Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:28   ` Ulf Hansson
2014-09-26  8:28     ` Ulf Hansson
2014-09-26  8:28     ` Ulf Hansson
2014-09-26  8:28     ` Ulf Hansson
2014-09-25 16:28 ` [PATCH v3 04/13] PM / Domains: Add DT bindings for the R-Mobile System Controller Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:32   ` Ulf Hansson
2014-09-26  8:32     ` Ulf Hansson
2014-09-26  8:32     ` Ulf Hansson
2014-09-26  8:32     ` Ulf Hansson
2014-09-25 16:28 ` [PATCH v3 05/13] PM / Domains: Add helper variable np = dev->of_node Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:43   ` Ulf Hansson
2014-09-26  8:43     ` Ulf Hansson
2014-09-26  8:43     ` Ulf Hansson
2014-09-26  8:43     ` Ulf Hansson
2014-09-26  8:47     ` Geert Uytterhoeven
2014-09-26  8:47       ` Geert Uytterhoeven
2014-09-26  8:47       ` Geert Uytterhoeven
2014-09-26  8:47       ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 06/13] PM / Domains: Retrieve PM QoS device latencies from DT Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 07/13] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:45   ` Ulf Hansson
2014-09-26  8:45     ` Ulf Hansson
2014-09-26  8:45     ` Ulf Hansson
2014-09-26  8:45     ` Ulf Hansson
2014-09-26 18:04   ` Geert Uytterhoeven
2014-09-26 18:04     ` Geert Uytterhoeven
2014-09-26 18:04     ` Geert Uytterhoeven
2014-09-26 18:04     ` Geert Uytterhoeven
2014-10-03 16:01     ` Geert Uytterhoeven
2014-10-03 16:01       ` Geert Uytterhoeven
2014-10-03 16:01       ` Geert Uytterhoeven
2014-10-03 16:01       ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 08/13] ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:47   ` Ulf Hansson
2014-09-26  8:47     ` Ulf Hansson
2014-09-26  8:47     ` Ulf Hansson
2014-09-26  8:47     ` Ulf Hansson
2014-09-25 16:28 ` [PATCH v3 09/13] ARM: shmobile: R-Mobile: Add DT support for PM domains Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 10/13] ARM: shmobile: r8a7740 dtsi: Add PM domain support Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:13   ` Geert Uytterhoeven
2014-09-26  8:13     ` Geert Uytterhoeven
2014-09-26  8:13     ` Geert Uytterhoeven
2014-09-26  8:13     ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 11/13] drivers: sh: Disable PM runtime for multi-platform r8a7740 with genpd Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 12/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM domain latencies Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28 ` [PATCH v3 13/13] ARM: shmobile: r8a7740 dtsi: Add preliminary PM QoS device latencies Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-25 16:28   ` Geert Uytterhoeven
2014-09-26  8:16   ` Geert Uytterhoeven
2014-09-26  8:16     ` Geert Uytterhoeven
2014-09-26  8:16     ` Geert Uytterhoeven
2014-09-26  8:16     ` Geert Uytterhoeven
2014-09-25 19:59 ` [PATCH 00/13] ARM: shmobile: R-Mobile: DT PM domain support Rafael J. Wysocki
2014-09-25 20:19   ` Rafael J. Wysocki
2014-09-25 20:19   ` Rafael J. Wysocki
2014-09-26  9:27   ` Geert Uytterhoeven
2014-09-26  9:27     ` Geert Uytterhoeven
2014-09-26  9:27     ` Geert Uytterhoeven
2014-09-26  9:27     ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.