clk: qcom: msm8996: handle mmagic gdscs and clocks
Subsystems (3)
v2 cover clk: qcom: msm8996: handle mmagic gdscs and clocks
This is a respin of v1 with minor updates since this series is still needed for most multimedia usescases to work on msm8996.
With no bus driver to handle the mmagic bus clocks and gdscs on msm8996, its best to just turn them all ON at gdsc/clk driver probe and leave them ON thereafter. This should unblock a lot of multimedia support on msm8996 which rely on these to be ON and have no way to control them at this point. Once we do have better noc/bus management drivers in place we can avoid leaving these ON always and turn them ON/OFF as needed.
Rajendra Nayak (3):
clk: qcom: gdsc: Add support for ALWAYS_ON gdscs
clk: qcom: Register the gdscs before the clocks
clk: qcom: mmcc-msm8996: leave all mmagic gdscs and clocks always
enabled
drivers/clk/qcom/common.c | 32 ++++++++++++++++---------------- drivers/clk/qcom/gcc-msm8996.c | 2 +- drivers/clk/qcom/gdsc.c | 8 ++++++++ drivers/clk/qcom/gdsc.h | 1 + drivers/clk/qcom/mmcc-msm8996.c | 22 +++++++++++----------- 5 files changed, 37 insertions(+), 28 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/3 clk: qcom: gdsc: Add support for ALWAYS_ON gdscs
Some GDSCs might have software control to turn them off, but we might want to keep them enabled always, in some cases because of lack of support in kernel to handle a graceful turning off/on of such GDSCs. Most common instances would be the GDCSs which power up the noc/bus fabrics, which need bus drivers to handle them and atleast support for which is missing on all qcom SoCs.
--- drivers/clk/qcom/gdsc.c | 8 ++++++++ drivers/clk/qcom/gdsc.h | 1 + 2 files changed, 9 insertions(+)
drivers/clk/qcom/gdsc.c +8 -0
@@ -291,6 +291,14 @@ static int gdsc_init(struct gdsc *sc)if ((sc->flags &VOTABLE ) && on)gdsc_enable (&sc->pd); +/* If ALWAYS_ON GDSCs are not ON, turn them ON */ +if (sc->flags &ALWAYS_ON ) { +if (!on) +gdsc_enable (&sc->pd); + on = true; + sc->pd.flags |=GENPD_FLAG_ALWAYS_ON ; + } +if (on || (sc->pwrsts &PWRSTS_RET ))gdsc_force_mem_on (sc);else
drivers/clk/qcom/gdsc.h +1 -0
@@ -53,6 +53,7 @@ struct gdsc {#define VOTABLE BIT(0)#define CLAMP_IO BIT(1)#define HW_CTRL BIT(2) +#define ALWAYS_ON BIT(3)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
Re: [PATCH v2 1/3] clk: qcom: gdsc: Add support for ALWAYS_ON gdscs
Quoted 8 lines · Rajendra Nayak
Some GDSCs might have software control to turn them off, but we might want to keep them enabled always, in some cases because of lack of support in kernel to handle a graceful turning off/on of such GDSCs. Most common instances would be the GDCSs which power up the noc/bus fabrics, which need bus drivers to handle them and atleast support for which is missing on all qcom SoCs.
Signed-off-by Rajendra Nayak <[email protected]>
Regards,
Bjorn
Quoted 44 lines
--- drivers/clk/qcom/gdsc.c | 8 ++++++++ drivers/clk/qcom/gdsc.h | 1 + 2 files changed, 9 insertions(+)drivers/clk/qcom/gdsc.c +8
-0@@ -291,6 +291,14 @@ static int gdsc_init(struct gdsc *sc)if ((sc->flags &VOTABLE ) && on)gdsc_enable (&sc->pd); +/* If ALWAYS_ON GDSCs are not ON, turn them ON */ +if (sc->flags &ALWAYS_ON ) { +if (!on) +gdsc_enable (&sc->pd); + on = true; + sc->pd.flags |=GENPD_FLAG_ALWAYS_ON ; + } +if (on || (sc->pwrsts &PWRSTS_RET ))gdsc_force_mem_on (sc);else drivers/clk/qcom/gdsc.h +1
-0@@ -53,6 +53,7 @@ struct gdsc {#define VOTABLE BIT(0)#define CLAMP_IO BIT(1)#define HW_CTRL BIT(2) +#define ALWAYS_ON BIT(3)struct reset_controller_dev *rcdev;unsigned int *resets;unsigned int reset_count;Signature · 7 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] clk: qcom: gdsc: Add support for ALWAYS_ON gdscs
In reply to Rajendra NayakQuoted 8 lines · Rajendra Nayak
Some GDSCs might have software control to turn them off, but we might want to keep them enabled always, in some cases because of lack of support in kernel to handle a graceful turning off/on of such GDSCs. Most common instances would be the GDCSs which power up the noc/bus fabrics, which need bus drivers to handle them and atleast support for which is missing on all qcom SoCs.
Signed-off-by Rajendra Nayak<[email protected]>
Re: [PATCH v2 1/3] clk: qcom: gdsc: Add support for ALWAYS_ON gdscs
In reply to Rajendra NayakQuoting Rajendra Nayak (2018-03-23 01:26:14)
Quoted 10 lines
Some GDSCs might have software control to turn them off, but we might want to keep them enabled always, in some cases because of lack of support in kernel to handle a graceful turning off/on of such GDSCs. Most common instances would be the GDCSs which power up the noc/bus fabrics, which need bus drivers to handle them and atleast support for which is missing on all qcom SoCs.
=Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next
PATCH v2 2/3 clk: qcom: Register the gdscs before the clocks
In reply to Rajendra NayakWe have atleast some instances of ALWAYS_ON gdscs, which need to be turned ON *before* some clocks within the gdsc domain marked with a CLK_IS_CRITICAL can be turned ON.
To facilitate this sequence, register the GDCSs (and hence handle the ALWAYS_ON gdscs) before we register clocks (and handle the clocks marked as CLK_IS_CRITICAL)
--- drivers/clk/qcom/common.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/clk/qcom/common.c +16 -16
@@ -228,22 +228,6 @@ int qcom_cc_really_probe(struct platform_device *pdev,if (!cc)return -ENOMEM ; - cc->rclks = rclks; - cc->num_rclks = num_clks; - -for (i =0 ; i < num_clks; i++) { -if (!rclks[i]) -continue ; - - ret =devm_clk_register_regmap (dev, rclks[i]); -if (ret) -return ret; - } - - ret =devm_of_clk_add_hw_provider (dev, qcom_cc_clk_hw_get, cc); -if (ret) -return ret; - reset = &cc->reset; reset->rcdev.of_node = dev->of_node; reset->rcdev.ops = &qcom_reset_ops;
@@ -272,6 +256,22 @@ int qcom_cc_really_probe(struct platform_device *pdev,return ret; } + cc->rclks = rclks; + cc->num_rclks = num_clks; + +for (i =0 ; i < num_clks; i++) { +if (!rclks[i]) +continue ; + + ret =devm_clk_register_regmap (dev, rclks[i]); +if (ret) +return ret; + } + + ret =devm_of_clk_add_hw_provider (dev, qcom_cc_clk_hw_get, cc); +if (ret) +return ret; +return 0 ; }EXPORT_SYMBOL_GPL (qcom_cc_really_probe);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 2/3] clk: qcom: Register the gdscs before the clocks
Quoted 8 lines · Rajendra Nayak
We have atleast some instances of
ALWAYS_ONgdscs, which need to be turned ON *before* some clocks within the gdsc domain marked with aCLK_IS_CRITICALcan be turned ON.
To facilitate this sequence, register the GDCSs (and hence handle theALWAYS_ONgdscs) before we register clocks (and handle the clocks marked asCLK_IS_CRITICAL)Signed-off-by Rajendra Nayak <[email protected]>
Regards,
Bjorn
Quoted 62 lines
--- drivers/clk/qcom/common.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)drivers/clk/qcom/common.c +16
-16@@ -228,22 +228,6 @@ int qcom_cc_really_probe(struct platform_device *pdev,if (!cc)return -ENOMEM ; - cc->rclks = rclks; - cc->num_rclks = num_clks; - -for (i =0 ; i < num_clks; i++) { -if (!rclks[i]) -continue ; - - ret =devm_clk_register_regmap (dev, rclks[i]); -if (ret) -return ret; - } - - ret =devm_of_clk_add_hw_provider (dev, qcom_cc_clk_hw_get, cc); -if (ret) -return ret; - reset = &cc->reset; reset->rcdev.of_node = dev->of_node; reset->rcdev.ops = &qcom_reset_ops;@@ -272,6 +256,22 @@ int qcom_cc_really_probe(struct platform_device *pdev,return ret; } + cc->rclks = rclks; + cc->num_rclks = num_clks; + +for (i =0 ; i < num_clks; i++) { +if (!rclks[i]) +continue ; + + ret =devm_clk_register_regmap (dev, rclks[i]); +if (ret) +return ret; + } + + ret =devm_of_clk_add_hw_provider (dev, qcom_cc_clk_hw_get, cc); +if (ret) +return ret; +return 0 ; }EXPORT_SYMBOL_GPL (qcom_cc_really_probe);Signature · 7 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/3] clk: qcom: Register the gdscs before the clocks
In reply to Rajendra NayakQuoted 9 lines · Rajendra Nayak
We have atleast some instances of
ALWAYS_ONgdscs, which need to be turned ON*before* some clocks within the gdsc domain marked with aCLK_IS_CRITICALcan be turned ON.
To facilitate this sequence, register the GDCSs (and hence handle theALWAYS_ONgdscs) before we register clocks (and handle the clocks marked asCLK_IS_CRITICAL)Signed-off-by Rajendra Nayak<[email protected]>---
Re: [PATCH v2 2/3] clk: qcom: Register the gdscs before the clocks
In reply to Rajendra NayakQuoting Rajendra Nayak (2018-03-23 01:26:15)
Quoted 10 lines
We have atleast some instances of
ALWAYS_ONgdscs, which need to be turned ON *before* some clocks within the gdsc domain marked with aCLK_IS_CRITICALcan be turned ON.
To facilitate this sequence, register the GDCSs (and hence handle theALWAYS_ONgdscs) before we register clocks (and handle the clocks marked asCLK_IS_CRITICAL)
=Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next
PATCH v2 3/3 clk: qcom: mmcc-msm8996: leave all mmagic gdscs and clocks always enabled
In reply to Rajendra NayakThere's no bus infrastructure today to handle all the mmagic bus clocks and GDSCs needed by all the multimedia blocks in msm8996, like mdss, video, camera and gpu. Mark all these clocks with a CLK_IS_CRITICAL and GDSCs with a ALWAYS_ON flag for now so they are left always enabled. This patch should be reverted at some point when we do have a bus driver to manage these clocks and GDSCs.
--- drivers/clk/qcom/gcc-msm8996.c | 2 +- drivers/clk/qcom/mmcc-msm8996.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/clk/qcom/gcc-msm8996.c +1 -1
@@ -3105,7 +3105,7 @@ static struct gdsc aggre0_noc_gdsc = { .name = "aggre0_noc", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc hlos1_vote_aggre0_noc_gdsc = {
drivers/clk/qcom/mmcc-msm8996.c +11 -11
@@ -1245,7 +1245,7 @@ static struct clk_branch mmss_mmagic_ahb_clk = { .name = "mmss_mmagic_ahb_clk", .parent_names = (const char *[]){ "ahb_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -1260,7 +1260,7 @@ static struct clk_branch mmss_mmagic_cfg_ahb_clk = { .name = "mmss_mmagic_cfg_ahb_clk", .parent_names = (const char *[]){ "ahb_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -1319,7 +1319,7 @@ static struct clk_branch mmagic_camss_axi_clk = { .name = "mmagic_camss_axi_clk", .parent_names = (const char *[]){ "axi_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -1334,7 +1334,7 @@ static struct clk_branch mmagic_camss_noc_cfg_ahb_clk = { .name = "mmagic_camss_noc_cfg_ahb_clk", .parent_names = (const char *[]){ "gcc_mmss_noc_cfg_ahb_clk" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -1439,7 +1439,7 @@ static struct clk_branch mmagic_mdss_axi_clk = { .name = "mmagic_mdss_axi_clk", .parent_names = (const char *[]){ "axi_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -1454,7 +1454,7 @@ static struct clk_branch mmagic_mdss_noc_cfg_ahb_clk = { .name = "mmagic_mdss_noc_cfg_ahb_clk", .parent_names = (const char *[]){ "gcc_mmss_noc_cfg_ahb_clk" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -1529,7 +1529,7 @@ static struct clk_branch mmagic_video_axi_clk = { .name = "mmagic_video_axi_clk", .parent_names = (const char *[]){ "axi_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -1544,7 +1544,7 @@ static struct clk_branch mmagic_video_noc_cfg_ahb_clk = { .name = "mmagic_video_noc_cfg_ahb_clk", .parent_names = (const char *[]){ "gcc_mmss_noc_cfg_ahb_clk" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
@@ -2919,7 +2919,7 @@ static struct gdsc mmagic_video_gdsc = { .name = "mmagic_video", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc mmagic_mdss_gdsc = {
@@ -2929,7 +2929,7 @@ static struct gdsc mmagic_mdss_gdsc = { .name = "mmagic_mdss", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc mmagic_camss_gdsc = {
@@ -2939,7 +2939,7 @@ static struct gdsc mmagic_camss_gdsc = { .name = "mmagic_camss", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc venus_gdsc = {
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 3/3] clk: qcom: mmcc-msm8996: leave all mmagic gdscs and clocks always enabled
Quoted 8 lines · Rajendra Nayak
There's no bus infrastructure today to handle all the mmagic bus clocks and GDSCs needed by all the multimedia blocks in msm8996, like mdss, video, camera and gpu. Mark all these clocks with a
CLK_IS_CRITICALand GDSCs with aALWAYS_ONflag for now so they are left always enabled. This patch should be reverted at some point when we do have a bus driver to manage these clocks and GDSCs.Signed-off-by Rajendra Nayak <[email protected]>
Regards,
Bjorn
Quoted 129 lines
--- drivers/clk/qcom/gcc-msm8996.c | 2 +- drivers/clk/qcom/mmcc-msm8996.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-)drivers/clk/qcom/gcc-msm8996.c +1
-1@@ -3105,7 +3105,7 @@ static struct gdsc aggre0_noc_gdsc = { .name = "aggre0_noc", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc hlos1_vote_aggre0_noc_gdsc = {drivers/clk/qcom/mmcc-msm8996.c +11
-11@@ -1245,7 +1245,7 @@ static struct clk_branch mmss_mmagic_ahb_clk = { .name = "mmss_mmagic_ahb_clk", .parent_names = (const char *[]){ "ahb_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -1260,7 +1260,7 @@ static struct clk_branch mmss_mmagic_cfg_ahb_clk = { .name = "mmss_mmagic_cfg_ahb_clk", .parent_names = (const char *[]){ "ahb_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -1319,7 +1319,7 @@ static struct clk_branch mmagic_camss_axi_clk = { .name = "mmagic_camss_axi_clk", .parent_names = (const char *[]){ "axi_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -1334,7 +1334,7 @@ static struct clk_branch mmagic_camss_noc_cfg_ahb_clk = { .name = "mmagic_camss_noc_cfg_ahb_clk", .parent_names = (const char *[]){ "gcc_mmss_noc_cfg_ahb_clk" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -1439,7 +1439,7 @@ static struct clk_branch mmagic_mdss_axi_clk = { .name = "mmagic_mdss_axi_clk", .parent_names = (const char *[]){ "axi_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -1454,7 +1454,7 @@ static struct clk_branch mmagic_mdss_noc_cfg_ahb_clk = { .name = "mmagic_mdss_noc_cfg_ahb_clk", .parent_names = (const char *[]){ "gcc_mmss_noc_cfg_ahb_clk" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -1529,7 +1529,7 @@ static struct clk_branch mmagic_video_axi_clk = { .name = "mmagic_video_axi_clk", .parent_names = (const char *[]){ "axi_clk_src" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -1544,7 +1544,7 @@ static struct clk_branch mmagic_video_noc_cfg_ahb_clk = { .name = "mmagic_video_noc_cfg_ahb_clk", .parent_names = (const char *[]){ "gcc_mmss_noc_cfg_ahb_clk" }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },@@ -2919,7 +2919,7 @@ static struct gdsc mmagic_video_gdsc = { .name = "mmagic_video", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc mmagic_mdss_gdsc = {@@ -2929,7 +2929,7 @@ static struct gdsc mmagic_mdss_gdsc = { .name = "mmagic_mdss", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc mmagic_camss_gdsc = {@@ -2939,7 +2939,7 @@ static struct gdsc mmagic_camss_gdsc = { .name = "mmagic_camss", }, .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, + .flags = VOTABLE | ALWAYS_ON, }; static struct gdsc venus_gdsc = {Signature · 7 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 3/3] clk: qcom: mmcc-msm8996: leave all mmagic gdscs and clocks always enabled
In reply to Rajendra NayakQuoting Rajendra Nayak (2018-03-23 01:26:16)
Quoted 10 lines
There's no bus infrastructure today to handle all the mmagic bus clocks and GDSCs needed by all the multimedia blocks in msm8996, like mdss, video, camera and gpu. Mark all these clocks with a
CLK_IS_CRITICALand GDSCs with aALWAYS_ONflag for now so they are left always enabled. This patch should be reverted at some point when we do have a bus driver to manage these clocks and GDSCs.
=Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next