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

Commit c15fe981 authored by Amey Telawane's avatar Amey Telawane
Browse files

jtag-fuse: add jtag-fuse support for etm save restore



Values stored in etm are lost across power collapse.
Enable the jtag fuses properly that helps in proper
selection of ETM register save/restore.

CRs-fixed: 1056777
Change-Id: I1cbc343ab33a8e639c4aedf0c5e0323f5730a13f
Signed-off-by: default avatarAmey Telawane <ameyt@codeaurora.org>
parent c0a8f9e8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ compatible: component name used for driver matching, should be one of the
	"qcom,jtag-fuse" for jtag fuse device
	"qcom,jtag-fuse-v2" for jtag fuse v2 device
	"qcom,jtag-fuse-v3" for jtag fuse v3 device
	"qcom,jtag-fuse-v4" for jtag fuse v4 device
reg: physical base address and length of the register set
reg-names: should be "fuse-base"

+27 −1
Original line number Diff line number Diff line
@@ -53,15 +53,25 @@
#define APPS_SPNIDEN_DISABLE_V3	BIT(31)
#define DAP_DEVICEEN_DISABLE_V3	BIT(7)

/* JTAG FUSE V4 */
#define ALL_DEBUG_DISABLE_V4		BIT(29)
#define APPS_DBGEN_DISABLE_V4		BIT(4)
#define APPS_NIDEN_DISABLE_V4		BIT(15)
#define APPS_SPIDEN_DISABLE_V4		BIT(28)
#define APPS_SPNIDEN_DISABLE_V4		BIT(23)
#define DAP_DEVICEEN_DISABLE_V4		BIT(3)

#define JTAG_FUSE_VERSION_V1		"qcom,jtag-fuse"
#define JTAG_FUSE_VERSION_V2		"qcom,jtag-fuse-v2"
#define JTAG_FUSE_VERSION_V3		"qcom,jtag-fuse-v3"
#define JTAG_FUSE_VERSION_V4		"qcom,jtag-fuse-v4"

struct fuse_drvdata {
	void __iomem		*base;
	struct device		*dev;
	bool			fuse_v2;
	bool			fuse_v3;
	bool			fuse_v4;
};

static struct fuse_drvdata *fusedrvdata;
@@ -87,7 +97,20 @@ bool msm_jtag_fuse_apps_access_disabled(void)
		       (unsigned long)config2);
	}

	if (drvdata->fuse_v3) {
	if (drvdata->fuse_v4) {
		if (config0 & ALL_DEBUG_DISABLE_V4)
			ret = true;
		else if (config1 & APPS_DBGEN_DISABLE_V4)
			ret = true;
		else if (config1 & APPS_NIDEN_DISABLE_V4)
			ret = true;
		else if (config1 & APPS_SPIDEN_DISABLE_V4)
			ret = true;
		else if (config1 & APPS_SPNIDEN_DISABLE_V4)
			ret = true;
		else if (config1 & DAP_DEVICEEN_DISABLE_V4)
			ret = true;
	} else if (drvdata->fuse_v3) {
		if (config0 & ALL_DEBUG_DISABLE_V3)
			ret = true;
		else if (config1 & APPS_DBGEN_DISABLE_V3)
@@ -139,6 +162,7 @@ static const struct of_device_id jtag_fuse_match[] = {
	{.compatible = JTAG_FUSE_VERSION_V1 },
	{.compatible = JTAG_FUSE_VERSION_V2 },
	{.compatible = JTAG_FUSE_VERSION_V3 },
	{.compatible = JTAG_FUSE_VERSION_V4 },
	{}
};

@@ -163,6 +187,8 @@ static int jtag_fuse_probe(struct platform_device *pdev)
		drvdata->fuse_v2 = true;
	else if (!strcmp(match->compatible, JTAG_FUSE_VERSION_V3))
		drvdata->fuse_v3 = true;
	else if (!strcmp(match->compatible, JTAG_FUSE_VERSION_V4))
		drvdata->fuse_v4 = true;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fuse-base");
	if (!res)