Netdev List
 help / color / mirror / Atom feed
From: Madalin Bucur <madalin.bucur@nxp.com>
To: <netdev@vger.kernel.org>
Cc: linuxdev.baldrick@gmail.com, linuxppc-dev@lists.ozlabs.org,
	davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: [net-next 04/13] fsl/fman: use of_get_phy_mode()
Date: Tue, 4 Oct 2016 10:32:50 +0300	[thread overview]
Message-ID: <1475566379-5078-5-git-send-email-madalin.bucur@nxp.com> (raw)
In-Reply-To: <1475566379-5078-1-git-send-email-madalin.bucur@nxp.com>

From: Madalin Bucur <madalin.bucur@freescale.com>

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
---
 drivers/net/ethernet/freescale/fman/mac.c | 33 ++-----------------------------
 1 file changed, 2 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index e33d9d2..f94fad7 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -583,31 +583,6 @@ static void setup_memac(struct mac_device *mac_dev)
 
 static DEFINE_MUTEX(eth_lock);
 
-static const char phy_str[][11] = {
-	[PHY_INTERFACE_MODE_MII]		= "mii",
-	[PHY_INTERFACE_MODE_GMII]		= "gmii",
-	[PHY_INTERFACE_MODE_SGMII]		= "sgmii",
-	[PHY_INTERFACE_MODE_TBI]		= "tbi",
-	[PHY_INTERFACE_MODE_RMII]		= "rmii",
-	[PHY_INTERFACE_MODE_RGMII]		= "rgmii",
-	[PHY_INTERFACE_MODE_RGMII_ID]		= "rgmii-id",
-	[PHY_INTERFACE_MODE_RGMII_RXID]	= "rgmii-rxid",
-	[PHY_INTERFACE_MODE_RGMII_TXID]	= "rgmii-txid",
-	[PHY_INTERFACE_MODE_RTBI]		= "rtbi",
-	[PHY_INTERFACE_MODE_XGMII]		= "xgmii"
-};
-
-static phy_interface_t __pure __attribute__((nonnull)) str2phy(const char *str)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(phy_str); i++)
-		if (strcmp(str, phy_str[i]) == 0)
-			return (phy_interface_t)i;
-
-	return PHY_INTERFACE_MODE_MII;
-}
-
 static const u16 phy2speed[] = {
 	[PHY_INTERFACE_MODE_MII]		= SPEED_100,
 	[PHY_INTERFACE_MODE_GMII]		= SPEED_1000,
@@ -686,7 +661,6 @@ static int mac_probe(struct platform_device *_of_dev)
 	struct resource		 res;
 	struct mac_priv_s	*priv;
 	const u8		*mac_addr;
-	const char		*char_prop;
 	const u32		*u32_prop;
 	u8			fman_id;
 
@@ -870,15 +844,12 @@ static int mac_probe(struct platform_device *_of_dev)
 	}
 
 	/* Get the PHY connection type */
-	char_prop = (const char *)of_get_property(mac_node,
-						  "phy-connection-type", NULL);
-	if (!char_prop) {
+	priv->phy_if = of_get_phy_mode(mac_node);
+	if (priv->phy_if < 0) {
 		dev_warn(dev,
 			 "of_get_property(%s, phy-connection-type) failed. Defaulting to MII\n",
 			 mac_node->full_name);
 		priv->phy_if = PHY_INTERFACE_MODE_MII;
-	} else {
-		priv->phy_if = str2phy(char_prop);
 	}
 
 	priv->speed		= phy2speed[priv->phy_if];
-- 
2.1.0

  parent reply	other threads:[~2016-10-04  7:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04  7:32 [net-next 00/13] fsl/fman: cleanup and small fixes Madalin Bucur
2016-10-04  7:32 ` [net-next 01/13] fsl/fman: split lines over 80 characters Madalin Bucur
2016-10-04  7:32 ` [net-next 02/13] fsl/fman: fix loadable module compilation Madalin Bucur
2016-10-04  7:32 ` [net-next 03/13] fsl/fman: small fixes Madalin Bucur
2016-10-04  7:32 ` Madalin Bucur [this message]
2016-10-04  7:32 ` [net-next 05/13] fsl/fman: simplify device tree reads Madalin Bucur
2016-10-04  7:32 ` [net-next 06/13] fsl/fman: return a phy_dev pointer from init Madalin Bucur
2016-10-04  7:32 ` [net-next 07/13] fsl/fman: MEMAC may use QSGMII PHY interface mode Madalin Bucur
2016-10-04  7:32 ` [net-next 08/13] fsl/fman: check pcsphy pointer before use Madalin Bucur
2016-10-04 14:44   ` David Laight
2016-10-05  9:08     ` Madalin-Cristian Bucur
2016-10-04  7:32 ` [net-next 09/13] fsl/fman: check of_get_phy_mode() return value Madalin Bucur
2016-10-04  7:32 ` [net-next 10/13] fsl/fman: simplify redundant condition Madalin Bucur
2016-10-04  7:32 ` [net-next 11/13] fsl/fman: fix return value checking Madalin Bucur
2016-10-04  7:32 ` [net-next 12/13] fsl/fman: remove leftover comment Madalin Bucur
2016-10-04  7:32 ` [net-next 13/13] MAINTAINERS: net: add entry for Freescale QorIQ DPAA FMan driver Madalin Bucur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475566379-5078-5-git-send-email-madalin.bucur@nxp.com \
    --to=madalin.bucur@nxp.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxdev.baldrick@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox