clk: qcom: Mark the parent's clock of critical-devices as critical

The clocks of devices with the “qcom,critical-devices” property
are marked as critical and can be enabled on default, the
parent's clocks of these child critical-devices also need
to be marked as critical.

Rather than adding child and parent devices in the dts property
"qcom,critical-devices", it's better to automatically mark
the clock of parent device as critical.

Change-Id: If7b0f53c45194dbc0cd41e13316101a9149a4dc8
Signed-off-by: Xubin Bai <quic_xubibai@quicinc.com>
This commit is contained in:
Xubin Bai 2022-08-02 21:37:58 +08:00 committed by Mike Tipton
parent 6497e33a15
commit cdc3459d09

View File

@ -252,26 +252,29 @@ static void qcom_cc_set_critical(struct device *dev, struct qcom_cc *cc)
}
of_property_for_each_u32(dev->of_node, "qcom,critical-devices", prop, p, i) {
np = of_find_node_by_phandle(i);
if (!np)
continue;
cnt = of_count_phandle_with_args(np, "clocks", "#clock-cells");
for (i = 0; i < cnt; i++) {
of_parse_phandle_with_args(np, "clocks", "#clock-cells",
i, &args);
clock_idx = args.args[0];
if (args.np != dev->of_node || clock_idx >= cc->num_rclks)
for (np = of_find_node_by_phandle(i); np; np = of_get_parent(np)) {
if (!of_property_read_bool(np, "clocks")) {
of_node_put(np);
continue;
}
if (cc->rclks[clock_idx])
cc->rclks[clock_idx]->flags |= QCOM_CLK_IS_CRITICAL;
of_node_put(args.np);
cnt = of_count_phandle_with_args(np, "clocks", "#clock-cells");
for (i = 0; i < cnt; i++) {
of_parse_phandle_with_args(np, "clocks", "#clock-cells",
i, &args);
clock_idx = args.args[0];
if (args.np != dev->of_node || clock_idx >= cc->num_rclks)
continue;
if (cc->rclks[clock_idx])
cc->rclks[clock_idx]->flags |= QCOM_CLK_IS_CRITICAL;
of_node_put(args.np);
}
of_node_put(np);
}
of_node_put(np);
}
}