All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: macb: Add phy-handle DT support
@ 2018-03-07 22:42 ` Brad Mouring
  0 siblings, 0 replies; 58+ messages in thread
From: Brad Mouring @ 2018-03-07 22:42 UTC (permalink / raw)
  To: Nicolas Ferre, Rob Herring, David S . Miller, Michael Grzeschik
  Cc: Mark Rutland, netdev, Julia Cartwright, devicetree, linux-kernel,
	Brad Mouring

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 (dacdbb4dfc1a1:
"net: macb: add fixed-link node support") will consume the
device_node (if found).

Signed-off-by: Brad Mouring <brad.mouring@ni.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index e84afcf1ecb5..cc5b9e6e3526 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -567,6 +567,9 @@ static int macb_mii_init(struct macb *bp)
 
 			err = mdiobus_register(bp->mii_bus);
 		} else {
+			/* attempt to find a phy-handle */
+			bp->phy_node = of_parse_phandle(np, "phy-handle", 0);
+
 			/* try dt phy registration */
 			err = of_mdiobus_register(bp->mii_bus, np);
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2018-03-16 15:15 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 22:42 [PATCH 1/2] net: macb: Add phy-handle DT support Brad Mouring
2018-03-07 22:42 ` Brad Mouring
2018-03-07 22:42 ` [PATCH 2/2] Documentation: macb: Document phy-handle optional binding Brad Mouring
2018-03-07 22:42   ` Brad Mouring
2018-03-08 17:32 ` [1/2] net: macb: Add phy-handle DT support Andrew Lunn
2018-03-08 22:00   ` Brad Mouring
2018-03-08 22:00     ` Brad Mouring
2018-03-09 22:12   ` [PATCH v2 net-next 1/3] net: macb: Reorganize macb_mii bringup Brad Mouring
2018-03-09 22:12     ` Brad Mouring
2018-03-09 22:12     ` [PATCH v2 net-next 2/3] net: macb: Add phy-handle DT support Brad Mouring
2018-03-09 22:12       ` Brad Mouring
2018-03-09 22:12     ` [PATCH v2 net-next 3/3] Documentation: macb: Document phy-handle optional binding Brad Mouring
2018-03-09 22:12       ` Brad Mouring
2018-03-10 16:18       ` Andrew Lunn
2018-03-10 16:17     ` [PATCH v2 net-next 1/3] net: macb: Reorganize macb_mii bringup Andrew Lunn
2018-03-10 22:19       ` Brad Mouring
2018-03-10 22:19         ` Brad Mouring
2018-03-12 17:09       ` [PATCH v3 net-next 0/4] macb: Introduce phy-handle DT functionality Brad Mouring
2018-03-12 17:09         ` [PATCH v3 net-next 1/4] net: macb: Reorganize macb_mii bringup Brad Mouring
2018-03-12 17:09           ` Brad Mouring
2018-03-12 17:17           ` Florian Fainelli
2018-03-13  4:25           ` kbuild test robot
2018-03-13  4:25             ` kbuild test robot
2018-03-12 17:09         ` [PATCH v3 net-next 2/4] net: macb: Remove redundant poll irq assignment Brad Mouring
2018-03-12 17:09           ` Brad Mouring
2018-03-12 17:17           ` Florian Fainelli
2018-03-12 17:10         ` [PATCH v3 net-next 3/4] net: macb: Add phy-handle DT support Brad Mouring
2018-03-12 17:10           ` Brad Mouring
2018-03-12 17:59           ` Andrew Lunn
2018-03-12 21:34             ` [PATCH v4 net-next 0/4] Brad Mouring
2018-03-12 21:34               ` [PATCH v4 net-next 1/4] net: macb: Reorganize macb_mii bringup Brad Mouring
2018-03-12 21:34                 ` Brad Mouring
2018-03-12 21:34               ` [PATCH v4 net-next 2/4] net: macb: Remove redundant poll irq assignment Brad Mouring
2018-03-12 21:34                 ` Brad Mouring
2018-03-12 21:34               ` [PATCH v4 net-next 3/4] net: macb: Add phy-handle DT support Brad Mouring
2018-03-12 21:34                 ` Brad Mouring
2018-03-12 21:57                 ` Andrew Lunn
2018-03-12 22:30                   ` Florian Fainelli
2018-03-13 13:49                     ` Brad Mouring
2018-03-13 13:49                       ` Brad Mouring
2018-03-13 21:32                     ` [PATCH v5 net-next 0/4] net: macb: Introduce phy-handle DT functionality Brad Mouring
2018-03-13 21:32                       ` Brad Mouring
2018-03-13 21:32                       ` [PATCH v5 net-next 1/4] net: macb: Reorganize macb_mii bringup Brad Mouring
2018-03-13 21:32                         ` Brad Mouring
2018-03-13 21:32                       ` [PATCH v5 net-next 2/4] net: macb: Remove redundant poll irq assignment Brad Mouring
2018-03-13 21:32                         ` Brad Mouring
2018-03-13 21:32                       ` [PATCH v5 net-next 3/4] net: macb: Add phy-handle DT support Brad Mouring
2018-03-13 21:32                         ` Brad Mouring
2018-03-13 21:32                       ` [PATCH v5 net-next 4/4] Documentation: macb: Document phy-handle binding Brad Mouring
2018-03-13 21:32                         ` Brad Mouring
2018-03-16 15:15                       ` [PATCH v5 net-next 0/4] net: macb: Introduce phy-handle DT functionality David Miller
2018-03-12 21:34               ` [PATCH v4 net-next 4/4] Documentation: macb: Document phy-handle binding Brad Mouring
2018-03-12 21:34                 ` Brad Mouring
2018-03-12 17:10         ` [PATCH v3 " Brad Mouring
2018-03-12 17:10           ` Brad Mouring
2018-03-12 17:18           ` Florian Fainelli
2018-03-11  7:02     ` [PATCH v2 net-next 1/3] net: macb: Reorganize macb_mii bringup kbuild test robot
2018-03-11  7:02       ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.