clk: shmobile: rz: Add CPG/MSTP Clock Domain support
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 4 Aug 2015 12:28:06 +0000 (14:28 +0200)
committerSimon Horman <horms+renesas@verge.net.au>
Wed, 12 Aug 2015 01:31:28 +0000 (10:31 +0900)
Add Clock Domain support to the RZ Clock Pulse Generator (CPG) driver
using the generic PM Domain.  This allows to power-manage the module
clocks of SoC devices that are part of the CPG/MSTP Clock Domain using
Runtime PM, or for system suspend/resume.

SoC devices that are part of the CPG/MSTP Clock Domain and can be
power-managed through an MSTP clock should be tagged in DT with a proper
"power-domains" property.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt
arch/arm/mach-shmobile/Kconfig
drivers/clk/shmobile/clk-rz.c

index b0f7ddb8cdb13750e1673e458fa91d2cfa7e44d5..bb51a33a1fbfbc9798be9800c1b865dda201de21 100644 (file)
@@ -2,6 +2,8 @@
 
 The CPG generates core clocks for the RZ SoCs. It includes the PLL, variable
 CPU and GPU clocks, and several fixed ratio dividers.
+The CPG also provides a Clock Domain for SoC devices, in combination with the
+CPG Module Stop (MSTP) Clocks.
 
 Required Properties:
 
@@ -14,10 +16,18 @@ Required Properties:
   - #clock-cells: Must be 1
   - clock-output-names: The names of the clocks. Supported clocks are "pll",
     "i", and "g"
+  - #power-domain-cells: Must be 0
 
+SoC devices that are part of the CPG/MSTP Clock Domain and can be power-managed
+through an MSTP clock should refer to the CPG device node in their
+"power-domains" property, as documented by the generic PM domain bindings in
+Documentation/devicetree/bindings/power/power_domain.txt.
 
-Example
--------
+
+Examples
+--------
+
+  - CPG device node:
 
        cpg_clocks: cpg_clocks@fcfe0000 {
                #clock-cells = <1>;
@@ -26,4 +36,19 @@ Example
                reg = <0xfcfe0000 0x18>;
                clocks = <&extal_clk>, <&usb_x1_clk>;
                clock-output-names = "pll", "i", "g";
+               #power-domain-cells = <0>;
+       };
+
+
+  - CPG/MSTP Clock Domain member device node:
+
+       mtu2: timer@fcff0000 {
+               compatible = "renesas,mtu2-r7s72100", "renesas,mtu2";
+               reg = <0xfcff0000 0x400>;
+               interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "tgi0a";
+               clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
+               clock-names = "fck";
+               power-domains = <&cpg_clocks>;
+               status = "disabled";
        };
index e14fa5e87475a0d100ed25f3ed70dd44724f2159..34eac88a98896b63518275fe39184cd7ae1daddb 100644 (file)
@@ -51,6 +51,7 @@ config ARCH_EMEV2
 
 config ARCH_R7S72100
        bool "RZ/A1H (R7S72100)"
+       select PM_GENERIC_DOMAINS if PM
        select SYS_SUPPORTS_SH_MTU2
 
 config ARCH_R8A73A4
index 7e68e86309625c9e6b5045563f6f8a11004883b8..9766e3cb595fd25750a00c638744615eb1e40819 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/clk/shmobile.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
@@ -99,5 +100,7 @@ static void __init rz_cpg_clocks_init(struct device_node *np)
        }
 
        of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
+
+       cpg_mstp_add_clk_domain(np);
 }
 CLK_OF_DECLARE(rz_cpg_clks, "renesas,rz-cpg-clocks", rz_cpg_clocks_init);