Commit 18eb8aea authored by Tony Lindgren's avatar Tony Lindgren Committed by David S. Miller

net: ethernet: cpsw-phy-sel: prefer phandle for phy sel

The cpsw-phy-sel device is not a child of the cpsw interconnect target
module. It lives in the system control module.

Let's fix this issue by trying to use cpsw-phy-sel phandle first if it
exists and if not fall back to current usage of trying to find the
cpsw-phy-sel child. That way the phy sel driver can be a child of the
system control module where it belongs in the device tree.

Without this fix, we cannot have a proper interconnect target module
hierarchy in device tree for things like genpd.

Note that deferred probe is mostly not supported by cpsw and this patch
does not attempt to fix that. In case deferred probe support is needed,
this could be added to cpsw_slave_open() and phy_connect() so they start
handling and returning errors.

For documenting it, looks like the cpsw-phy-sel is used for all cpsw device
tree nodes. It's missing the related binding documentation, so let's also
update the binding documentation accordingly.

Cc: devicetree@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Murali Karicheri <m-karicheri2@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10d7fac4
...@@ -170,10 +170,13 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave) ...@@ -170,10 +170,13 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)
struct device_node *node; struct device_node *node;
struct cpsw_phy_sel_priv *priv; struct cpsw_phy_sel_priv *priv;
node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel"); node = of_parse_phandle(dev->of_node, "cpsw-phy-sel", 0);
if (!node) { if (!node) {
dev_err(dev, "Phy mode driver DT not found\n"); node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel");
return; if (!node) {
dev_err(dev, "Phy mode driver DT not found\n");
return;
}
} }
dev = bus_find_device(&platform_bus_type, NULL, node, match); dev = bus_find_device(&platform_bus_type, NULL, node, match);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment