All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH dpss_eth] Don't initialise ports with no PHY
@ 2020-04-24 22:29 ` Darren Stevens
  0 siblings, 0 replies; 19+ messages in thread
From: Darren Stevens @ 2020-04-24 22:29 UTC (permalink / raw)
  To: madalin.bacur, netdev; +Cc: oss, chzigotzky, linuxppc-dev

Since cbb961ca271e ("Use random MAC address when none is given")
Varisys Cyrus P5020 boards have been listing 5 ethernet ports instead of
the 2 the board has.This is because we were preventing the adding of the
unused ports by not suppling them a MAC address, which this patch now
supplies.

Prevent them from appearing in the net devices list by checking for a
'status="disabled"' entry during probe and skipping the port if we find
it. 

Signed-off-by: Darren Stevens <Darren@stevens-zone.net>

---

 drivers/net/ethernet/freescale/fman/mac.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 43427c5..c9ed411 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -606,6 +606,7 @@ static int mac_probe(struct platform_device *_of_dev)
 	struct resource		 res;
 	struct mac_priv_s	*priv;
 	const u8		*mac_addr;
+	const char 		*prop;
 	u32			 val;
 	u8			fman_id;
 	phy_interface_t          phy_if;
@@ -628,6 +629,16 @@ static int mac_probe(struct platform_device *_of_dev)
 	mac_dev->priv = priv;
 	priv->dev = dev;
 
+	/* check for disabled devices and skip them, as now a missing
+	 * MAC address will be replaced with a Random one rather than
+	 * disabling the port
+	 */
+	prop = of_get_property(mac_node, "status", NULL);
+	if (prop && !strncmp(prop, "disabled", 8) {
+		err = -ENODEV;
+		goto _return
+	}
+
 	if (of_device_is_compatible(mac_node, "fsl,fman-dtsec")) {
 		setup_dtsec(mac_dev);
 		priv->internal_phy_node = of_parse_phandle(mac_node,

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

end of thread, other threads:[~2020-05-01  5:38 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 22:29 [RFC PATCH dpss_eth] Don't initialise ports with no PHY Darren Stevens
2020-04-24 22:29 ` Darren Stevens
2020-04-24 22:50 ` Florian Fainelli
2020-04-24 22:50   ` Florian Fainelli
2020-04-25  0:10 ` Andrew Lunn
2020-04-25  0:10   ` Andrew Lunn
2020-04-30 20:45   ` Darren Stevens
2020-04-29  8:26 ` [RFC PATCH dpss_eth] " Christian Zigotzky
2020-04-29  8:26   ` Christian Zigotzky
2020-04-29 13:12   ` Andrew Lunn
2020-04-29 13:12     ` Andrew Lunn
2020-04-29 13:55     ` Christian Zigotzky
2020-04-29 15:22       ` Andrew Lunn
2020-04-29 15:22         ` Andrew Lunn
2020-04-29 15:42         ` Christian Zigotzky
2020-04-29 15:42           ` Christian Zigotzky
2020-04-30 21:32           ` Darren Stevens
2020-05-01  5:35             ` Christian Zigotzky
2020-05-01  5:35               ` Christian Zigotzky

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.