aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2021-11-25 21:27:07 +0300
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>2022-10-17 10:01:07 +0300
commit5c00ba1aa359b744b5a2163b9870498a265b2073 (patch)
tree673fc306fed8f0a522c23d0172d213a780fe37c2
parentd48e81e7ae9a16ecbe7462d504a5de7b7e5e81d3 (diff)
of: property: do not create clocks device link for clock controllers
Do not create device link for clock controllers. Some of the clocks provided to the device via OF can be the clocks that are just parents to the clocks provided by this clock controller. Clock subsystem already has support for handling missing clock parents correctly (clock orphans). Later when the parent clock is registered, clocks get populated properly. An example of the system where this matters is the SDM8450 MTP board (see arch/arm64/boot/dts/qcom/sdm845-mtp.dts). Here the dispcc uses clocks provided by dsi0_phy and dsi1_phy device tree nodes. However the dispcc itself provides clocks to both PHYs, to the PHY parent device, etc. With just dsi0_phy in place devlink is able to break the dependency, but with two PHYs, dispcc doesn't get probed at all, thus breaking display support. Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Stephen Boyd <swboyd@chromium.org> Cc: Saravana Kannan <saravanak@google.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-rw-r--r--drivers/of/property.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 969ff859bffa..5f1606a95676 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1274,7 +1274,6 @@ struct supplier_bindings {
bool optional;
};
-DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells")
DEFINE_SIMPLE_PROP(interconnects, "interconnects", "#interconnect-cells")
DEFINE_SIMPLE_PROP(iommus, "iommus", "#iommu-cells")
DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells")
@@ -1304,6 +1303,21 @@ DEFINE_SIMPLE_PROP(backlight, "backlight", NULL)
DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells")
+static struct device_node *parse_clocks(struct device_node *np,
+ const char *prop_name, int index)
+{
+ /*
+ * Do not create clock-related device links for clocks controllers,
+ * clock orphans will handle missing clock parents automatically.
+ */
+ if (!strcmp(prop_name, "clocks") &&
+ of_find_property(np, "#clock-cells", NULL))
+ return NULL;
+
+ return parse_prop_cells(np, prop_name, index, "clocks",
+ "#clock-cells");
+}
+
static struct device_node *parse_gpios(struct device_node *np,
const char *prop_name, int index)
{