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.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230731-topic-pcnoc-v1-1-452dd36d11d7@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
Konrad Dybcio 2023-07-31 14:20:12 +02:00 committed by Bjorn Andersson
parent a7bea084fb
commit 2db8dc7bf4

View File

@ -19,7 +19,7 @@
#include <dt-bindings/clock/qcom,rpmcc.h> #include <dt-bindings/clock/qcom,rpmcc.h>
#define __DEFINE_CLK_SMD_RPM_PREFIX(_prefix, _name, _active, \ #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##_active; \
static struct clk_smd_rpm clk_smd_rpm_##_prefix##_name = { \ static struct clk_smd_rpm clk_smd_rpm_##_prefix##_name = { \
.rpm_res_type = (type), \ .rpm_res_type = (type), \
@ -43,7 +43,7 @@
.active_only = true, \ .active_only = true, \
.rpm_key = (key), \ .rpm_key = (key), \
.peer = &clk_smd_rpm_##_prefix##_name, \ .peer = &clk_smd_rpm_##_prefix##_name, \
.rate = INT_MAX, \ .rate = (ao_rate), \
.hw.init = &(struct clk_init_data){ \ .hw.init = &(struct clk_init_data){ \
.ops = &clk_smd_rpm_ops, \ .ops = &clk_smd_rpm_ops, \
.name = #_active, \ .name = #_active, \
@ -52,12 +52,14 @@
.name = "xo_board", \ .name = "xo_board", \
}, \ }, \
.num_parents = 1, \ .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, \ __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,\ #define __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(_prefix, _name, _active,\
type, r_id, r, key, ao_flags) \ type, r_id, r, key, ao_flags) \
@ -105,17 +107,22 @@
#define DEFINE_CLK_SMD_RPM(_name, type, r_id) \ #define DEFINE_CLK_SMD_RPM(_name, type, r_id) \
__DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \ __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 DEFINE_CLK_SMD_RPM_BUS(_name, r_id) \
__DEFINE_CLK_SMD_RPM_PREFIX(bus_##r_id##_, \ __DEFINE_CLK_SMD_RPM_PREFIX(bus_##r_id##_, \
_name##_clk, _name##_a_clk, QCOM_SMD_RPM_BUS_CLK, 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 DEFINE_CLK_SMD_RPM_CLK_SRC(_name, type, r_id) \
__DEFINE_CLK_SMD_RPM( \ __DEFINE_CLK_SMD_RPM( \
_name##_clk_src, _name##_a_clk_src, \ _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 DEFINE_CLK_SMD_RPM_BRANCH(_name, type, r_id, r) \
__DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(branch_, \ __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(branch_, \
@ -129,7 +136,7 @@
#define DEFINE_CLK_SMD_RPM_QDSS(_name, type, r_id) \ #define DEFINE_CLK_SMD_RPM_QDSS(_name, type, r_id) \
__DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \ __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 DEFINE_CLK_SMD_RPM_XO_BUFFER(_name, r_id, r) \
__DEFINE_CLK_SMD_RPM_BRANCH(_name, _name##_a, \ __DEFINE_CLK_SMD_RPM_BRANCH(_name, _name##_a, \