coresight: stm: Extract device name from AMBA pid based table lookup

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
Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20240314055843.2625883-3-anshuman.khandual@arm.com
This commit is contained in:
Anshuman Khandual 2024-03-14 11:28:34 +05:30 committed by Suzuki K Poulose
parent caa41c47da
commit 852e9a3205
2 changed files with 21 additions and 1 deletions

View File

@ -222,6 +222,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 ((pid & table->mask) == table->id)
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);

View File

@ -800,6 +800,16 @@ static void stm_init_generic_data(struct stm_drvdata *drvdata,
drvdata->stm.set_options = stm_generic_set_options;
}
static const struct amba_id stm_ids[];
static char *stm_csdev_name(struct coresight_device *csdev)
{
u32 stm_pid = coresight_get_pid(&csdev->access);
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;
@ -896,7 +906,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: