Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Mike Leach <mike.leach@linaro.org>,
	James Clark <james.clark@arm.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	coresight@lists.linaro.org,
	linux-stm32@st-md-mailman.stormreply.com
Subject: [PATCH V4 02/11] coresight: stm: Extract device name from AMBA pid based table lookup
Date: Tue, 23 Jan 2024 11:15:59 +0530	[thread overview]
Message-ID: <20240123054608.1790189-3-anshuman.khandual@arm.com> (raw)
In-Reply-To: <20240123054608.1790189-1-anshuman.khandual@arm.com>

Instead of using AMBA private data field, extract the device name from AMBA
pid based table lookup using new coresight_get_uci_data_from_amba() helper.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: James Clark <james.clark@arm.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 drivers/hwtracing/coresight/coresight-priv.h | 10 ++++++++++
 drivers/hwtracing/coresight/coresight-stm.c  | 14 +++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
index 767076e07970..68cbb036cec8 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -221,6 +221,16 @@ static inline void *coresight_get_uci_data(const struct amba_id *id)
 	return uci_id->data;
 }
 
+static inline void *coresight_get_uci_data_from_amba(const struct amba_id *table, u32 pid)
+{
+	while (table->mask) {
+		if ((table->id & table->mask) == pid)
+			return coresight_get_uci_data(table);
+		table++;
+	};
+	return NULL;
+}
+
 void coresight_release_platform_data(struct coresight_device *csdev,
 				     struct device *dev,
 				     struct coresight_platform_data *pdata);
diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index a1c27c901ad1..9cdca4f86cab 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -804,6 +804,18 @@ static void stm_init_generic_data(struct stm_drvdata *drvdata,
 	drvdata->stm.set_options = stm_generic_set_options;
 }
 
+#define STM_AMBA_MASK 0xfffff
+
+static const struct amba_id stm_ids[];
+
+static char *stm_csdev_name(struct coresight_device *csdev)
+{
+	u32 stm_pid = coresight_get_pid(&csdev->access) & STM_AMBA_MASK;
+	void *uci_data = coresight_get_uci_data_from_amba(stm_ids, stm_pid);
+
+	return uci_data ? (char *)uci_data : "STM";
+}
+
 static int stm_probe(struct amba_device *adev, const struct amba_id *id)
 {
 	int ret, trace_id;
@@ -900,7 +912,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
 	pm_runtime_put(&adev->dev);
 
 	dev_info(&drvdata->csdev->dev, "%s initialized\n",
-		 (char *)coresight_get_uci_data(id));
+		 stm_csdev_name(drvdata->csdev));
 	return 0;
 
 cs_unregister:
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-01-23  5:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23  5:45 [PATCH V4 00/11] coresight: Move remaining AMBA ACPI devices into platform driver Anshuman Khandual
2024-01-23  5:45 ` [PATCH V4 01/11] coresight: etm4x: Fix unbalanced pm_runtime_enable() Anshuman Khandual
2024-02-15 11:04   ` Suzuki K Poulose
2024-02-22  4:45     ` Anshuman Khandual
2024-01-23  5:45 ` Anshuman Khandual [this message]
2024-02-15 10:55   ` [PATCH V4 02/11] coresight: stm: Extract device name from AMBA pid based table lookup Suzuki K Poulose
2024-02-22  5:33     ` Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 03/11] coresight: tmc: Extract device properties " Anshuman Khandual
2024-02-12 12:13   ` Suzuki K Poulose
2024-02-13  3:13     ` Anshuman Khandual
2024-02-13 10:32       ` Suzuki K Poulose
2024-02-14  3:35         ` Anshuman Khandual
2024-02-14 10:16           ` Suzuki K Poulose
2024-01-23  5:46 ` [PATCH V4 04/11] coresight: Add helpers registering/removing both AMBA and platform drivers Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 05/11] coresight: replicator: Move ACPI support from AMBA driver to platform driver Anshuman Khandual
2024-02-15 11:23   ` Suzuki K Poulose
2024-02-15 11:25     ` Suzuki K Poulose
2024-02-19  2:52       ` Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 06/11] coresight: funnel: " Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 07/11] coresight: catu: " Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 08/11] coresight: tpiu: " Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 09/11] coresight: tmc: " Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 10/11] coresight: stm: " Anshuman Khandual
2024-01-23  5:46 ` [PATCH V4 11/11] coresight: debug: " Anshuman Khandual
2024-02-12 12:02 ` [PATCH V4 00/11] coresight: Move remaining AMBA ACPI devices into " James Clark

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=20240123054608.1790189-3-anshuman.khandual@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@arm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=lpieralisi@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mike.leach@linaro.org \
    --cc=sudeep.holla@arm.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