From: Songwei Chai <songwei.chai@oss.qualcomm.com>
To: andersson@kernel.org, alexander.shishkin@linux.intel.com,
mike.leach@linaro.org, konrad.dybcio@oss.qualcomm.com,
suzuki.poulose@arm.com, james.clark@arm.com, krzk+dt@kernel.org,
conor+dt@kernel.org
Cc: Songwei Chai <songwei.chai@oss.qualcomm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, coresight@lists.linaro.org,
devicetree@vger.kernel.org, gregkh@linuxfoundation.org,
songchai@qti.qualcomm.com
Subject: [PATCH v17 02/10] coresight: Move CS_LOCK/CS_UNLOCK to linux/coresight.h
Date: Fri, 13 Nov 2026 10:49:27 +0800 [thread overview]
Message-ID: <20261113024935.3173715-3-songwei.chai@oss.qualcomm.com> (raw)
In-Reply-To: <20261113024935.3173715-1-songwei.chai@oss.qualcomm.com>
CORESIGHT_LAR and the CS_LOCK()/CS_UNLOCK() helpers implement the
generic ARM CoreSight Software Lock Access Register sequence, which
is also present on non-CoreSight-labelled components that follow the
same architecture (e.g. the Qualcomm TGU). Keeping them private to
coresight-priv.h forces such drivers to duplicate the exact same
definitions instead of reusing them.
Move CORESIGHT_LAR, CS_LOCK() and CS_UNLOCK() into the public
include/linux/coresight.h so they can be shared outside of
drivers/hwtracing/coresight/ as well.
Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Songwei Chai <songwei.chai@oss.qualcomm.com>
---
drivers/hwtracing/coresight/coresight-priv.h | 19 -------------------
include/linux/coresight.h | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
index dddac946659f..0d3f6229b282 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -23,7 +23,6 @@ extern const struct device_type coresight_dev_type[];
#define CORESIGHT_ITCTRL 0xf00
#define CORESIGHT_CLAIMSET 0xfa0
#define CORESIGHT_CLAIMCLR 0xfa4
-#define CORESIGHT_LAR 0xfb0
#define CORESIGHT_LSR 0xfb4
#define CORESIGHT_DEVARCH 0xfbc
#define CORESIGHT_AUTHSTATUS 0xfb8
@@ -116,24 +115,6 @@ static inline void coresight_insert_barrier_packet(void *buf)
memcpy(buf, coresight_barrier_pkt, CORESIGHT_BARRIER_PKT_SIZE);
}
-static inline void CS_LOCK(void __iomem *addr)
-{
- do {
- /* Wait for things to settle */
- mb();
- writel_relaxed(0x0, addr + CORESIGHT_LAR);
- } while (0);
-}
-
-static inline void CS_UNLOCK(void __iomem *addr)
-{
- do {
- writel_relaxed(CORESIGHT_UNLOCK, addr + CORESIGHT_LAR);
- /* Make sure everyone has seen this */
- mb();
- } while (0);
-}
-
void coresight_disable_path(struct coresight_path *path);
int coresight_enable_path(struct coresight_path *path, enum cs_mode mode);
struct coresight_device *coresight_get_sink(struct coresight_path *path);
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index edf2a2fc697c..0168f6abffaf 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -35,6 +35,25 @@
#define PFT_ARCH_V1_1 0x31
#define CORESIGHT_UNLOCK 0xc5acce55
+#define CORESIGHT_LAR 0xfb0
+
+static inline void CS_LOCK(void __iomem *addr)
+{
+ do {
+ /* Wait for things to settle */
+ mb();
+ writel_relaxed(0x0, addr + CORESIGHT_LAR);
+ } while (0);
+}
+
+static inline void CS_UNLOCK(void __iomem *addr)
+{
+ do {
+ writel_relaxed(CORESIGHT_UNLOCK, addr + CORESIGHT_LAR);
+ /* Make sure everyone has seen this */
+ mb();
+ } while (0);
+}
extern const struct bus_type coresight_bustype;
--
2.34.1
next prev parent reply other threads:[~2026-11-13 2:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 2:49 [PATCH v17 00/10] Provide support for Trigger Generation Unit Songwei Chai
2026-11-13 2:49 ` [PATCH v17 01/10] dt-bindings: arm: Add support for Qualcomm TGU trace Songwei Chai
2026-11-13 2:49 ` Songwei Chai [this message]
2026-11-13 10:25 ` [PATCH v17 02/10] coresight: Move CS_LOCK/CS_UNLOCK to linux/coresight.h Suzuki K Poulose
2026-11-16 6:52 ` Songwei.Chai
2026-11-13 2:49 ` [PATCH v17 03/10] qcom-tgu: Add TGU driver Songwei Chai
2026-11-13 10:34 ` Suzuki K Poulose
2026-11-16 6:53 ` Songwei.Chai
2026-11-13 2:49 ` [PATCH v17 04/10] coresight: Move CORESIGHT_DEVID to linux/coresight.h Songwei Chai
2026-11-13 2:49 ` [PATCH v17 05/10] qcom-tgu: Add signal priority support Songwei Chai
2026-11-13 2:49 ` [PATCH v17 06/10] qcom-tgu: Add TGU decode support Songwei Chai
2026-11-13 2:49 ` [PATCH v17 07/10] qcom-tgu: Add support to configure next action Songwei Chai
2026-11-13 2:49 ` [PATCH v17 08/10] coresight: Add CORESIGHT_DEVID2 to linux/coresight.h Songwei Chai
2026-11-13 10:27 ` Suzuki K Poulose
2026-11-16 6:54 ` Songwei.Chai
2026-11-13 2:49 ` [PATCH v17 09/10] qcom-tgu: Add timer/counter functionality for TGU Songwei Chai
2026-11-13 2:49 ` [PATCH v17 10/10] qcom-tgu: Add reset node to initialize Songwei Chai
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=20261113024935.3173715-3-songwei.chai@oss.qualcomm.com \
--to=songwei.chai@oss.qualcomm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=coresight@lists.linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.clark@arm.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=songchai@qti.qualcomm.com \
--cc=suzuki.poulose@arm.com \
/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
all inboxes | Powered by JetHome®