Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>

authored by

Geert Uytterhoeven and committed by
Simon Horman
f04b486d 63e05d93

+31 -2
+27 -2
Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt
··· 2 2 3 3 The CPG generates core clocks for the RZ SoCs. It includes the PLL, variable 4 4 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. 5 7 6 8 Required Properties: 7 9 ··· 16 14 - #clock-cells: Must be 1 17 15 - clock-output-names: The names of the clocks. Supported clocks are "pll", 18 16 "i", and "g" 17 + - #power-domain-cells: Must be 0 18 + 19 + SoC devices that are part of the CPG/MSTP Clock Domain and can be power-managed 20 + through an MSTP clock should refer to the CPG device node in their 21 + "power-domains" property, as documented by the generic PM domain bindings in 22 + Documentation/devicetree/bindings/power/power_domain.txt. 19 23 20 24 21 - Example 22 - ------- 25 + Examples 26 + -------- 27 + 28 + - CPG device node: 23 29 24 30 cpg_clocks: cpg_clocks@fcfe0000 { 25 31 #clock-cells = <1>; ··· 36 26 reg = <0xfcfe0000 0x18>; 37 27 clocks = <&extal_clk>, <&usb_x1_clk>; 38 28 clock-output-names = "pll", "i", "g"; 29 + #power-domain-cells = <0>; 30 + }; 31 + 32 + 33 + - CPG/MSTP Clock Domain member device node: 34 + 35 + mtu2: timer@fcff0000 { 36 + compatible = "renesas,mtu2-r7s72100", "renesas,mtu2"; 37 + reg = <0xfcff0000 0x400>; 38 + interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>; 39 + interrupt-names = "tgi0a"; 40 + clocks = <&mstp3_clks R7S72100_CLK_MTU2>; 41 + clock-names = "fck"; 42 + power-domains = <&cpg_clocks>; 43 + status = "disabled"; 39 44 };
+1
arch/arm/mach-shmobile/Kconfig
··· 51 51 52 52 config ARCH_R7S72100 53 53 bool "RZ/A1H (R7S72100)" 54 + select PM_GENERIC_DOMAINS if PM 54 55 select SYS_SUPPORTS_SH_MTU2 55 56 56 57 config ARCH_R8A73A4
+3
drivers/clk/shmobile/clk-rz.c
··· 10 10 */ 11 11 12 12 #include <linux/clk-provider.h> 13 + #include <linux/clk/shmobile.h> 13 14 #include <linux/init.h> 14 15 #include <linux/kernel.h> 15 16 #include <linux/of.h> ··· 100 99 } 101 100 102 101 of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); 102 + 103 + cpg_mstp_add_clk_domain(np); 103 104 } 104 105 CLK_OF_DECLARE(rz_cpg_clks, "renesas,rz-cpg-clocks", rz_cpg_clocks_init);