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

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

cpufreq: qcom-hw: Add support for EPSS CPUFREQ firmware



This is in preparation for updating the current driver to the upstreamed
code. Add support to take care of EPSS firmware related code.

Change-Id: I4bd4165a8457dcaedc26d3bc8704db0c886832ed
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent f536145e
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#define LUT_MAX_ENTRIES			40U
#define CORE_COUNT_VAL(val)		(((val) & (GENMASK(18, 16))) >> 16)
#define LUT_ROW_SIZE			4
#define LUT_ROW_SIZE			32
#define CLK_HW_DIV			2
#define CYCLE_CNTR_OFFSET(c, m)		((c - cpumask_first(m) + 1) * 4)

@@ -30,6 +30,8 @@ enum {
	REG_ARRAY_SIZE,
};

static unsigned int lut_row_size = LUT_ROW_SIZE;

struct cpufreq_qcom {
	struct cpufreq_frequency_table *table;
	void __iomem *reg_bases[REG_ARRAY_SIZE];
@@ -342,6 +344,15 @@ static int qcom_cpu_resources_init(struct platform_device *pdev,
	for (i = REG_ENABLE; i < REG_ARRAY_SIZE; i++)
		c->reg_bases[i] = base + offsets[i];

	if (!of_property_read_bool(dev->of_node, "qcom,skip-enable-check")) {
		/* HW should be in enabled state to proceed */
		if (!(readl_relaxed(c->reg_bases[REG_ENABLE]) & 0x1)) {
			dev_err(dev, "Domain-%d cpufreq hardware not enabled\n",
				 index);
			return -ENODEV;
		}
	}

	ret = qcom_get_related_cpus(index, &c->related_cpus);
	if (ret) {
		dev_err(dev, "Domain-%d failed to get related CPUs\n", index);
@@ -384,7 +395,7 @@ static int qcom_resources_init(struct platform_device *pdev)

	devm_clk_put(&pdev->dev, clk);

	clk = devm_clk_get(&pdev->dev, "cpu_clk");
	clk = devm_clk_get(&pdev->dev, "alternate");
	if (IS_ERR(clk))
		return PTR_ERR(clk);

@@ -392,6 +403,9 @@ static int qcom_resources_init(struct platform_device *pdev)

	devm_clk_put(&pdev->dev, clk);

	of_property_read_u32(pdev->dev.of_node, "qcom,lut-row-size",
			      &lut_row_size);

	for_each_possible_cpu(cpu) {
		cpu_np = of_cpu_device_node_get(cpu);
		if (!cpu_np) {
@@ -449,6 +463,8 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)

static const struct of_device_id qcom_cpufreq_hw_match[] = {
	{ .compatible = "qcom,cpufreq-hw", .data = &cpufreq_qcom_std_offsets },
	{ .compatible = "qcom,cpufreq-hw-epss",
					   .data = &cpufreq_qcom_std_offsets },
	{}
};