[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180510231657.28503-4-paul.burton@mips.com>
Date: Thu, 10 May 2018 16:16:54 -0700
From: Paul Burton <paul.burton@...s.com>
To: <netdev@...r.kernel.org>
CC: <linux-mips@...ux-mips.org>,
"David S . Miller" <davem@...emloft.net>,
Andrew Lunn <andrew@...n.ch>,
Paul Burton <paul.burton@...s.com>
Subject: [PATCH v6 3/6] net: pch_gbe: Support DeviceTree for MDIO/PHY description
When running on a system which uses device tree, use
of_mdiobus_register() rather than plain mdiobus_register() in order to
support parsing PHY information from the DT.
On systems without CONFIG_OF_MDIO set of_mdiobus_register() falls back
to mdiobus_register() anyway, but here we check for a non-NULL device
node in order to continue functioning as-is if a system has
CONFIG_OF_MDIO=y but doesn't use the devicetree.
Signed-off-by: Paul Burton <paul.burton@...s.com>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: David S. Miller <davem@...emloft.net>
Cc: linux-mips@...ux-mips.org
Cc: netdev@...r.kernel.org
---
Changes in v6:
- New patch, significantly simplified by Andrew's preceding patches.
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index b20ed110cdef..f491044c2739 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -25,6 +25,7 @@
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/at803x_phy.h>
+#include <linux/of_mdio.h>
#define DRV_VERSION "1.01"
const char pch_driver_version[] = DRV_VERSION;
@@ -829,6 +830,9 @@ static int pch_gbe_init_mdio(struct pch_gbe_adapter *adapter)
adapter->mdiobus = bus;
+ if (dev->of_node)
+ return of_mdiobus_register(bus, dev->of_node);
+
return mdiobus_register(bus);
}
--
2.17.0
Powered by blists - more mailing lists