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

Commit d5f0adb6 authored by Xiaogang Cui's avatar Xiaogang Cui Committed by Gerrit - the friendly Code Review server
Browse files

coresight: add support to force dump tmc registers during tmc_enable



Add boolean property to force dump TMC registers during tmc_enable().
This is required for cases where TMC registers are not retained across
watchdog reset workflows.

Change-Id: I08c54f8b0b747436dec488e9421e08684f602c26
Signed-off-by: default avatarXiaogang Cui <xiaogang@codeaurora.org>
parent 819f45d3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@ Optional properties:
		    interrupts specified in the 'interrupts' property.
- qcom,sg-enable : indicates whether scatter gather feature is supported for TMC
		   ETR configuration.
- qcom,force-reg-dump : boolean, indicate whether TMC register need to be dumped.
			Used for TMC component
- qcom,nidntsw : boolean, indicating NIDnT software debug or trace support
		 present. Used for tpiu component
- qcom,nidnthw : boolean, indicating NIDnT hardware sensing support present.
+15 −1
Original line number Diff line number Diff line
@@ -206,6 +206,8 @@ struct tmc_drvdata {
	char			*byte_cntr_node;
	uint32_t		mem_size;
	bool			sticky_enable;
	bool			force_reg_dump;
	bool			dump_reg;
	bool			sg_enable;
	enum tmc_etr_mem_type	mem_type;
	enum tmc_etr_mem_type	memtype;
@@ -215,6 +217,7 @@ struct tmc_drvdata {
	struct notifier_block	jtag_save_blk;
};

static void __tmc_reg_dump(struct tmc_drvdata *drvdata);
static void tmc_wait_for_flush(struct tmc_drvdata *drvdata)
{
	int count;
@@ -909,6 +912,11 @@ static int tmc_enable(struct tmc_drvdata *drvdata, enum tmc_mode mode)
			__tmc_etf_enable(drvdata);
	}
	drvdata->enable = true;
	if (drvdata->force_reg_dump) {
		drvdata->dump_reg = true;
		__tmc_reg_dump(drvdata);
		drvdata->dump_reg = false;
	}

	/*
	 * sticky_enable prevents users from reading tmc dev node before
@@ -951,7 +959,9 @@ static void __tmc_reg_dump(struct tmc_drvdata *drvdata)
	char *reg_hdr;
	uint32_t *reg_buf;

	if (!drvdata->reg_buf || !drvdata->aborting)
	if (!drvdata->reg_buf)
		return;
	else if (!drvdata->aborting && !drvdata->dump_reg)
		return;

	reg_hdr = drvdata->reg_buf - PAGE_SIZE;
@@ -2379,6 +2389,10 @@ static int tmc_probe(struct platform_device *pdev)
	if (ret)
		return ret;

	drvdata->force_reg_dump = of_property_read_bool
				  (pdev->dev.of_node,
				  "qcom,force-reg-dump");

	devid = tmc_readl(drvdata, CORESIGHT_DEVID);
	drvdata->config_type = BMVAL(devid, 6, 7);