phy: ti: j721e-wiz: Get PHY properties only for "phy" or "link" subnode
authorKishon Vijay Abraham I <kishon@ti.com>
Fri, 19 Mar 2021 12:41:19 +0000 (18:11 +0530)
committerVinod Koul <vkoul@kernel.org>
Wed, 31 Mar 2021 11:13:20 +0000 (16:43 +0530)
"serdes" node (child node of WIZ) can have sub-nodes for representing links
or it can have sub-nodes for representing the various clocks within the
serdes. Instead of trying to read "reg" from every child node used for
assigning "lane_phy_type", read only if the child node's name is "phy"
or "link" subnode.
Ideally all PHY dt nodes should have node name as "phy", however
existing devicetree used "link" as subnode. So in order to maintain old
DT compatibility get PHY properties for "phy" or "link" subnode.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Link: https://lore.kernel.org/r/20210319124128.13308-5-kishon@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/ti/phy-j721e-wiz.c

index 53d01da2894a635aa9a39b4864ab79c72b3fba2a..02c47b2df01f67ad1d21f18d7b8018d097c3b3e4 100644 (file)
@@ -1102,6 +1102,10 @@ static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz)
                u32 reg, num_lanes = 1, phy_type = PHY_NONE;
                int ret, i;
 
+               if (!(of_node_name_eq(subnode, "phy") ||
+                     of_node_name_eq(subnode, "link")))
+                       continue;
+
                ret = of_property_read_u32(subnode, "reg", &reg);
                if (ret) {
                        of_node_put(subnode);