lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220726142303.4126434-6-abel.vesa@linaro.org>
Date:   Tue, 26 Jul 2022 17:22:59 +0300
From:   Abel Vesa <abel.vesa@...aro.org>
To:     Bjorn Andersson <bjorn.andersson@...aro.org>,
        Andy Gross <agross@...nel.org>,
        Konrad Dybcio <konrad.dybcio@...ainline.org>,
        Mike Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>
Cc:     linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Abel Vesa <abel.vesa@...aro.org>
Subject: [RFC 5/9] clk: qcom: branch: Add macros to collapse definition

Add macros for a visually more compact branch clocks definition,
one for the common branch and one for branch_aon. They differ
from ops point of view, like their name suggest. There are also
three different macros to define the clk.hw.init depending on the
number and type of parent passed on as argument. Also, the macros
added here are only the ones used by gcc-sdm845 driver.
More will be added later on.

Signed-off-by: Abel Vesa <abel.vesa@...aro.org>
---
 drivers/clk/qcom/clk-branch.h | 82 +++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/drivers/clk/qcom/clk-branch.h b/drivers/clk/qcom/clk-branch.h
index 17a58119165e..a12ffebf0e5f 100644
--- a/drivers/clk/qcom/clk-branch.h
+++ b/drivers/clk/qcom/clk-branch.h
@@ -37,6 +37,88 @@ struct clk_branch {
 	struct clk_regmap clkr;
 };
 
+#define INIT_QCOM_CC_CLKR_HW_2(_name, _flags, _ops, _fw_name)		\
+	{								\
+		.name = #_name,						\
+		.parent_data = &(const struct clk_parent_data) {	\
+			.fw_name = _fw_name,				\
+			.name = _fw_name,				\
+		},							\
+		.num_parents = 1,					\
+		.flags = _flags,					\
+		.ops = _ops,						\
+	}
+
+#define INIT_QCOM_CC_CLKR_HW_1(_name, _flags, _ops, _parent_hw)		\
+	{								\
+		.name = #_name,						\
+		.parent_data = &(const struct clk_parent_data) {	\
+			.hw = _parent_hw,				\
+		},							\
+		.num_parents = 1,					\
+		.flags = _flags,					\
+		.ops = _ops,						\
+	}
+
+#define INIT_QCOM_CC_CLKR_HW_0(_name, _flags, _ops, ...)		\
+	{								\
+		.name = #_name,						\
+		.flags = _flags,					\
+		.ops = _ops,						\
+	}
+
+#define INIT_QCOM_CC_CLKR(_num_parents, _enable_reg, _enable_mask,	\
+				_name, _flags, _ops, ...)		\
+	{								\
+		.enable_reg = _enable_reg,				\
+		.enable_mask = _enable_mask,				\
+		.hw.init = &(struct clk_init_data)		\
+			INIT_QCOM_CC_CLKR_HW_##_num_parents(_name,	\
+						_flags,			\
+						_ops, __VA_ARGS__),	\
+	}
+
+#define __DEFINE_QCOM_CC_CLK_BRANCH(_halt_check, _name, _num_parents,	\
+					_halt_reg,			\
+					_hwcg_reg, _hwcg_bit,		\
+					_enable_reg, _enable_mask,	\
+					_flags, _ops, ...)		\
+	static struct clk_branch _name = {				\
+		.halt_reg = _halt_reg,					\
+		.halt_check = BRANCH_##_halt_check,			\
+		.hwcg_reg = _hwcg_reg,					\
+		.hwcg_bit = _hwcg_bit,					\
+		.clkr = INIT_QCOM_CC_CLKR(_num_parents, _enable_reg,	\
+					_enable_mask,			\
+					_name, _flags,			\
+					_ops, __VA_ARGS__),		\
+	}
+
+#define DEFINE_QCOM_CC_CLK_BRANCH(_halt_check, _name, _num_parents,	\
+					_halt_reg,			\
+					_hwcg_reg, _hwcg_bit,		\
+					_enable_reg, _enable_mask,	\
+					_flags, ...)			\
+	__DEFINE_QCOM_CC_CLK_BRANCH(_halt_check, _name, _num_parents,	\
+					_halt_reg,			\
+					_hwcg_reg, _hwcg_bit,		\
+					_enable_reg, _enable_mask,	\
+					_flags,				\
+					&clk_branch2_ops, __VA_ARGS__)
+
+#define DEFINE_QCOM_CC_CLK_BRANCH_AON(_halt_check, _name, _num_parents,	\
+					_halt_reg,			\
+					_hwcg_reg, _hwcg_bit,		\
+					_enable_reg, _enable_mask,	\
+					_flags, ...)			\
+	__DEFINE_QCOM_CC_CLK_BRANCH(_halt_check, _name, _num_parents,	\
+					_halt_reg,			\
+					_hwcg_reg, _hwcg_bit,		\
+					_enable_reg, _enable_mask,	\
+					_flags,				\
+					&clk_branch2_aon_ops,		\
+					__VA_ARGS__)
+
 extern const struct clk_ops clk_branch_ops;
 extern const struct clk_ops clk_branch2_ops;
 extern const struct clk_ops clk_branch_simple_ops;
-- 
2.34.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ