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

Commit b07e0179 authored by Stephen Boyd's avatar Stephen Boyd Committed by Gerrit - the friendly Code Review server
Browse files

clk: qcom: Support 'protected-clocks' property



Certain firmware configurations "protect" clks and cause the entire
system to reboot when a non-secure OS such as Linux tries to read or
write protected clk registers. But other firmware configurations allow
reading or writing the same registers, and they may actually require
that the OS use the otherwise locked down clks. Support the
'protected-clocks' property by never registering these protected clks
with the common clk framework. This way, when firmware is protecting
these clks we won't have the chance to ever read or write these
registers and take down the entire system.

Change-Id: I3123ee6f8c3cf15d76cfbeeabdd3f2646e9433c8
Cc: Taniya Das <tdas@codeaurora.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Git-commit: b181b3b801da8893c8eb706e448dd5111b02de60
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent 74939878
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -201,6 +201,22 @@ int qcom_cc_register_sleep_clk(struct device *dev)
}
EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk);

/* Drop 'protected-clocks' from the list of clocks to register */
static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc)
{
	struct device_node *np = dev->of_node;
	struct property *prop;
	const __be32 *p;
	u32 i;

	of_property_for_each_u32(np, "protected-clocks", prop, p, i) {
		if (i >= cc->num_rclks)
			continue;

		cc->rclks[i] = NULL;
	}
}

static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec,
					 void *data)
{
@@ -249,6 +265,8 @@ int qcom_cc_really_probe(struct platform_device *pdev,
			return ret;
	}

	qcom_cc_drop_protected(dev, cc);

	for (i = 0; i < num_clks; i++) {
		if (!rclks[i])
			continue;