devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Melody Olvera <quic_molvera@quicinc.com>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Marc Zyngier <maz@kernel.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-clk@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Imran Shaik <quic_imrashai@quicinc.com>,
	Melody Olvera <quic_molvera@quicinc.com>
Subject: [PATCH v2 3/6] clk: qcom: branch: Add BRANCH_HALT_INVERT flag support for branch clocks
Date: Fri, 14 Oct 2022 15:10:08 -0700	[thread overview]
Message-ID: <20221014221011.7360-4-quic_molvera@quicinc.com> (raw)
In-Reply-To: <20221014221011.7360-1-quic_molvera@quicinc.com>

From: Imran Shaik <quic_imrashai@quicinc.com>

Add the BRANCH_HALT_INVERT flag to handle the inverted status bit check
for branch clocks. Invert branch halt would indicate the clock ON when
CLK_OFF bit is '1' and OFF when CLK_OFF bit is '0'.

Signed-off-by: Imran Shaik <quic_imrashai@quicinc.com>
Signed-off-by: Melody Olvera <quic_molvera@quicinc.com>
---
 drivers/clk/qcom/clk-branch.c | 5 +++++
 drivers/clk/qcom/clk-branch.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/clk/qcom/clk-branch.c b/drivers/clk/qcom/clk-branch.c
index f869fc6aaed6..b5dc1f4ef277 100644
--- a/drivers/clk/qcom/clk-branch.c
+++ b/drivers/clk/qcom/clk-branch.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/kernel.h>
@@ -56,6 +57,10 @@ static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling)
 
 	if (enabling) {
 		val &= mask;
+
+		if (br->halt_check == BRANCH_HALT_INVERT)
+			return (val & BRANCH_CLK_OFF) == BRANCH_CLK_OFF;
+
 		return (val & BRANCH_CLK_OFF) == 0 ||
 			val == BRANCH_NOC_FSM_STATUS_ON;
 	} else {
diff --git a/drivers/clk/qcom/clk-branch.h b/drivers/clk/qcom/clk-branch.h
index 17a58119165e..4ac1debeb91e 100644
--- a/drivers/clk/qcom/clk-branch.h
+++ b/drivers/clk/qcom/clk-branch.h
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Copyright (c) 2013, The Linux Foundation. All rights reserved. */
+/* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. */
 
 #ifndef __QCOM_CLK_BRANCH_H__
 #define __QCOM_CLK_BRANCH_H__
@@ -33,6 +34,7 @@ struct clk_branch {
 #define BRANCH_HALT_ENABLE_VOTED	(BRANCH_HALT_ENABLE | BRANCH_VOTED)
 #define BRANCH_HALT_DELAY		2 /* No bit to check; just delay */
 #define BRANCH_HALT_SKIP		3 /* Don't check halt bit */
+#define BRANCH_HALT_INVERT		4 /* Invert logic for halt bit */
 
 	struct clk_regmap clkr;
 };
-- 
2.38.0


  parent reply	other threads:[~2022-10-14 22:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 22:10 [PATCH v2 0/6] clk: qcom: Add clocks for the QDU1000 and QRU1000 SoCs Melody Olvera
2022-10-14 22:10 ` [PATCH v2 1/6] dt-bindings: clock: Add QDU1000 and QRU1000 GCC clock bindings Melody Olvera
2022-10-15 15:02   ` Krzysztof Kozlowski
2022-10-14 22:10 ` [PATCH v2 2/6] dt-bindings: clock: Add RPMHCC bindings for QDU1000 and QRU1000 Melody Olvera
2022-10-15 15:15   ` Krzysztof Kozlowski
2022-10-14 22:10 ` Melody Olvera [this message]
2022-10-15  0:20   ` [PATCH v2 3/6] clk: qcom: branch: Add BRANCH_HALT_INVERT flag support for branch clocks Stephen Boyd
2022-10-19 23:49     ` Melody Olvera
2022-10-14 22:10 ` [PATCH v2 4/6] clk: qcom: Add QDU1000 and QRU1000 GCC support Melody Olvera
2022-10-14 22:10 ` [PATCH v2 5/6] clk: qcom: Add support for QDU1000 and QRU1000 RPMh clocks Melody Olvera
2022-10-14 22:10 ` [PATCH v2 6/6] dt-bindings: qcom,pdc: Introduce pdc bindings for QDU1000 and QRU1000 Melody Olvera
2022-10-15 15:03   ` Krzysztof Kozlowski
2022-10-15 15:14   ` Krzysztof Kozlowski
2022-10-14 23:53 ` [PATCH v2 0/6] clk: qcom: Add clocks for the QDU1000 and QRU1000 SoCs Melody Olvera
2022-10-15 15:03   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221014221011.7360-4-quic_molvera@quicinc.com \
    --to=quic_molvera@quicinc.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=quic_imrashai@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).