Skip to content

Commit f04b486

Browse files
geertuhorms
authored andcommitted
clk: shmobile: rz: Add CPG/MSTP Clock Domain support
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 <[email protected]> Acked-by: Stephen Boyd <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Simon Horman <[email protected]>
1 parent 63e05d9 commit f04b486

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The CPG generates core clocks for the RZ SoCs. It includes the PLL, variable
44
CPU and GPU clocks, and several fixed ratio dividers.
5+
The CPG also provides a Clock Domain for SoC devices, in combination with the
6+
CPG Module Stop (MSTP) Clocks.
57

68
Required Properties:
79

@@ -14,10 +16,18 @@ Required Properties:
1416
- #clock-cells: Must be 1
1517
- clock-output-names: The names of the clocks. Supported clocks are "pll",
1618
"i", and "g"
19+
- #power-domain-cells: Must be 0
1720

21+
SoC devices that are part of the CPG/MSTP Clock Domain and can be power-managed
22+
through an MSTP clock should refer to the CPG device node in their
23+
"power-domains" property, as documented by the generic PM domain bindings in
24+
Documentation/devicetree/bindings/power/power_domain.txt.
1825

19-
Example
20-
-------
26+
27+
Examples
28+
--------
29+
30+
- CPG device node:
2131

2232
cpg_clocks: cpg_clocks@fcfe0000 {
2333
#clock-cells = <1>;
@@ -26,4 +36,19 @@ Example
2636
reg = <0xfcfe0000 0x18>;
2737
clocks = <&extal_clk>, <&usb_x1_clk>;
2838
clock-output-names = "pll", "i", "g";
39+
#power-domain-cells = <0>;
40+
};
41+
42+
43+
- CPG/MSTP Clock Domain member device node:
44+
45+
mtu2: timer@fcff0000 {
46+
compatible = "renesas,mtu2-r7s72100", "renesas,mtu2";
47+
reg = <0xfcff0000 0x400>;
48+
interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
49+
interrupt-names = "tgi0a";
50+
clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
51+
clock-names = "fck";
52+
power-domains = <&cpg_clocks>;
53+
status = "disabled";
2954
};

arch/arm/mach-shmobile/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ config ARCH_EMEV2
5151

5252
config ARCH_R7S72100
5353
bool "RZ/A1H (R7S72100)"
54+
select PM_GENERIC_DOMAINS if PM
5455
select SYS_SUPPORTS_SH_MTU2
5556

5657
config ARCH_R8A73A4

drivers/clk/shmobile/clk-rz.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <linux/clk-provider.h>
13+
#include <linux/clk/shmobile.h>
1314
#include <linux/init.h>
1415
#include <linux/kernel.h>
1516
#include <linux/of.h>
@@ -99,5 +100,7 @@ static void __init rz_cpg_clocks_init(struct device_node *np)
99100
}
100101

101102
of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
103+
104+
cpg_mstp_add_clk_domain(np);
102105
}
103106
CLK_OF_DECLARE(rz_cpg_clks, "renesas,rz-cpg-clocks", rz_cpg_clocks_init);

0 commit comments

Comments
 (0)