Skip to content

Commit 2105a5d

Browse files
Brad Mouringdavem330
authored andcommitted
net: macb: Add phy-handle DT support
This optional binding (as described in the ethernet DT bindings doc) directs the netdev to the phydev to use. This is useful for a phy chip that has >1 phy in it, and two netdevs are using the same phy chip (i.e. the second mac's phy lives on the first mac's MDIO bus) The devicetree snippet would look something like this: ethernet@feedf00d { ... phy-handle = <&phy0> // the first netdev is physically wired to phy0 ... phy0: phy@0 { ... reg = <0x0> // MDIO address 0 ... } phy1: phy@1 { ... reg = <0x1> // MDIO address 1 ... } ... } ethernet@deadbeef { ... phy-handle = <&phy1> // tells the driver to use phy1 on the // first mac's mdio bus (it's wired thusly) ... } The work done to add the phy_node in the first place (dacdbb4: "net: macb: add fixed-link node support") will consume the device_node (if found). Signed-off-by: Brad Mouring <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cb732e9 commit 2105a5d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,12 @@ static int macb_mii_probe(struct net_device *dev)
488488
}
489489
bp->phy_node = of_node_get(np);
490490
} else {
491-
/* fallback to standard phy registration if no phy were
492-
* found during dt phy registration
491+
bp->phy_node = of_parse_phandle(np, "phy-handle", 0);
492+
/* fallback to standard phy registration if no
493+
* phy-handle was found nor any phy found during
494+
* dt phy registration
493495
*/
494-
if (!phy_find_first(bp->mii_bus)) {
496+
if (!bp->phy_node && !phy_find_first(bp->mii_bus)) {
495497
for (i = 0; i < PHY_MAX_ADDR; i++) {
496498
struct phy_device *phydev;
497499

0 commit comments

Comments
 (0)