Add support for MSM8996 GDSCs
Subsystems (5)
v2 cover Add support for MSM8996 GDSCs
Changes since v1:
* For votable gdscs which are 'on' at boot, put an explicit vote
* Added a delay post disable for votable gdscs
* Added back the status check after timeout
* rearranged some patch ordering to avoid bisect issues
This series adds support for GDSCs' which are part of gcc and mmcc in QCOM msm8996 SoC. Series applies on top of clk-next
There are many more cases of gdscs within gdscs (hierarchical power domains) in msm8996 (msm8974 has one such instance which is supported upstream) and hence the series adds support within gdsc driver to handle this.
Also msm8996 has gdscs with gds hw controllers within, for ensuring slave device idleness before gdscs are powered off, hence the series also adds support for gdscs with gds hw controllers.
ToDo: Series does not yet add support for gpu gdscs which are part of mmcc
Tested on apq8096 dragonboards to make sure all modelled gdscs can be turned on/off successfully
Rajendra Nayak (6):
clk: qcom: gdsc: Add support for hierarchical power domains
clk: qcom: gdsc: Add support for gdscs with gds hw controller
clk: qcom: gdsc: Add support for votable gdscs
clk: qcom: gdsc: Add GDSCs in msm8996 GCC
clk: qcom: gdsc: Add mmcc gdscs for msm8996 family
clk: qcom: mmcc8974: Use gdscs .parent and remove genpd calls
arch/arm64/boot/dts/qcom/msm8996.dtsi | 2 + drivers/clk/qcom/common.c | 14 ++- drivers/clk/qcom/gcc-msm8996.c | 92 +++++++++++++++ drivers/clk/qcom/gdsc.c | 89 +++++++++++---- drivers/clk/qcom/gdsc.h | 34 ++++-- drivers/clk/qcom/mmcc-msm8974.c | 14 +-- drivers/clk/qcom/mmcc-msm8996.c | 157 ++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-msm8996.h | 11 ++ include/dt-bindings/clock/qcom,mmcc-msm8996.h | 17 +++ 9 files changed, 382 insertions(+), 48 deletions(-)
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 1/6 clk: qcom: gdsc: Add support for hierarchical power domains
Some qcom SoCs' can have hierarchical power domains. Let the gdsc structs specify the parents (if any) and the driver add genpd subdomains for them.
--- drivers/clk/qcom/common.c | 14 +++++++++----- drivers/clk/qcom/gdsc.c | 27 +++++++++++++++++++++++++-- drivers/clk/qcom/gdsc.h | 17 ++++++++++++----- 3 files changed, 46 insertions(+), 12 deletions(-)
drivers/clk/qcom/common.c +9 -5
@@ -185,6 +185,7 @@ int qcom_cc_really_probe(struct platform_device *pdev,struct clk **clks;struct qcom_reset_controller *reset;struct qcom_cc *cc; +struct gdsc_desc *scd;size_t num_clks = desc->num_clks;struct clk_regmap **rclks = desc->clks;
@@ -230,15 +231,18 @@ int qcom_cc_really_probe(struct platform_device *pdev,devm_add_action (dev, qcom_cc_reset_unregister, &reset->rcdev);if (desc->gdscs && desc->num_gdscs) { - ret =gdsc_register (dev, desc->gdscs, desc->num_gdscs, - &reset->rcdev, regmap); + scd =devm_kzalloc (dev,sizeof (*scd),GFP_KERNEL ); +if (!scd) +return -ENOMEM ; + scd->dev = dev; + scd->scs = desc->gdscs; + scd->num = desc->num_gdscs; + ret =gdsc_register (scd, &reset->rcdev, regmap);if (ret)return ret; +devm_add_action (dev, qcom_cc_gdsc_unregister, scd); } -devm_add_action (dev, qcom_cc_gdsc_unregister, dev); - -return 0 ; }EXPORT_SYMBOL_GPL (qcom_cc_really_probe);
drivers/clk/qcom/gdsc.c +25 -2
@@ -201,11 +201,14 @@ static int gdsc_init(struct gdsc *sc)return 0 ; } -int gdsc_register (struct device *dev,struct gdsc **scs,size_t num, +int gdsc_register (struct gdsc_desc *desc,struct reset_controller_dev *rcdev,struct regmap *regmap) {int i, ret;struct genpd_onecell_data *data; +struct device *dev = desc->dev; +struct gdsc **scs = desc->scs; +size_t num = desc->num; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -228,10 +231,30 @@ int gdsc_register(struct device *dev, struct gdsc **scs, size_t num, data->domains[i] = &scs[i]->pd; } +/* Add subdomains */ +for (i =0 ; i < num; i++) { +if (!scs[i]) +continue ; +if (scs[i]->parent) +pm_genpd_add_subdomain (scs[i]->parent, &scs[i]->pd); + } +return of_genpd_add_provider_onecell (dev->of_node, data); } -void gdsc_unregister (struct device *dev) +void gdsc_unregister (struct gdsc_desc *desc) { +int i; +struct device *dev = desc->dev; +struct gdsc **scs = desc->scs; +size_t num = desc->num; + +/* Remove subdomains */ +for (i =0 ; i < num; i++) { +if (!scs[i]) +continue ; +if (scs[i]->parent) +pm_genpd_remove_subdomain (scs[i]->parent, &scs[i]->pd); + }of_genpd_del_provider (dev->of_node); }
drivers/clk/qcom/gdsc.h +12 -5
@@ -41,6 +41,7 @@ struct reset_controller_dev;*/ struct gdsc {struct generic_pm_domain pd; +struct generic_pm_domain *parent;struct regmap *regmap;unsigned int gdscr;unsigned int *cxcs;
@@ -51,18 +52,24 @@ struct gdsc { unsigned int reset_count; }; +struct gdsc_desc { +struct device *dev; +struct gdsc **scs; +size_t num; +}; +#ifdef CONFIG_QCOM_GDSC -int gdsc_register (struct device *,struct gdsc **,size_t n, -struct reset_controller_dev *,struct regmap *); -void gdsc_unregister (struct device *); +int gdsc_register (struct gdsc_desc *desc,struct reset_controller_dev *, +struct regmap *); +void gdsc_unregister (struct gdsc_desc *desc);#else -static inline int gdsc_register (struct device *d,struct gdsc **g,size_t n, +static inline int gdsc_register (struct gdsc_desc *desc,struct reset_controller_dev *rcdev,struct regmap *r) {return -ENOSYS ; } -static inline void gdsc_unregister (struct device *d) {}; +static inline void gdsc_unregister (struct gdsc_desc *desc) {};#endif /* CONFIG_QCOM_GDSC */ #endif /* __QCOM_GDSC_H__ */
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Stephen Boyd
AppliedRe: [PATCH v2 1/6] clk: qcom: gdsc: Add support for hierarchical power domains
Quoted 5 lines · Rajendra Nayak
Some qcom SoCs' can have hierarchical power domains. Let the gdsc structs specify the parents (if any) and the driver add genpd subdomains for them.
Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 2/6 clk: qcom: gdsc: Add support for gdscs with gds hw controller
In reply to Rajendra NayakSome gdsc power domains can have a gds_hw_controller block inside to help ensure all slave devices within the power domain are idle before the gdsc is actually switched off.
This is mainly useful in power domains which host a MMU, in which case its necessary to make sure there are no outstanding MMU operations or pending bus transactions before the power domain is turned off.
In gdscs with gds_hw_controller block, its necessary to check the gds_hw_ctrl status bits instead of the ones in gdscr, to determine the state of the powerdomain.
While at it, also move away from using jiffies and use ktime APIs instead for busy looping on status bits.
--- drivers/clk/qcom/gdsc.c | 44 +++++++++++++++++++++++++++----------------- drivers/clk/qcom/gdsc.h | 2 ++ 2 files changed, 29 insertions(+), 17 deletions(-)
drivers/clk/qcom/gdsc.c +27 -17
@@ -16,6 +16,7 @@#include <linux/err.h> #include <linux/jiffies.h> #include <linux/kernel.h> +#include <linux/ktime.h> #include <linux/pm_domain.h> #include <linux/regmap.h> #include <linux/reset-controller.h>
@@ -42,12 +43,12 @@#define domain_to_gdsc (domain) container_of(domain, struct gdsc, pd) -static int gdsc_is_enabled (struct gdsc *sc) +static int gdsc_is_enabled (struct gdsc *sc,unsigned int reg) {u32 val;int ret; - ret =regmap_read (sc->regmap, sc->gdscr, &val); + ret =regmap_read (sc->regmap, reg, &val);if (ret)return ret;
@@ -58,28 +59,35 @@ static int gdsc_toggle_logic(struct gdsc *sc, bool en) {int ret;u32 val = en ?0 :SW_COLLAPSE_MASK ; -u32 check = en ?PWR_ON_MASK :0 ; -unsigned long timeout; +ktime_t start; +unsigned int status_reg = sc->gdscr; ret =regmap_update_bits (sc->regmap, sc->gdscr,SW_COLLAPSE_MASK , val);if (ret)return ret; - timeout = jiffies +usecs_to_jiffies (TIMEOUT_US ); -do { - ret =regmap_read (sc->regmap, sc->gdscr, &val); -if (ret) -return ret; +if (sc->gds_hw_ctrl) { + status_reg = sc->gds_hw_ctrl; +/* +* The gds hw controller asserts/de-asserts the status bit soon +* after it receives a power on/off request from a master. +* The controller then takes around 8 xo cycles to start its +* internal state machine and update the status bit. During +* this time, the status bit does not reflect the true status +* of the core. +* Add a delay of 1 us between writing to the SW_COLLAPSE bit +* and polling the status bit. +*/ +udelay (1 ); + } -if ((val &PWR_ON_MASK ) == check) + start =ktime_get (); +do { +if (gdsc_is_enabled (sc, status_reg) == en)return 0 ; - }while (time_before (jiffies, timeout)); - - ret =regmap_read (sc->regmap, sc->gdscr, &val); -if (ret) -return ret; + }while (ktime_us_delta (ktime_get (), start) <TIMEOUT_US ); -if ((val &PWR_ON_MASK ) == check) +if (gdsc_is_enabled (sc, status_reg) == en)return 0 ;return -ETIMEDOUT ;
@@ -165,6 +173,7 @@ static int gdsc_init(struct gdsc *sc) {u32 mask, val;int on, ret; +unsigned int reg;/* * Disable HW trigger: collapse/restore occur based on registers writes.
@@ -185,7 +194,8 @@ static int gdsc_init(struct gdsc *sc)return ret; } - on =gdsc_is_enabled (sc); + reg = sc->gds_hw_ctrl ? sc->gds_hw_ctrl : sc->gdscr; + on =gdsc_is_enabled (sc, reg);if (on <0 )return on;
drivers/clk/qcom/gdsc.h +2 -0
@@ -32,6 +32,7 @@ struct reset_controller_dev;* @pd: generic power domain * @regmap: regmap for MMIO accesses * @gdscr: gsdc control register +* @gds_hw_ctrl: gds_hw_ctrl register * @cxcs: offsets of branch registers to toggle mem/periph bits in * @cxc_count: number of @cxcs * @pwrsts: Possible powerdomain power states
@@ -44,6 +45,7 @@ struct gdsc {struct generic_pm_domain *parent;struct regmap *regmap;unsigned int gdscr; +unsigned int gds_hw_ctrl;unsigned int *cxcs;unsigned int cxc_count;const u8 pwrsts;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Stephen Boyd
AppliedRe: [PATCH v2 2/6] clk: qcom: gdsc: Add support for gdscs with gds hw controller
Quoted 11 lines · Rajendra Nayak
Some gdsc power domains can have a
gds_hw_controllerblock inside to help ensure all slave devices within the power domain are idle before the gdsc is actually switched off.
This is mainly useful in power domains which host a MMU, in which case its necessary to make sure there are no outstanding MMU operations or pending bus transactions before the power domain is turned off.In gdscs with
gds_hw_controllerblock, its necessary to check thegds_hw_ctrlstatus bits instead of the ones in gdscr, to determine the state of the powerdomain.
Quoted 5 lines
While at it, also move away from using jiffies and use ktime APIs instead for busy looping on status bits.
Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 3/6 clk: qcom: gdsc: Add support for votable gdscs
In reply to Rajendra NayakSome gdscs might be controlled via voting registers and might not really disable when the kernel intends to disable them (due to other votes keeping them enabled)
Mark these gdscs with a flag for we do not check/wait on a disable status for these gdscs within the kernel disable callback.
Also at boot, if these GDSCs are found to be ON, we make sure we vote for them before we inform the genpd framework about their status. If genpd gets no users, it then disables (removes the vote) them as part of genpd_poweroff_unused()
--- drivers/clk/qcom/gdsc.c | 18 ++++++++++++++++++ drivers/clk/qcom/gdsc.h | 15 ++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/clk/qcom/gdsc.c +18 -0
@@ -66,6 +66,17 @@ static int gdsc_toggle_logic(struct gdsc *sc, bool en)if (ret)return ret; +/* If disabling votable gdscs, don't poll on status */ +if ((sc->flags &VOTABLE ) && !en) { +/* +* Add a short delay here to ensure that an enable +* right after it was disabled does not put it in an +* unknown state +*/ +udelay (TIMEOUT_US ); +return 0 ; + } +if (sc->gds_hw_ctrl) { status_reg = sc->gds_hw_ctrl;/*
@@ -199,6 +210,13 @@ static int gdsc_init(struct gdsc *sc)if (on <0 )return on; +/* +* Votable GDSCs can be ON due to Vote from other masters. +* If a Votable GDSC is ON, make sure we have a Vote. +*/ +if ((sc->flags &VOTABLE ) && on) +gdsc_enable (&sc->pd); +if (on || (sc->pwrsts &PWRSTS_RET ))gdsc_force_mem_on (sc);else
drivers/clk/qcom/gdsc.h +8 -7
@@ -20,13 +20,6 @@struct regmap ;struct reset_controller_dev ; -/* Powerdomain allowable state bitfields */ -#define PWRSTS_OFF BIT(0) -#define PWRSTS_RET BIT(1) -#define PWRSTS_ON BIT(2) -#define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON) -#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) -/** * struct gdsc - Globally Distributed Switch Controller * @pd: generic power domain
@@ -49,6 +42,14 @@ struct gdsc {unsigned int *cxcs;unsigned int cxc_count;const u8 pwrsts; +/* Powerdomain allowable state bitfields */ +#define PWRSTS_OFF BIT(0) +#define PWRSTS_RET BIT(1) +#define PWRSTS_ON BIT(2) +#define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON) +#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) +const u8 flags; +#define VOTABLE BIT(0)struct reset_controller_dev *rcdev;unsigned int *resets;unsigned int reset_count;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Stephen Boyd
AppliedRe: [PATCH v2 3/6] clk: qcom: gdsc: Add support for votable gdscs
Quoted 6 lines · Rajendra Nayak
Some gdscs might be controlled via voting registers and might not really disable when the kernel intends to disable them (due to other votes keeping them enabled)
Mark these gdscs with a flag for we do not check/wait on a disable status for these gdscs within the kernel disable callback.
Quoted 7 lines
Also at boot, if these GDSCs are found to be ON, we make sure we vote for them before we inform the genpd framework about their status. If genpd gets no users, it then disables (removes the vote) them as part of
genpd_poweroff_unused()Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 4/6 clk: qcom: gdsc: Add GDSCs in msm8996 GCC
In reply to Rajendra NayakAdd all data for the GDSCs which are part of msm8996 GCC block
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 1 + drivers/clk/qcom/gcc-msm8996.c | 92 ++++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-msm8996.h | 11 ++++ 3 files changed, 104 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +1 -0
@@ -147,6 +147,7 @@ compatible = "qcom,gcc-msm8996"; #clock-cells = <1>; #reset-cells = <1>; + #power-domain-cells = <1>; reg = <0x300000 0x90000>; };
drivers/clk/qcom/gcc-msm8996.c +92 -0
116 lines not on this page · raw message
include/dt-bindings/clock/qcom,gcc-msm8996.h +11 -0
@@ -336,4 +336,15 @@#define GCC_MSS_Q6_BCR 99#define GCC_QREFS_VBG_CAL_BCR 100 +/* Indexes for GDSCs */ +#define AGGRE0_NOC_GDSC 0 +#define HLOS1_VOTE_AGGRE0_NOC_GDSC 1 +#define HLOS1_VOTE_LPASS_ADSP_GDSC 2 +#define HLOS1_VOTE_LPASS_CORE_GDSC 3 +#define USB30_GDSC 4 +#define PCIE0_GDSC 5 +#define PCIE1_GDSC 6 +#define PCIE2_GDSC 7 +#define UFS_GDSC 8 +#endif
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Stephen Boyd
AppliedRe: [PATCH v2 4/6] clk: qcom: gdsc: Add GDSCs in msm8996 GCC
Quoted 4 lines · Rajendra Nayak
Add all data for the GDSCs which are part of msm8996 GCC block
Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 4/6] clk: qcom: gdsc: Add GDSCs in msm8996 GCC
In reply to Rajendra NayakQuoted 4 lines · Rajendra Nayak
Add all data for the GDSCs which are part of msm8996 GCC block
Signed-off-by Rajendra Nayak <[email protected]>---
Forgot to mention that I left out the dtsi change here too.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 5/6 clk: qcom: gdsc: Add mmcc gdscs for msm8996 family
In reply to Rajendra NayakAdd all gdsc data which are part of mmcc on msm8996 family
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 1 + drivers/clk/qcom/mmcc-msm8996.c | 157 ++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,mmcc-msm8996.h | 17 +++ 3 files changed, 175 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +1 -0
@@ -252,6 +252,7 @@ compatible = "qcom,mmcc-msm8996"; #clock-cells = <1>; #reset-cells = <1>; + #power-domain-cells = <1>; reg = <0x8c0000 0x40000>; assigned-clocks = <&mmcc MMPLL9_PLL>, <&mmcc MMPLL1_PLL>,
drivers/clk/qcom/mmcc-msm8996.c +157 -0
181 lines not on this page · raw message
include/dt-bindings/clock/qcom,mmcc-msm8996.h +17 -0
@@ -282,4 +282,21 @@#define FD_BCR 58#define MMSS_SPDM_RM_BCR 59 +/* Indexes for GDSCs */ +#define MMAGIC_VIDEO_GDSC 0 +#define MMAGIC_MDSS_GDSC 1 +#define MMAGIC_CAMSS_GDSC 2 +#define GPU_GDSC 3 +#define VENUS_GDSC 4 +#define VENUS_CORE0_GDSC 5 +#define VENUS_CORE1_GDSC 6 +#define CAMSS_GDSC 7 +#define VFE0_GDSC 8 +#define VFE1_GDSC 9 +#define JPEG_GDSC 10 +#define CPP_GDSC 11 +#define FD_GDSC 12 +#define MDSS_GDSC 13 +#define GPU_GX_GDSC 14 +#endif
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Stephen Boyd
AppliedRe: [PATCH v2 5/6] clk: qcom: gdsc: Add mmcc gdscs for msm8996 family
Quoted 4 lines · Rajendra Nayak
Add all gdsc data which are part of mmcc on msm8996 family
Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next, but I dropped dtsi changes and squashed in this patch
---8<---
drivers/clk/qcom/mmcc-msm8996.c +13 -13
@@ -2918,7 +2918,7 @@ static struct clk_hw *mmcc_msm8996_hws[] = { &gpll0_div.hw, }; -struct gdsc mmagic_video_gdsc = { +static struct gdsc mmagic_video_gdsc = { .gdscr =0x119c , .gds_hw_ctrl =0x120c , .pd = {
@@ -2928,7 +2928,7 @@ struct gdsc mmagic_video_gdsc = { .flags = VOTABLE, }; -struct gdsc mmagic_mdss_gdsc = { +static struct gdsc mmagic_mdss_gdsc = { .gdscr =0x247c , .gds_hw_ctrl =0x2480 , .pd = {
@@ -2938,7 +2938,7 @@ struct gdsc mmagic_mdss_gdsc = { .flags = VOTABLE, }; -struct gdsc mmagic_camss_gdsc = { +static struct gdsc mmagic_camss_gdsc = { .gdscr =0x3c4c , .gds_hw_ctrl =0x3c50 , .pd = {
@@ -2948,7 +2948,7 @@ struct gdsc mmagic_camss_gdsc = { .flags = VOTABLE, }; -struct gdsc venus_gdsc = { +static struct gdsc venus_gdsc = { .gdscr =0x1024 , .cxcs = (unsigned int []){0x1028 ,0x1034 ,0x1038 }, .cxc_count =3 ,
@@ -2959,7 +2959,7 @@ struct gdsc venus_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc venus_core0_gdsc = { +static struct gdsc venus_core0_gdsc = { .gdscr =0x1040 , .cxcs = (unsigned int []){0x1048 }, .cxc_count =1 ,
@@ -2969,7 +2969,7 @@ struct gdsc venus_core0_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc venus_core1_gdsc = { +static struct gdsc venus_core1_gdsc = { .gdscr =0x1044 , .cxcs = (unsigned int []){0x104c }, .cxc_count =1 ,
@@ -2979,7 +2979,7 @@ struct gdsc venus_core1_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc camss_gdsc = { +static struct gdsc camss_gdsc = { .gdscr =0x34a0 , .cxcs = (unsigned int []){0x36bc ,0x36c4 }, .cxc_count =2 ,
@@ -2990,7 +2990,7 @@ struct gdsc camss_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc vfe0_gdsc = { +static struct gdsc vfe0_gdsc = { .gdscr =0x3664 , .cxcs = (unsigned int []){0x36a8 }, .cxc_count =1 ,
@@ -3001,7 +3001,7 @@ struct gdsc vfe0_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc vfe1_gdsc = { +static struct gdsc vfe1_gdsc = { .gdscr =0x3674 , .cxcs = (unsigned int []){0x36ac }, .cxc_count =1 ,
@@ -3012,7 +3012,7 @@ struct gdsc vfe1_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc jpeg_gdsc = { +static struct gdsc jpeg_gdsc = { .gdscr =0x35a4 , .cxcs = (unsigned int []){0x35a8 ,0x35b0 ,0x35c0 ,0x35b8 }, .cxc_count =4 ,
@@ -3023,7 +3023,7 @@ struct gdsc jpeg_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc cpp_gdsc = { +static struct gdsc cpp_gdsc = { .gdscr =0x36d4 , .cxcs = (unsigned int []){0x36b0 }, .cxc_count =1 ,
@@ -3034,7 +3034,7 @@ struct gdsc cpp_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc fd_gdsc = { +static struct gdsc fd_gdsc = { .gdscr =0x3b64 , .cxcs = (unsigned int []){0x3b68 ,0x3b6c }, .cxc_count =2 ,
@@ -3045,7 +3045,7 @@ struct gdsc fd_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct gdsc mdss_gdsc = { +static struct gdsc mdss_gdsc = { .gdscr =0x2304 , .cxcs = (unsigned int []){0x2310 ,0x231c }, .cxc_count =2 ,
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 6/6 clk: qcom: mmcc8974: Use gdscs .parent and remove genpd calls
In reply to Rajendra NayakWith gdsc driver capable of handling hierarchical power domains, specify oxili_gdsc as parent of oxilicx_gdsc.
Remove all direct calls to genpd from the mmcc clock driver. The adding and removing of subdomains is now handled from within the gdsc driver.
--- drivers/clk/qcom/mmcc-msm8974.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/clk/qcom/mmcc-msm8974.c +2 -12
@@ -2400,6 +2400,7 @@ static struct gdsc oxilicx_gdsc = { .pd = { .name = "oxilicx", }, + .parent = &oxili_gdsc.pd, .pwrsts = PWRSTS_OFF_ON, };
@@ -2625,22 +2626,11 @@ static int mmcc_msm8974_probe(struct platform_device *pdev)clk_pll_configure_sr_hpm_lp (&mmpll1, regmap, &mmpll1_config, true);clk_pll_configure_sr_hpm_lp (&mmpll3, regmap, &mmpll3_config, false); - ret =qcom_cc_really_probe (pdev, &mmcc_msm8974_desc, regmap); -if (ret) -return ret; - -return pm_genpd_add_subdomain (&oxili_gdsc.pd, &oxilicx_gdsc.pd); -} - -static int mmcc_msm8974_remove (struct platform_device *pdev) -{ -pm_genpd_remove_subdomain (&oxili_gdsc.pd, &oxilicx_gdsc.pd); -return 0 ; +return qcom_cc_really_probe (pdev, &mmcc_msm8974_desc, regmap); }static struct platform_driver mmcc_msm8974_driver = { .probe = mmcc_msm8974_probe, - .remove = mmcc_msm8974_remove, .driver = { .name ="mmcc-msm8974" , .of_match_table = mmcc_msm8974_match_table,
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Stephen Boyd
AppliedRe: [PATCH v2 6/6] clk: qcom: mmcc8974: Use gdscs .parent and remove genpd calls
Quoted 9 lines · Rajendra Nayak
With gdsc driver capable of handling hierarchical power domains, specify
oxili_gdscas parent ofoxilicx_gdsc.Remove all direct calls to genpd from the mmcc clock driver. The adding and removing of subdomains is now handled from within the gdsc driver.
Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next + this squashed in
---8<----
drivers/clk/qcom/mmcc-msm8974.c +0 -1
@@ -2617,7 +2617,6 @@ MODULE_DEVICE_TABLE(of, mmcc_msm8974_match_table);static int mmcc_msm8974_probe (struct platform_device *pdev) {struct regmap *regmap; -int ret; regmap =qcom_cc_map (pdev, &mmcc_msm8974_desc);if (IS_ERR (regmap))
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 6/6] clk: qcom: mmcc8974: Use gdscs .parent and remove genpd calls
Quoted 4 lines · Stephen Boyd
Quoted 3 lines · Rajendra Nayak
With gdsc driver capable of handling hierarchical power domains, specify
oxili_gdscas parent ofoxilicx_gdsc.
Quoted 8 lines
Quoted 6 lines
Remove all direct calls to genpd from the mmcc clock driver. The adding and removing of subdomains is now handled from within the gdsc driver.
Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next + this squashed in
Thanks Stephen, for fixing these up before pulling in. I will resubmit the dtsi parts as a separate patch.
Quoted 15 lines
---8<----
drivers/clk/qcom/mmcc-msm8974.c +0
-1@@ -2617,7 +2617,6 @@ MODULE_DEVICE_TABLE(of, mmcc_msm8974_match_table);static int mmcc_msm8974_probe (struct platform_device *pdev) {struct regmap *regmap; -int ret; regmap =qcom_cc_map (pdev, &mmcc_msm8974_desc);if (IS_ERR (regmap))
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 5 lines · Rajendra Nayak
Changes since v1:
* For votable gdscs which are 'on' at boot, put an explicit vote
* Added a delay post disable for votable gdscs
* Added back the status check after timeout
* rearranged some patch ordering to avoid bisect issues
Stephen, Did you get a chance to look at this series?
Quoted 38 lines
This series adds support for GDSCs' which are part of gcc and mmcc in QCOM msm8996 SoC. Series applies on top of clk-next
There are many more cases of gdscs within gdscs (hierarchical power domains) in msm8996 (msm8974 has one such instance which is supported upstream) and hence the series adds support within gdsc driver to handle this.
Also msm8996 has gdscs with gds hw controllers within, for ensuring slave device idleness before gdscs are powered off, hence the series also adds support for gdscs with gds hw controllers.
ToDo: Series does not yet add support for gpu gdscs which are part of mmcc
Tested on apq8096 dragonboards to make sure all modelled gdscs can be turned on/off successfully
Rajendra Nayak (6):
clk: qcom: gdsc: Add support for hierarchical power domains
clk: qcom: gdsc: Add support for gdscs with gds hw controller
clk: qcom: gdsc: Add support for votable gdscs
clk: qcom: gdsc: Add GDSCs in msm8996 GCC
clk: qcom: gdsc: Add mmcc gdscs for msm8996 family
clk: qcom: mmcc8974: Use gdscs .parent and remove genpd callsarch/arm64/boot/dts/qcom/msm8996.dtsi | 2 + drivers/clk/qcom/common.c | 14 ++- drivers/clk/qcom/gcc-msm8996.c | 92 +++++++++++++++ drivers/clk/qcom/gdsc.c | 89 +++++++++++---- drivers/clk/qcom/gdsc.h | 34 ++++-- drivers/clk/qcom/mmcc-msm8974.c | 14 +-- drivers/clk/qcom/mmcc-msm8996.c | 157 ++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-msm8996.h | 11 ++ include/dt-bindings/clock/qcom,mmcc-msm8996.h | 17 +++ 9 files changed, 382 insertions(+), 48 deletions(-)
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation