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

Commit 74c94a90 authored by Taniya Das's avatar Taniya Das Committed by Gerrit - the friendly Code Review server
Browse files

clk: qcom: clock-a7: Add support to read efuse for MSM8916



Efuse bits have been modified for msm8916. Read
the efuse bits and identify the parts.

Change-Id: I8a2246754a9016dad6e7af69c1ef41ceeb25af83
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent 90f1b5b9
Loading
Loading
Loading
Loading
+41 −1
Original line number Diff line number Diff line
@@ -153,6 +153,39 @@ static void get_speed_bin(struct platform_device *pdev, int *bin, int *version)
	return;
}

static void get_speed_bin_b(struct platform_device *pdev, int *bin,
								int *version)
{
	struct resource *res;
	void __iomem *base;
	u32 pte_efuse;

	*bin = 0;
	*version = 0;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "efuse");
	if (!res) {
		dev_info(&pdev->dev,
			 "No speed/PVS binning available. Defaulting to 0!\n");
		return;
	}

	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
	if (!base) {
		dev_warn(&pdev->dev,
			 "Unable to read efuse data. Defaulting to 0!\n");
		return;
	}

	pte_efuse = readl_relaxed(base);
	devm_iounmap(&pdev->dev, base);

	*bin = (pte_efuse >> 2) & 0x7;

	dev_info(&pdev->dev, "Speed bin: %d PVS Version: %d\n", *bin,
								*version);
}

static int of_get_clk_src(struct platform_device *pdev, struct clk_src *parents)
{
	struct device_node *of = pdev->dev.of_node;
@@ -195,6 +228,10 @@ static int clock_a7_probe(struct platform_device *pdev)
	struct clk *aux_clk, *main_pll;
	char prop_name[] = "qcom,speedX-bin-vX";
	const void *prop;
	bool compat_bin = false;

	compat_bin = of_device_is_compatible(pdev->dev.of_node,
						"qcom,clock-a53-8916");

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rcg-base");
	if (!res) {
@@ -225,6 +262,9 @@ static int clock_a7_probe(struct platform_device *pdev)
	if (prop)
		a7ssmux.safe_freq = of_read_ulong(prop, 1);

	if (compat_bin)
		get_speed_bin_b(pdev, &speed_bin, &version);
	else
		get_speed_bin(pdev, &speed_bin, &version);

	snprintf(prop_name, ARRAY_SIZE(prop_name),