summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2019-06-19 11:29:22 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-19 20:29:15 +0200
commit538eca25ff8f844c8c8f9c2f2e39f1fdb996f4aa (patch)
treec034209ffb18fe85f642b99d7c7a592376aedd5b
parent18e46e1109b41a89ef8ea1a9d4b8164c428b5a3b (diff)
downloadlinux-538eca25ff8f844c8c8f9c2f2e39f1fdb996f4aa.tar.gz
linux-538eca25ff8f844c8c8f9c2f2e39f1fdb996f4aa.tar.bz2
linux-538eca25ff8f844c8c8f9c2f2e39f1fdb996f4aa.zip
coresight: tmc-etr: Rearrange probing default buffer size
As we are about to refactor the platform specific handling, make the default buffer size probing generic. Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/hwtracing/coresight/coresight-tmc.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
index 3b39f43c583d..9c5e615c1486 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.c
+++ b/drivers/hwtracing/coresight/coresight-tmc.c
@@ -378,6 +378,15 @@ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps)
return rc;
}
+static u32 tmc_etr_get_default_buffer_size(struct device *dev)
+{
+ u32 size;
+
+ if (fwnode_property_read_u32(dev->fwnode, "arm,buffer-size", &size))
+ size = SZ_1M;
+ return size;
+}
+
static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
{
int ret = 0;
@@ -423,16 +432,10 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
/* This device is not associated with a session */
drvdata->pid = -1;
- if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) {
- if (np)
- ret = of_property_read_u32(np,
- "arm,buffer-size",
- &drvdata->size);
- if (ret)
- drvdata->size = SZ_1M;
- } else {
+ if (drvdata->config_type == TMC_CONFIG_TYPE_ETR)
+ drvdata->size = tmc_etr_get_default_buffer_size(dev);
+ else
drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4;
- }
desc.pdata = pdata;
desc.dev = dev;