Skip to content

Commit

Permalink
net: ethernet: cpsw-phy-sel: prefer phandle for phy sel
Browse files Browse the repository at this point in the history
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: [email protected]
Cc: Andrew Lunn <[email protected]>
Cc: Grygorii Strashko <[email protected]>
Cc: Ivan Khoronzhuk <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Murali Karicheri <[email protected]>
Cc: Rob Herring <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tmlind authored and davem330 committed Sep 2, 2018
1 parent 10d7fac commit 18eb8ae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/ethernet/ti/cpsw-phy-sel.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)
struct device_node *node;
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) {
dev_err(dev, "Phy mode driver DT not found\n");
return;
node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel");
if (!node) {
dev_err(dev, "Phy mode driver DT not found\n");
return;
}
}

dev = bus_find_device(&platform_bus_type, NULL, node, match);
Expand Down

0 comments on commit 18eb8ae

Please sign in to comment.