aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale
diff options
context:
space:
mode:
authorMadalin Bucur <madalin.bucur@freescale.com>2016-04-07 05:50:16 -0400
committerMadalin Bucur <madalin.bucur@nxp.com>2016-10-04 02:26:06 -0400
commit6fa8519274db638fff104fffeadbffc089499244 (patch)
tree289e3f11d3a757aa80d869d9d9057c154ff6f8dd /drivers/net/ethernet/freescale
parent5df6f7fa47e0306bdbb94ac7f3545697ff92d7d2 (diff)
fsl/fman: use of_get_phy_mode()
Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale')
-rw-r--r--drivers/net/ethernet/freescale/fman/mac.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index e33d9d24c1db..f94fad7884df 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)
583 583
584static DEFINE_MUTEX(eth_lock); 584static DEFINE_MUTEX(eth_lock);
585 585
586static const char phy_str[][11] = {
587 [PHY_INTERFACE_MODE_MII] = "mii",
588 [PHY_INTERFACE_MODE_GMII] = "gmii",
589 [PHY_INTERFACE_MODE_SGMII] = "sgmii",
590 [PHY_INTERFACE_MODE_TBI] = "tbi",
591 [PHY_INTERFACE_MODE_RMII] = "rmii",
592 [PHY_INTERFACE_MODE_RGMII] = "rgmii",
593 [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id",
594 [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid",
595 [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid",
596 [PHY_INTERFACE_MODE_RTBI] = "rtbi",
597 [PHY_INTERFACE_MODE_XGMII] = "xgmii"
598};
599
600static phy_interface_t __pure __attribute__((nonnull)) str2phy(const char *str)
601{
602 int i;
603
604 for (i = 0; i < ARRAY_SIZE(phy_str); i++)
605 if (strcmp(str, phy_str[i]) == 0)
606 return (phy_interface_t)i;
607
608 return PHY_INTERFACE_MODE_MII;
609}
610
611static const u16 phy2speed[] = { 586static const u16 phy2speed[] = {
612 [PHY_INTERFACE_MODE_MII] = SPEED_100, 587 [PHY_INTERFACE_MODE_MII] = SPEED_100,
613 [PHY_INTERFACE_MODE_GMII] = SPEED_1000, 588 [PHY_INTERFACE_MODE_GMII] = SPEED_1000,
@@ -686,7 +661,6 @@ static int mac_probe(struct platform_device *_of_dev)
686 struct resource res; 661 struct resource res;
687 struct mac_priv_s *priv; 662 struct mac_priv_s *priv;
688 const u8 *mac_addr; 663 const u8 *mac_addr;
689 const char *char_prop;
690 const u32 *u32_prop; 664 const u32 *u32_prop;
691 u8 fman_id; 665 u8 fman_id;
692 666
@@ -870,15 +844,12 @@ static int mac_probe(struct platform_device *_of_dev)
870 } 844 }
871 845
872 /* Get the PHY connection type */ 846 /* Get the PHY connection type */
873 char_prop = (const char *)of_get_property(mac_node, 847 priv->phy_if = of_get_phy_mode(mac_node);
874 "phy-connection-type", NULL); 848 if (priv->phy_if < 0) {
875 if (!char_prop) {
876 dev_warn(dev, 849 dev_warn(dev,
877 "of_get_property(%s, phy-connection-type) failed. Defaulting to MII\n", 850 "of_get_property(%s, phy-connection-type) failed. Defaulting to MII\n",
878 mac_node->full_name); 851 mac_node->full_name);
879 priv->phy_if = PHY_INTERFACE_MODE_MII; 852 priv->phy_if = PHY_INTERFACE_MODE_MII;
880 } else {
881 priv->phy_if = str2phy(char_prop);
882 } 853 }
883 854
884 priv->speed = phy2speed[priv->phy_if]; 855 priv->speed = phy2speed[priv->phy_if];