Add GPL-2.0+ SPDX-License-Identifier to source files
[platform/kernel/u-boot.git] / drivers / net / phy / phy.c
index 7c0eaec..6fe793d 100644 (file)
@@ -1,21 +1,7 @@
 /*
  * Generic PHY Management code
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
+ * SPDX-License-Identifier:    GPL-2.0+
  *
  * Copyright 2011 Freescale Semiconductor, Inc.
  * author Andy Fleming
@@ -333,7 +319,15 @@ int genphy_parse_link(struct phy_device *phydev)
                } else if (lpa & LPA_10FULL)
                        phydev->duplex = DUPLEX_FULL;
 
-               if (mii_reg & BMSR_ESTATEN)
+               /*
+                * Extended status may indicate that the PHY supports
+                * 1000BASE-T/X even though the 1000BASE-T registers
+                * are missing. In this case we can't tell whether the
+                * peer also supports it, so we only check extended
+                * status if the 1000BASE-T registers are actually
+                * missing.
+                */
+               if ((mii_reg & BMSR_ESTATEN) && !(mii_reg & BMSR_ERCAP))
                        estatus = phy_read(phydev, MDIO_DEVAD_NONE,
                                           MII_ESTATUS);
 
@@ -404,7 +398,7 @@ int genphy_config(struct phy_device *phydev)
                if (val & ESTATUS_1000_XFULL)
                        features |= SUPPORTED_1000baseX_Full;
                if (val & ESTATUS_1000_XHALF)
-                       features |= SUPPORTED_1000baseX_Full;
+                       features |= SUPPORTED_1000baseX_Half;
        }
 
        phydev->supported = features;