All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] xgene mac/phy cleanup
@ 2015-08-19 18:56 Jeremy Linton
  2015-08-19 18:56 ` [PATCH] net: xgene Remove xgene specific phy and MAC lookup functions Jeremy Linton
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Linton @ 2015-08-19 18:56 UTC (permalink / raw)
  To: isubramanian; +Cc: stripathi, kchudgar, brian.brooks.arm, netdev, jeremy.linton

This patch converts the xgene driver to use some common ACPI/DT agnostic
functions for retrieving MAC and PHY settings. I don't have a way to test
them at the moment, so if someone can verify they work that would be great.

BTW: These patches are against net-next.

Thanks,

Jeremy Linton (1):
  net: xgene Remove xgene specific phy and MAC lookup functions

 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 38 ++----------------------
 1 file changed, 2 insertions(+), 36 deletions(-)

-- 
2.4.3

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

* [PATCH] net: xgene Remove xgene specific phy and MAC lookup functions
  2015-08-19 18:56 [RFC/PATCH] xgene mac/phy cleanup Jeremy Linton
@ 2015-08-19 18:56 ` Jeremy Linton
  2015-08-20 21:44   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Linton @ 2015-08-19 18:56 UTC (permalink / raw)
  To: isubramanian; +Cc: stripathi, kchudgar, brian.brooks.arm, netdev, jeremy.linton

Convert the xgene_get_mac_address to device_get_mac_address(), and
xgene_get_phy_mode() to device_get_phy_mode().

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 38 ++----------------------
 1 file changed, 2 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 299eb43..4f68d19 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -905,40 +905,6 @@ static int xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata *pda
 	return ret;
 }
 
-static int xgene_get_mac_address(struct device *dev,
-				 unsigned char *addr)
-{
-	int ret;
-
-	ret = device_property_read_u8_array(dev, "local-mac-address", addr, 6);
-	if (ret)
-		ret = device_property_read_u8_array(dev, "mac-address",
-						    addr, 6);
-	if (ret)
-		return -ENODEV;
-
-	return ETH_ALEN;
-}
-
-static int xgene_get_phy_mode(struct device *dev)
-{
-	int i, ret;
-	char *modestr;
-
-	ret = device_property_read_string(dev, "phy-connection-type",
-					  (const char **)&modestr);
-	if (ret)
-		ret = device_property_read_string(dev, "phy-mode",
-						  (const char **)&modestr);
-	if (ret)
-		return -ENODEV;
-
-	for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++) {
-		if (!strcasecmp(modestr, phy_modes(i)))
-			return i;
-	}
-	return -ENODEV;
-}
 
 static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 {
@@ -998,12 +964,12 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	if (ret)
 		return ret;
 
-	if (xgene_get_mac_address(dev, ndev->dev_addr) != ETH_ALEN)
+	if (!device_get_mac_address(dev, ndev->dev_addr, ETH_ALEN))
 		eth_hw_addr_random(ndev);
 
 	memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
 
-	pdata->phy_mode = xgene_get_phy_mode(dev);
+	pdata->phy_mode = device_get_phy_mode(dev);
 	if (pdata->phy_mode < 0) {
 		dev_err(dev, "Unable to get phy-connection-type\n");
 		return pdata->phy_mode;
-- 
2.4.3

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

* Re: [PATCH] net: xgene Remove xgene specific phy and MAC lookup functions
  2015-08-19 18:56 ` [PATCH] net: xgene Remove xgene specific phy and MAC lookup functions Jeremy Linton
@ 2015-08-20 21:44   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2015-08-20 21:44 UTC (permalink / raw)
  To: jeremy.linton; +Cc: isubramanian, stripathi, kchudgar, brian.brooks.arm, netdev

From: Jeremy Linton <jeremy.linton@arm.com>
Date: Wed, 19 Aug 2015 13:56:42 -0500

> Convert the xgene_get_mac_address to device_get_mac_address(), and
> xgene_get_phy_mode() to device_get_phy_mode().
> 
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>

Applied, thanks Jeremy.

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

end of thread, other threads:[~2015-08-20 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-19 18:56 [RFC/PATCH] xgene mac/phy cleanup Jeremy Linton
2015-08-19 18:56 ` [PATCH] net: xgene Remove xgene specific phy and MAC lookup functions Jeremy Linton
2015-08-20 21:44   ` David Miller

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.