--- zzzz-none-000/linux-5.4.213/drivers/hwtracing/coresight/coresight-etm4x.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/drivers/hwtracing/coresight/coresight-etm4x.c 2024-05-29 11:19:51.000000000 +0000 @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * Copyright (c) 2014, 2018 The Linux Foundation. All rights reserved. */ #include @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -174,12 +175,14 @@ writel_relaxed(config->vmid_mask0, drvdata->base + TRCVMIDCCTLR0); writel_relaxed(config->vmid_mask1, drvdata->base + TRCVMIDCCTLR1); - /* - * Request to keep the trace unit powered and also - * emulation of powerdown - */ - writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR) | TRCPDCR_PU, - drvdata->base + TRCPDCR); + if (!drvdata->tupwr_disable) { + /* + * Request to keep the trace unit powered and also + * emulation of powerdown + */ + writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR) + | TRCPDCR_PU, drvdata->base + TRCPDCR); + } /* Enable the trace unit */ writel_relaxed(1, drvdata->base + TRCPRGCTLR); @@ -451,10 +454,12 @@ CS_UNLOCK(drvdata->base); - /* power can be removed from the trace unit now */ - control = readl_relaxed(drvdata->base + TRCPDCR); - control &= ~TRCPDCR_PU; - writel_relaxed(control, drvdata->base + TRCPDCR); + if (!drvdata->tupwr_disable) { + /* power can be removed from the trace unit now */ + control = readl_relaxed(drvdata->base + TRCPDCR); + control &= ~TRCPDCR_PU; + writel_relaxed(control, drvdata->base + TRCPDCR); + } control = readl_relaxed(drvdata->base + TRCPRGCTLR); @@ -674,8 +679,10 @@ else drvdata->sysstall = false; - /* NUMPROC, bits[30:28] the number of PEs available for tracing */ - drvdata->nr_pe = BMVAL(etmidr3, 28, 30); + /* NUMPROC, bits[13:12, 30:28] + * the number of PEs available for tracing + */ + drvdata->nr_pe = (BMVAL(etmidr3, 12, 13) << 3) | BMVAL(etmidr3, 28, 30); /* NOOVERFLOW, bit[31] is trace overflow prevention supported */ if (BMVAL(etmidr3, 31, 31)) @@ -1114,7 +1121,9 @@ if (drvdata->cpu < 0) return drvdata->cpu; - desc.name = devm_kasprintf(dev, GFP_KERNEL, "etm%d", drvdata->cpu); + if (of_property_read_string(dev->of_node, "coresight-name", &desc.name)) + desc.name = devm_kasprintf(dev, GFP_KERNEL, "etm%d", + drvdata->cpu); if (!desc.name) return -ENOMEM; @@ -1176,6 +1185,12 @@ dev_info(&drvdata->csdev->dev, "CPU%d: ETM v%d.%d initialized\n", drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf); + drvdata->tupwr_disable = of_property_read_bool(dev->of_node, + "qcom,tupwr-disable"); + + dev_info(dev, "CPU%d: %s initialized\n", + drvdata->cpu, (char *)id->data); + if (boot_enable) { coresight_enable(drvdata->csdev); drvdata->boot_enable = true;