clk: qcom: Add support for msm8996 gpu gdscs
Subsystems (3)
cover clk: qcom: Add support for msm8996 gpu gdscs
The GPU gdsc for 8996 has an additonal clamp that needs to be released/deasserted before the gdsc can be enabled, and asserted back on a disable.
This series adds support to do that based off a flag in the gdsc driver and also populates the data for the 2 gdscs which are part of mmcc
Rajendra Nayak (2):
clk: qcom: Handle the clamp_io assert/deassert sequence
clk: qcom: mmcc-8996: Add gpu gdscs
drivers/clk/qcom/gdsc.c | 26 +++++++++++++++++++++++++- drivers/clk/qcom/gdsc.h | 2 ++ drivers/clk/qcom/mmcc-msm8996.c | 24 ++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-)
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 1/2 clk: qcom: Handle the clamp_io assert/deassert sequence
Add a flag to mark gdscs which need to support the clamp deassert/assert before and after the gdsc enable/disable
--- drivers/clk/qcom/gdsc.c | 26 +++++++++++++++++++++++++- drivers/clk/qcom/gdsc.h | 2 ++ 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/clk/qcom/gdsc.c +25 -1
@@ -30,6 +30,7 @@#define SW_OVERRIDE_MASK BIT(2)#define HW_CONTROL_MASK BIT(1)#define SW_COLLAPSE_MASK BIT(0) +#define GMEM_CLAMP_IO_MASK BIT(0)/* Wait 2^n CXO cycles between all states. Here, n=2 (4 cycles). */ #define EN_REST_WAIT_VAL (0x2 << 20)
@@ -140,6 +141,18 @@ static inline void gdsc_clear_mem_on(struct gdsc *sc)regmap_update_bits (sc->regmap, sc->cxcs[i], mask,0 ); } +static inline void gdsc_deassert_clamp_io (struct gdsc *sc) +{ +regmap_update_bits (sc->regmap, sc->clamp_io_ctrl, +GMEM_CLAMP_IO_MASK ,0 ); +} + +static inline void gdsc_assert_clamp_io (struct gdsc *sc) +{ +regmap_update_bits (sc->regmap, sc->clamp_io_ctrl, +GMEM_CLAMP_IO_MASK ,1 ); +} +static int gdsc_enable (struct generic_pm_domain *domain) {struct gdsc *sc =domain_to_gdsc (domain);
@@ -148,6 +161,9 @@ static int gdsc_enable(struct generic_pm_domain *domain)if (sc->pwrsts ==PWRSTS_ON )return gdsc_deassert_reset (sc); +if (sc->flags &CLAMP_IO ) +gdsc_deassert_clamp_io (sc); + ret =gdsc_toggle_logic (sc, true);if (ret)return ret;
@@ -170,6 +186,7 @@ static int gdsc_enable(struct generic_pm_domain *domain)static int gdsc_disable (struct generic_pm_domain *domain) {struct gdsc *sc =domain_to_gdsc (domain); +int ret;if (sc->pwrsts ==PWRSTS_ON )return gdsc_assert_reset (sc);
@@ -177,7 +194,14 @@ static int gdsc_disable(struct generic_pm_domain *domain)if (sc->pwrsts &PWRSTS_OFF )gdsc_clear_mem_on (sc); -return gdsc_toggle_logic (sc, false); + ret =gdsc_toggle_logic (sc, false); +if (ret) +return ret; + +if (sc->flags &CLAMP_IO ) +gdsc_assert_clamp_io (sc); + +return 0 ; }static int gdsc_init (struct gdsc *sc)
drivers/clk/qcom/gdsc.h +2 -0
@@ -39,6 +39,7 @@ struct gdsc {struct regmap *regmap;unsigned int gdscr;unsigned int gds_hw_ctrl; +unsigned int clamp_io_ctrl;unsigned int *cxcs;unsigned int cxc_count;const u8 pwrsts;
@@ -50,6 +51,7 @@ struct gdsc {#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON)const u8 flags;#define VOTABLE BIT(0) +#define CLAMP_IO BIT(1)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
PATCH 2/2 clk: qcom: mmcc-8996: Add gpu gdscs
In reply to Rajendra NayakAdd gpu gdsc data for msm8996
--- drivers/clk/qcom/mmcc-msm8996.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/clk/qcom/mmcc-msm8996.c +24 -0
@@ -3034,6 +3034,28 @@ enum { .pwrsts = PWRSTS_OFF_ON, }; +static struct gdsc gpu_gdsc = { + .gdscr =0x4034 , + .gds_hw_ctrl =0x4038 , + .pd = { + .name ="gpu" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc gpu_gx_gdsc = { + .gdscr =0x4024 , + .clamp_io_ctrl =0x4300 , + .cxcs = (unsigned int []){0x4028 }, + .cxc_count =1 , + .pd = { + .name ="gpu_gx" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =CLAMP_IO , +}; +static struct clk_regmap *mmcc_msm8996_clocks[] = { [MMPLL0_EARLY ] = &mmpll0_early.clkr, [MMPLL0_PLL ] = &mmpll0.clkr,
@@ -3223,6 +3245,8 @@ enum { [CPP_GDSC] = &cpp_gdsc, [FD_GDSC] = &fd_gdsc, [MDSS_GDSC] = &mdss_gdsc, + [GPU_GDSC] = &gpu_gdsc, + [GPU_GX_GDSC] = &gpu_gx_gdsc, };static const struct qcom_reset_map mmcc_msm8996_resets[] = {
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 1/2] clk: qcom: Handle the clamp_io assert/deassert sequence
In reply to Rajendra NayakQuoted 5 lines · Rajendra Nayak
Add a flag to mark gdscs which need to support the clamp deassert/assert before and after the gdsc enable/disable
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
Stephen Boyd
AppliedRe: [PATCH 2/2] clk: qcom: mmcc-8996: Add gpu gdscs
In reply to Rajendra NayakQuoted 4 lines · Rajendra Nayak
Add gpu gdsc data for msm8996
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