Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bbf48dc authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "coresight: etm: Add check of trace unit power property"

parents ccc1223a 57fa8d11
Loading
Loading
Loading
Loading
+22 −11
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
// 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 <linux/kernel.h>
#include <linux/kernel.h>
@@ -20,6 +20,7 @@
#include <linux/cpu.h>
#include <linux/cpu.h>
#include <linux/coresight.h>
#include <linux/coresight.h>
#include <linux/coresight-pmu.h>
#include <linux/coresight-pmu.h>
#include <linux/of.h>
#include <linux/pm_wakeup.h>
#include <linux/pm_wakeup.h>
#include <linux/amba/bus.h>
#include <linux/amba/bus.h>
#include <linux/seq_file.h>
#include <linux/seq_file.h>
@@ -173,12 +174,14 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
	writel_relaxed(config->vmid_mask0, drvdata->base + TRCVMIDCCTLR0);
	writel_relaxed(config->vmid_mask0, drvdata->base + TRCVMIDCCTLR0);
	writel_relaxed(config->vmid_mask1, drvdata->base + TRCVMIDCCTLR1);
	writel_relaxed(config->vmid_mask1, drvdata->base + TRCVMIDCCTLR1);


	if (!drvdata->tupwr_disable) {
		/*
		/*
		 * Request to keep the trace unit powered and also
		 * Request to keep the trace unit powered and also
		 * emulation of powerdown
		 * emulation of powerdown
		 */
		 */
	writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR) | TRCPDCR_PU,
		writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR)
		       drvdata->base + TRCPDCR);
				| TRCPDCR_PU, drvdata->base + TRCPDCR);
	}


	/* Enable the trace unit */
	/* Enable the trace unit */
	writel_relaxed(1, drvdata->base + TRCPRGCTLR);
	writel_relaxed(1, drvdata->base + TRCPRGCTLR);
@@ -443,10 +446,12 @@ static void etm4_disable_hw(void *info)


	CS_UNLOCK(drvdata->base);
	CS_UNLOCK(drvdata->base);


	if (!drvdata->tupwr_disable) {
		/* power can be removed from the trace unit now */
		/* power can be removed from the trace unit now */
		control = readl_relaxed(drvdata->base + TRCPDCR);
		control = readl_relaxed(drvdata->base + TRCPDCR);
		control &= ~TRCPDCR_PU;
		control &= ~TRCPDCR_PU;
		writel_relaxed(control, drvdata->base + TRCPDCR);
		writel_relaxed(control, drvdata->base + TRCPDCR);
	}


	control = readl_relaxed(drvdata->base + TRCPRGCTLR);
	control = readl_relaxed(drvdata->base + TRCPRGCTLR);


@@ -1166,6 +1171,12 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
	dev_info(&drvdata->csdev->dev, "CPU%d: ETM v%d.%d initialized\n",
	dev_info(&drvdata->csdev->dev, "CPU%d: ETM v%d.%d initialized\n",
		 drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf);
		 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) {
	if (boot_enable) {
		coresight_enable(drvdata->csdev);
		coresight_enable(drvdata->csdev);
		drvdata->boot_enable = true;
		drvdata->boot_enable = true;
+3 −1
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/* SPDX-License-Identifier: GPL-2.0 */
/*
/*
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved.
 */
 */


#ifndef _CORESIGHT_CORESIGHT_ETM_H
#ifndef _CORESIGHT_CORESIGHT_ETM_H
@@ -335,6 +335,7 @@ struct etmv4_config {
 * @nooverflow:	Indicate if overflow prevention is supported.
 * @nooverflow:	Indicate if overflow prevention is supported.
 * @atbtrig:	If the implementation can support ATB triggers
 * @atbtrig:	If the implementation can support ATB triggers
 * @lpoverride:	If the implementation can support low-power state over.
 * @lpoverride:	If the implementation can support low-power state over.
 * @tupwr_disable:	If disable the support of keeping trace unit powered.
 * @config:	structure holding configuration parameters.
 * @config:	structure holding configuration parameters.
 */
 */
struct etmv4_drvdata {
struct etmv4_drvdata {
@@ -380,6 +381,7 @@ struct etmv4_drvdata {
	bool				nooverflow;
	bool				nooverflow;
	bool				atbtrig;
	bool				atbtrig;
	bool				lpoverride;
	bool				lpoverride;
	bool				tupwr_disable;
	struct etmv4_config		config;
	struct etmv4_config		config;
};
};