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

Merge tag 'clk-renesas-for-v4.7-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-next

clk: renesas: R-Car SYSC PM Domain Preparation

- Export the CPG/MSSR and CPG/MSTP attach/detach_dev callbacks, so
they can be called by the R-Car SYSC PM Domain driver.

* tag 'clk-renesas-for-v4.7-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev()
clk: renesas: mstp: Provide dummy attach/detach_dev callbacks
clk: renesas: Provide Kconfig symbols for CPG/MSSR and CPG/MSTP support

+55 -18
+1
drivers/clk/Kconfig
··· 201 201 source "drivers/clk/hisilicon/Kconfig" 202 202 source "drivers/clk/mvebu/Kconfig" 203 203 source "drivers/clk/qcom/Kconfig" 204 + source "drivers/clk/renesas/Kconfig" 204 205 source "drivers/clk/samsung/Kconfig" 205 206 source "drivers/clk/tegra/Kconfig" 206 207 source "drivers/clk/ti/Kconfig"
+16
drivers/clk/renesas/Kconfig
··· 1 + config CLK_RENESAS_CPG_MSSR 2 + bool 3 + default y if ARCH_R8A7795 4 + 5 + config CLK_RENESAS_CPG_MSTP 6 + bool 7 + default y if ARCH_R7S72100 8 + default y if ARCH_R8A73A4 9 + default y if ARCH_R8A7740 10 + default y if ARCH_R8A7778 11 + default y if ARCH_R8A7779 12 + default y if ARCH_R8A7790 13 + default y if ARCH_R8A7791 14 + default y if ARCH_R8A7793 15 + default y if ARCH_R8A7794 16 + default y if ARCH_SH73A0
+14 -12
drivers/clk/renesas/Makefile
··· 1 1 obj-$(CONFIG_ARCH_EMEV2) += clk-emev2.o 2 - obj-$(CONFIG_ARCH_R7S72100) += clk-rz.o clk-mstp.o 3 - obj-$(CONFIG_ARCH_R8A73A4) += clk-r8a73a4.o clk-mstp.o clk-div6.o 4 - obj-$(CONFIG_ARCH_R8A7740) += clk-r8a7740.o clk-mstp.o clk-div6.o 5 - obj-$(CONFIG_ARCH_R8A7778) += clk-r8a7778.o clk-mstp.o 6 - obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o clk-mstp.o 7 - obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 8 - obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 9 - obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 10 - obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 11 - obj-$(CONFIG_ARCH_R8A7795) += renesas-cpg-mssr.o \ 12 - r8a7795-cpg-mssr.o clk-div6.o 13 - obj-$(CONFIG_ARCH_SH73A0) += clk-sh73a0.o clk-mstp.o clk-div6.o 2 + obj-$(CONFIG_ARCH_R7S72100) += clk-rz.o 3 + obj-$(CONFIG_ARCH_R8A73A4) += clk-r8a73a4.o clk-div6.o 4 + obj-$(CONFIG_ARCH_R8A7740) += clk-r8a7740.o clk-div6.o 5 + obj-$(CONFIG_ARCH_R8A7778) += clk-r8a7778.o 6 + obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o 7 + obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o clk-div6.o 8 + obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o clk-div6.o 9 + obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o clk-div6.o 10 + obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o clk-div6.o 11 + obj-$(CONFIG_ARCH_R8A7795) += r8a7795-cpg-mssr.o 12 + obj-$(CONFIG_ARCH_SH73A0) += clk-sh73a0.o clk-div6.o 13 + 14 + obj-$(CONFIG_CLK_RENESAS_CPG_MSSR) += renesas-cpg-mssr.o clk-div6.o 15 + obj-$(CONFIG_CLK_RENESAS_CPG_MSTP) += clk-mstp.o
+12 -6
drivers/clk/renesas/renesas-cpg-mssr.c
··· 15 15 16 16 #include <linux/clk.h> 17 17 #include <linux/clk-provider.h> 18 + #include <linux/clk/renesas.h> 18 19 #include <linux/device.h> 19 20 #include <linux/init.h> 20 21 #include <linux/mod_devicetable.h> ··· 389 388 unsigned int core_pm_clks[0]; 390 389 }; 391 390 391 + static struct cpg_mssr_clk_domain *cpg_mssr_clk_domain; 392 + 392 393 static bool cpg_mssr_is_pm_clk(const struct of_phandle_args *clkspec, 393 394 struct cpg_mssr_clk_domain *pd) 394 395 { ··· 414 411 } 415 412 } 416 413 417 - static int cpg_mssr_attach_dev(struct generic_pm_domain *genpd, 418 - struct device *dev) 414 + int cpg_mssr_attach_dev(struct generic_pm_domain *unused, struct device *dev) 419 415 { 420 - struct cpg_mssr_clk_domain *pd = 421 - container_of(genpd, struct cpg_mssr_clk_domain, genpd); 416 + struct cpg_mssr_clk_domain *pd = cpg_mssr_clk_domain; 422 417 struct device_node *np = dev->of_node; 423 418 struct of_phandle_args clkspec; 424 419 struct clk *clk; 425 420 int i = 0; 426 421 int error; 422 + 423 + if (!pd) { 424 + dev_dbg(dev, "CPG/MSSR clock domain not yet available\n"); 425 + return -EPROBE_DEFER; 426 + } 427 427 428 428 while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i, 429 429 &clkspec)) { ··· 467 461 return error; 468 462 } 469 463 470 - static void cpg_mssr_detach_dev(struct generic_pm_domain *genpd, 471 - struct device *dev) 464 + void cpg_mssr_detach_dev(struct generic_pm_domain *unused, struct device *dev) 472 465 { 473 466 if (!list_empty(&dev->power.subsys_data->clock_list)) 474 467 pm_clk_destroy(dev); ··· 496 491 pm_genpd_init(genpd, &simple_qos_governor, false); 497 492 genpd->attach_dev = cpg_mssr_attach_dev; 498 493 genpd->detach_dev = cpg_mssr_detach_dev; 494 + cpg_mssr_clk_domain = pd; 499 495 500 496 of_genpd_add_provider_simple(np, genpd); 501 497 return 0;
+12
include/linux/clk/renesas.h
··· 25 25 void rcar_gen2_clocks_init(u32 mode); 26 26 27 27 void cpg_mstp_add_clk_domain(struct device_node *np); 28 + #ifdef CONFIG_CLK_RENESAS_CPG_MSTP 28 29 int cpg_mstp_attach_dev(struct generic_pm_domain *unused, struct device *dev); 29 30 void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev); 31 + #else 32 + #define cpg_mstp_attach_dev NULL 33 + #define cpg_mstp_detach_dev NULL 34 + #endif 30 35 36 + #ifdef CONFIG_CLK_RENESAS_CPG_MSSR 37 + int cpg_mssr_attach_dev(struct generic_pm_domain *unused, struct device *dev); 38 + void cpg_mssr_detach_dev(struct generic_pm_domain *unused, struct device *dev); 39 + #else 40 + #define cpg_mssr_attach_dev NULL 41 + #define cpg_mssr_detach_dev NULL 42 + #endif 31 43 #endif