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

Commit e65e356d authored by Deepak Katragadda's avatar Deepak Katragadda
Browse files

qcom: subsys-pil-tz: Add property for setting clock frequencies



Add a new property, "qcom,'clock_name'-freq" for choosing the
frequency to set for the active or proxy clocks. If the
frequency property for a clock isnt added, then the clock
would be set to XO frequency by default.

This change for adding support to configure these
frequencies from dt is required for scm clocks.

Change-Id: I99be5a24d9569cc481bb247469c75ff346e03258
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent 0c694e68
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ Optional properties:
- active-clock-names: Names of the clocks that need to be turned on for the
		      subsystem to run. Turned off when the subsystem is shutdown.
- clock-names:	      Names of all the clocks that are accessed by the subsystem.
- qcom,<clock-name>-freq: Frequency to be set for that clock in Hz. If the property
			  isn't added for a clock, then the default clock frequency
			  would be set to 19200000 Hz.
- qcom,msm-bus,name:  Name of the bus client for the subsystem.
- qcom,msm-bus,num-cases: Number of use-cases.
- qcom,msm-bus,num-paths: Number of paths.
+13 −1
Original line number Diff line number Diff line
@@ -265,9 +265,21 @@ static int of_read_clocks(struct device *dev, struct clk ***clks_ref,

	for (i = 0; i < clk_count; i++) {
		const char *clock_name;
		char clock_freq_name[50];
		u32 clock_rate = XO_FREQ;

		of_property_read_string_index(dev->of_node,
					      propname, i,
					      &clock_name);
		snprintf(clock_freq_name, ARRAY_SIZE(clock_freq_name),
						"qcom,%s-freq", clock_name);
		if (of_find_property(dev->of_node, clock_freq_name, &len))
			if (of_property_read_u32(dev->of_node, clock_freq_name,
								&clock_rate)) {
				dev_err(dev, "Failed to read %s clock's freq\n",
							clock_freq_name);
				return -EINVAL;
			}

		clks[i] = devm_clk_get(dev, clock_name);
		if (IS_ERR(clks[i])) {
@@ -281,7 +293,7 @@ static int of_read_clocks(struct device *dev, struct clk ***clks_ref,
		/* Make sure rate-settable clocks' rates are set */
		if (clk_get_rate(clks[i]) == 0)
			clk_set_rate(clks[i], clk_round_rate(clks[i],
								XO_FREQ));
								clock_rate));
	}

	*clks_ref = clks;