Set PCNoC clk always-on, with or without interconnect
Subsystems (3)
cover Set PCNoC clk always-on, with or without interconnect
The PCNoC clock needs to always have some sort of a vote hanging onto it, so long as the AP is alive. Some platforms guarantee that through the interconnect driver, while others (that register the PCNoC clk with the clock framework) don't, which results in a big kaboom and force reboot when trying to suspend that clock.
Solve the issue for the latter group.
---
Konrad Dybcio (2):
clk: qcom: smd-rpm: Add a way to define bus clocks with rate and flags
clk: qcom: smd-rpm: Set XO rate and CLK_IS_CRITICAL on PCNoC
drivers/clk/qcom/clk-smd-rpm.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
---
base-commit: ec89391563792edd11d138a853901bce76d11f44
change-id: 20230731-topic-pcnoc-d819a4713254
Best regards,
Signature · 1 line
Konrad Dybcio <[email protected]>
PATCH 1/2 clk: qcom: smd-rpm: Add a way to define bus clocks with rate and flags
Some clocks, at least PCNoC (a.k.a CNoC_PERIPH) need to be always on, at least on the ACTIVE side, regardless of whether they're used for bus scaling or not.
Introduce a new macro to preset non-INT_MAX rates and clk flags to make it easy and work implicitly through the CCF.
--- drivers/clk/qcom/clk-smd-rpm.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/clk/qcom/clk-smd-rpm.c +15 -8
@@ -18,7 +18,7 @@#include <dt-bindings/clock/qcom,rpmcc.h> #define __DEFINE_CLK_SMD_RPM_PREFIX (_prefix, _name, _active, \ - type, r_id, key) \ + type, r_id, key, ao_rate, ao_flags) \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_active; \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_name = { \ .rpm_res_type = (type), \
@@ -42,7 +42,7 @@ .active_only = true, \ .rpm_key = (key), \ .peer = &clk_smd_rpm_##_prefix##_name, \ - .rate = INT_MAX, \ + .rate = (ao_rate), \ .hw.init = &(struct clk_init_data ){ \ .ops = &clk_smd_rpm_ops, \ .name = #_active, \
@@ -51,12 +51,14 @@ .name = "xo_board", \ }, \ .num_parents = 1, \ + .flags = (ao_flags), \ }, \ } -#define __DEFINE_CLK_SMD_RPM(_name, _active, type, r_id, key) \ +#define __DEFINE_CLK_SMD_RPM(_name, _active, type, r_id, key,\ + ao_rate, ao_flags) \ __DEFINE_CLK_SMD_RPM_PREFIX(/* empty */, _name, _active, \ - type, r_id, key) + type, r_id, key, ao_rate, ao_flags)#define __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX (_prefix, _name, _active,\ type, r_id, r, key, ao_flags) \
@@ -104,17 +106,22 @@#define DEFINE_CLK_SMD_RPM (_name, type, r_id) \ __DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \ - type, r_id, QCOM_RPM_SMD_KEY_RATE) + type, r_id, QCOM_RPM_SMD_KEY_RATE, INT_MAX, 0)#define DEFINE_CLK_SMD_RPM_BUS (_name, r_id) \ __DEFINE_CLK_SMD_RPM_PREFIX(bus_##r_id##_, \ _name##_clk, _name##_a_clk, QCOM_SMD_RPM_BUS_CLK, r_id, \ - QCOM_RPM_SMD_KEY_RATE) + QCOM_RPM_SMD_KEY_RATE, INT_MAX, 0) + +#define DEFINE_CLK_SMD_RPM_BUS_A (_name, r_id, ao_rate, ao_flags) \ + __DEFINE_CLK_SMD_RPM_PREFIX(bus_##r_id##_, \ + _name##_clk, _name##_a_clk, QCOM_SMD_RPM_BUS_CLK, r_id, \ + QCOM_RPM_SMD_KEY_RATE, ao_rate, ao_flags)#define DEFINE_CLK_SMD_RPM_CLK_SRC (_name, type, r_id) \ __DEFINE_CLK_SMD_RPM( \ _name##_clk_src, _name##_a_clk_src, \ - type, r_id, QCOM_RPM_SMD_KEY_RATE) + type, r_id, QCOM_RPM_SMD_KEY_RATE, INT_MAX, 0)#define DEFINE_CLK_SMD_RPM_BRANCH (_name, type, r_id, r) \ __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(branch_, \
@@ -128,7 +135,7 @@#define DEFINE_CLK_SMD_RPM_QDSS (_name, type, r_id) \ __DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \ - type, r_id, QCOM_RPM_SMD_KEY_STATE) + type, r_id, QCOM_RPM_SMD_KEY_STATE, INT_MAX, 0)#define DEFINE_CLK_SMD_RPM_XO_BUFFER (_name, r_id, r) \ __DEFINE_CLK_SMD_RPM_BRANCH(_name, _name##_a, \
Signature · 1 line
2.41.0
PATCH 2/2 clk: qcom: smd-rpm: Set XO rate and CLK_IS_CRITICAL on PCNoC
In reply to Konrad DybcioOn all supported SoCs to date, the PCNoC (a.k.a CNoC_PERIPH) clock must be always-on as long as the APSS is online and only has to run at 19.2 MHz. Define it to be as such in the ACTIVE domain.
Some SoCs use that clock for bus scaling, while others just need it for reaching the hardware. This commit will hurt neither.
--- drivers/clk/qcom/clk-smd-rpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-smd-rpm.c +1 -1
@@ -455,7 +455,7 @@ DEFINE_CLK_SMD_RPM_BRANCH(aggre2_noc, QCOM_SMD_RPM_AGGR_CLK, 2, 1000);DEFINE_CLK_SMD_RPM (aggre1_noc,QCOM_SMD_RPM_AGGR_CLK ,1 );DEFINE_CLK_SMD_RPM (aggre2_noc,QCOM_SMD_RPM_AGGR_CLK ,2 ); -DEFINE_CLK_SMD_RPM_BUS (pcnoc,0 ); +DEFINE_CLK_SMD_RPM_BUS_A (pcnoc,0 ,19200000 ,CLK_IS_CRITICAL );DEFINE_CLK_SMD_RPM_BUS (snoc,1 );DEFINE_CLK_SMD_RPM_BUS (sysmmnoc,2 );DEFINE_CLK_SMD_RPM_BUS (cnoc,2 );
Signature · 1 line
2.41.0