--- a/drivers/net/phy/mxl-gpy.c
+++ b/drivers/net/phy/mxl-gpy.c
-@@ -8,6 +8,7 @@
-
- #include <linux/module.h>
+@@ -10,6 +10,7 @@
#include <linux/bitfield.h>
+ #include <linux/hwmon.h>
+ #include <linux/mutex.h>
+#include <linux/of.h>
#include <linux/phy.h>
+ #include <linux/polynomial.h>
#include <linux/netdevice.h>
-
-@@ -30,6 +31,7 @@
+@@ -33,6 +34,7 @@
#define PHY_MIISTAT 0x18 /* MII state */
#define PHY_IMASK 0x19 /* interrupt mask */
#define PHY_ISTAT 0x1A /* interrupt status */
#define PHY_FWV 0x1E /* firmware version */
#define PHY_MIISTAT_SPD_MASK GENMASK(2, 0)
-@@ -53,10 +55,15 @@
+@@ -56,10 +58,15 @@
PHY_IMASK_ADSC | \
PHY_IMASK_ANC)
+#define PHY_LED_NUM_LEDS 4
+
#define PHY_FWV_REL_MASK BIT(15)
- #define PHY_FWV_TYPE_MASK GENMASK(11, 8)
+ #define PHY_FWV_MAJOR_MASK GENMASK(11, 8)
#define PHY_FWV_MINOR_MASK GENMASK(7, 0)
+/* LED */
/* SGMII */
#define VSPEC1_SGMII_CTRL 0x08
#define VSPEC1_SGMII_CTRL_ANEN BIT(12) /* Aneg enable */
-@@ -80,6 +87,31 @@ static const struct {
- {9, 0x73},
- };
+@@ -241,6 +248,35 @@ out:
+ return ret;
+ }
+static int gpy_led_write(struct phy_device *phydev)
+{
+ struct device_node *node = phydev->mdio.dev.of_node;
+ u32 led_regs[PHY_LED_NUM_LEDS];
+ int i, ret;
++ u16 val = 0xff00;
+
+ if (!IS_ENABLED(CONFIG_OF_MDIO))
+ return 0;
+ if (of_property_read_u32_array(node, "mxl,led-config", led_regs, PHY_LED_NUM_LEDS))
+ return 0;
+
++ if (of_property_read_bool(node, "mxl,led-drive-vdd"))
++ val &= 0x0fff;
++
+ /* Enable LED function handling on all ports*/
-+ phy_write(phydev, PHY_LED, 0xFF00);
++ phy_write(phydev, PHY_LED, val);
+
+ /* Write LED register values */
+ for (i = 0; i < PHY_LED_NUM_LEDS; i++) {
static int gpy_config_init(struct phy_device *phydev)
{
int ret;
-@@ -91,7 +123,10 @@ static int gpy_config_init(struct phy_de
+@@ -252,7 +288,10 @@ static int gpy_config_init(struct phy_de
/* Clear all pending interrupts */
ret = phy_read(phydev, PHY_ISTAT);
+ return gpy_led_write(phydev);
}
- static int gpy_probe(struct phy_device *phydev)
+ static bool gpy_has_broken_mdint(struct phy_device *phydev)