generic: phy: aquantia: correctly describe LED polarity
authorDaniel Golle <daniel@makrotopia.org>
Sat, 5 Oct 2024 21:19:43 +0000 (22:19 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 15 Oct 2024 16:46:14 +0000 (17:46 +0100)
Backport newly introduced support for 'active-high' property and use
it to correctly implement polarity assignment for Aquantia PHY LEDs.
Previously the 'active-low' property was used to switch a LED PIN to
active-high ("drive VDD" in Aquantia-speak) mode.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/generic/backport-6.6/839-v6.13-net-phy-aquantia-fix-setting-active_low-bit.patch [new file with mode: 0644]
target/linux/generic/backport-6.6/840-v6.13-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch [new file with mode: 0644]
target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch [new file with mode: 0644]
target/linux/generic/backport-6.6/842-v6.13-net-phy-aquantia-correctly-describe-LED-polarity-ove.patch [new file with mode: 0644]
target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch
target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch
target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch
target/linux/generic/pending-6.6/750-net-phy-aquantia-fix-setting-active_low-bit.patch [deleted file]
target/linux/generic/pending-6.6/751-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch [deleted file]
target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi

diff --git a/target/linux/generic/backport-6.6/839-v6.13-net-phy-aquantia-fix-setting-active_low-bit.patch b/target/linux/generic/backport-6.6/839-v6.13-net-phy-aquantia-fix-setting-active_low-bit.patch
new file mode 100644 (file)
index 0000000..6072e02
--- /dev/null
@@ -0,0 +1,55 @@
+From patchwork Tue Sep 17 13:49:40 2024
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
+X-Patchwork-Id: 13806176
+X-Patchwork-Delegate: kuba@kernel.org
+Date: Tue, 17 Sep 2024 14:49:40 +0100
+From: Daniel Golle <daniel@makrotopia.org>
+To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>,
+       Russell King <linux@armlinux.org.uk>,
+       "David S. Miller" <davem@davemloft.net>,
+       Eric Dumazet <edumazet@google.com>,
+       Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
+       Daniel Golle <daniel@makrotopia.org>,
+       Christian Marangi <ansuelsmth@gmail.com>,
+       Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
+       Robert Marko <robimarko@gmail.com>,
+       Russell King <rmk+kernel@armlinux.org.uk>, netdev@vger.kernel.org,
+       linux-kernel@vger.kernel.org
+Subject: [PATCH net 1/2] net: phy: aquantia: fix setting active_low bit
+Message-ID: 
+ <ab963584b0a7e3b4dac39472a4b82ca264d79630.1726580902.git.daniel@makrotopia.org>
+Precedence: bulk
+X-Mailing-List: netdev@vger.kernel.org
+List-Id: <netdev.vger.kernel.org>
+List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
+List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
+MIME-Version: 1.0
+Content-Disposition: inline
+X-Patchwork-Delegate: kuba@kernel.org
+
+phy_modify_mmd was used wrongly in aqr_phy_led_active_low_set() resulting
+in a no-op instead of setting the VEND1_GLOBAL_LED_DRIVE_VDD bit.
+Correctly set VEND1_GLOBAL_LED_DRIVE_VDD bit.
+
+Fixes: 61578f679378 ("net: phy: aquantia: add support for PHY LEDs")
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/phy/aquantia/aquantia_leds.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/phy/aquantia/aquantia_leds.c
++++ b/drivers/net/phy/aquantia/aquantia_leds.c
+@@ -120,7 +120,8 @@ int aqr_phy_led_hw_control_set(struct ph
+ int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable)
+ {
+       return phy_modify_mmd(phydev, MDIO_MMD_VEND1, AQR_LED_DRIVE(index),
+-                            VEND1_GLOBAL_LED_DRIVE_VDD, enable);
++                            VEND1_GLOBAL_LED_DRIVE_VDD,
++                            enable ? VEND1_GLOBAL_LED_DRIVE_VDD : 0);
+ }
+ int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes)
diff --git a/target/linux/generic/backport-6.6/840-v6.13-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch b/target/linux/generic/backport-6.6/840-v6.13-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch
new file mode 100644 (file)
index 0000000..6d71b3d
--- /dev/null
@@ -0,0 +1,72 @@
+From patchwork Tue Sep 17 13:49:55 2024
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
+X-Patchwork-Id: 13806177
+X-Patchwork-Delegate: kuba@kernel.org
+Date: Tue, 17 Sep 2024 14:49:55 +0100
+From: Daniel Golle <daniel@makrotopia.org>
+To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>,
+       Russell King <linux@armlinux.org.uk>,
+       "David S. Miller" <davem@davemloft.net>,
+       Eric Dumazet <edumazet@google.com>,
+       Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
+       Daniel Golle <daniel@makrotopia.org>,
+       Christian Marangi <ansuelsmth@gmail.com>,
+       Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
+       Robert Marko <robimarko@gmail.com>,
+       Russell King <rmk+kernel@armlinux.org.uk>, netdev@vger.kernel.org,
+       linux-kernel@vger.kernel.org
+Subject: [PATCH net 2/2] net: phy: aquantia: fix applying active_low bit
+ after reset
+Message-ID: 
+ <9b1f0cd91f4cda54c8be56b4fe780480baf4aa0f.1726580902.git.daniel@makrotopia.org>
+References: 
+ <ab963584b0a7e3b4dac39472a4b82ca264d79630.1726580902.git.daniel@makrotopia.org>
+Precedence: bulk
+X-Mailing-List: netdev@vger.kernel.org
+List-Id: <netdev.vger.kernel.org>
+List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
+List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
+MIME-Version: 1.0
+Content-Disposition: inline
+In-Reply-To: 
+ <ab963584b0a7e3b4dac39472a4b82ca264d79630.1726580902.git.daniel@makrotopia.org>
+X-Patchwork-Delegate: kuba@kernel.org
+
+for_each_set_bit was used wrongly in aqr107_config_init() when iterating
+over LEDs. Drop misleading 'index' variable and call
+aqr_phy_led_active_low_set() for each set bit representing an LED which
+is driven by VDD instead of GND pin.
+
+Fixes: 61578f679378 ("net: phy: aquantia: add support for PHY LEDs")
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/phy/aquantia/aquantia_main.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/phy/aquantia/aquantia_main.c
++++ b/drivers/net/phy/aquantia/aquantia_main.c
+@@ -530,7 +530,7 @@ static int aqr107_config_init(struct phy
+ {
+       struct aqr107_priv *priv = phydev->priv;
+       u32 led_active_low;
+-      int ret, index = 0;
++      int ret;
+       /* Check that the PHY interface type is compatible */
+       if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
+@@ -570,10 +570,9 @@ static int aqr107_config_init(struct phy
+       /* Restore LED polarity state after reset */
+       for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) {
+-              ret = aqr_phy_led_active_low_set(phydev, index, led_active_low);
++              ret = aqr_phy_led_active_low_set(phydev, led_active_low, true);
+               if (ret)
+                       return ret;
+-              index++;
+       }
+       return 0;
diff --git a/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch b/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch
new file mode 100644 (file)
index 0000000..02706cc
--- /dev/null
@@ -0,0 +1,53 @@
+From a274465cc3bef2dfd9c9ea5100848dda0a8641e1 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel@makrotopia.org>
+Date: Thu, 10 Oct 2024 13:54:19 +0100
+Subject: [PATCH 1/4] net: phy: support 'active-high' property for PHY LEDs
+
+In addition to 'active-low' and 'inactive-high-impedance' also
+support 'active-high' property for PHY LED pin configuration.
+As only either 'active-high' or 'active-low' can be set at the
+same time, WARN and return an error in case both are set.
+
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://patch.msgid.link/91598487773d768f254d5faf06cf65b13e972f0e.1728558223.git.daniel@makrotopia.org
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+---
+ drivers/net/phy/phy_device.c | 6 ++++++
+ include/linux/phy.h          | 5 +++--
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/phy/phy_device.c
++++ b/drivers/net/phy/phy_device.c
+@@ -3219,11 +3219,17 @@ static int of_phy_led(struct phy_device
+       if (index > U8_MAX)
+               return -EINVAL;
++      if (of_property_read_bool(led, "active-high"))
++              set_bit(PHY_LED_ACTIVE_HIGH, &modes);
+       if (of_property_read_bool(led, "active-low"))
+               set_bit(PHY_LED_ACTIVE_LOW, &modes);
+       if (of_property_read_bool(led, "inactive-high-impedance"))
+               set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
++      if (WARN_ON(modes & BIT(PHY_LED_ACTIVE_LOW) &&
++                  modes & BIT(PHY_LED_ACTIVE_HIGH)))
++              return -EINVAL;
++
+       if (modes) {
+               /* Return error if asked to set polarity modes but not supported */
+               if (!phydev->drv->led_polarity_set)
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -872,8 +872,9 @@ struct phy_led {
+ /* Modes for PHY LED configuration */
+ enum phy_led_modes {
+-      PHY_LED_ACTIVE_LOW = 0,
+-      PHY_LED_INACTIVE_HIGH_IMPEDANCE = 1,
++      PHY_LED_ACTIVE_HIGH = 0,
++      PHY_LED_ACTIVE_LOW = 1,
++      PHY_LED_INACTIVE_HIGH_IMPEDANCE = 2,
+       /* keep it last */
+       __PHY_LED_MODES_NUM,
diff --git a/target/linux/generic/backport-6.6/842-v6.13-net-phy-aquantia-correctly-describe-LED-polarity-ove.patch b/target/linux/generic/backport-6.6/842-v6.13-net-phy-aquantia-correctly-describe-LED-polarity-ove.patch
new file mode 100644 (file)
index 0000000..f26bb82
--- /dev/null
@@ -0,0 +1,108 @@
+From 9d55e68b19f222e6334ef4021c5527998f5ab537 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel@makrotopia.org>
+Date: Thu, 10 Oct 2024 13:55:00 +0100
+Subject: [PATCH 2/4] net: phy: aquantia: correctly describe LED polarity
+ override
+
+Use newly defined 'active-high' property to set the
+VEND1_GLOBAL_LED_DRIVE_VDD bit and let 'active-low' clear that bit. This
+reflects the technical reality which was inverted in the previous
+description in which the 'active-low' property was used to actually set
+the VEND1_GLOBAL_LED_DRIVE_VDD bit, which means that VDD (ie. supply
+voltage) of the LED is driven rather than GND.
+
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://patch.msgid.link/86a413b4387c42dcb54f587cc2433a06f16aae83.1728558223.git.daniel@makrotopia.org
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+---
+ drivers/net/phy/aquantia/aquantia.h      |  1 +
+ drivers/net/phy/aquantia/aquantia_leds.c | 19 ++++++++++++++-----
+ drivers/net/phy/aquantia/aquantia_main.c | 12 +++++++++---
+ 3 files changed, 24 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/phy/aquantia/aquantia.h
++++ b/drivers/net/phy/aquantia/aquantia.h
+@@ -169,6 +169,7 @@ static const struct aqr107_hw_stat aqr10
+ struct aqr107_priv {
+       u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
+       unsigned long leds_active_low;
++      unsigned long leds_active_high;
+ };
+ #if IS_REACHABLE(CONFIG_HWMON)
+--- a/drivers/net/phy/aquantia/aquantia_leds.c
++++ b/drivers/net/phy/aquantia/aquantia_leds.c
+@@ -121,13 +121,13 @@ int aqr_phy_led_active_low_set(struct ph
+ {
+       return phy_modify_mmd(phydev, MDIO_MMD_VEND1, AQR_LED_DRIVE(index),
+                             VEND1_GLOBAL_LED_DRIVE_VDD,
+-                            enable ? VEND1_GLOBAL_LED_DRIVE_VDD : 0);
++                            enable ? 0 : VEND1_GLOBAL_LED_DRIVE_VDD);
+ }
+ int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes)
+ {
++      bool force_active_low = false, force_active_high = false;
+       struct aqr107_priv *priv = phydev->priv;
+-      bool active_low = false;
+       u32 mode;
+       if (index >= AQR_MAX_LEDS)
+@@ -136,7 +136,10 @@ int aqr_phy_led_polarity_set(struct phy_
+       for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) {
+               switch (mode) {
+               case PHY_LED_ACTIVE_LOW:
+-                      active_low = true;
++                      force_active_low = true;
++                      break;
++              case PHY_LED_ACTIVE_HIGH:
++                      force_active_high = true;
+                       break;
+               default:
+                       return -EINVAL;
+@@ -144,8 +147,14 @@ int aqr_phy_led_polarity_set(struct phy_
+       }
+       /* Save LED driver vdd state to restore on SW reset */
+-      if (active_low)
++      if (force_active_low)
+               priv->leds_active_low |= BIT(index);
+-      return aqr_phy_led_active_low_set(phydev, index, active_low);
++      if (force_active_high)
++              priv->leds_active_high |= BIT(index);
++
++      if (force_active_high || force_active_low)
++              return aqr_phy_led_active_low_set(phydev, index, force_active_low);
++
++      unreachable();
+ }
+--- a/drivers/net/phy/aquantia/aquantia_main.c
++++ b/drivers/net/phy/aquantia/aquantia_main.c
+@@ -529,7 +529,7 @@ static int aqr107_config_mdi(struct phy_
+ static int aqr107_config_init(struct phy_device *phydev)
+ {
+       struct aqr107_priv *priv = phydev->priv;
+-      u32 led_active_low;
++      u32 led_idx;
+       int ret;
+       /* Check that the PHY interface type is compatible */
+@@ -569,8 +569,14 @@ static int aqr107_config_init(struct phy
+               return ret;
+       /* Restore LED polarity state after reset */
+-      for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) {
+-              ret = aqr_phy_led_active_low_set(phydev, led_active_low, true);
++      for_each_set_bit(led_idx, &priv->leds_active_low, AQR_MAX_LEDS) {
++              ret = aqr_phy_led_active_low_set(phydev, led_idx, true);
++              if (ret)
++                      return ret;
++      }
++
++      for_each_set_bit(led_idx, &priv->leds_active_high, AQR_MAX_LEDS) {
++              ret = aqr_phy_led_active_low_set(phydev, led_idx, false);
+               if (ret)
+                       return ret;
+       }
index 4ebddb3b4560afdd98cacde2a793aa280be57893..522dbaf68f4cf8ee98a643f88d0b98838480c041 100644 (file)
@@ -97,7 +97,7 @@ Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
  static int aqr_config_intr(struct phy_device *phydev)
  {
        bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED;
-@@ -848,7 +916,7 @@ static struct phy_driver aqr_driver[] =
+@@ -854,7 +922,7 @@ static struct phy_driver aqr_driver[] =
        PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
        .name           = "Aquantia AQR112",
        .probe          = aqr107_probe,
@@ -106,7 +106,7 @@ Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
        .config_intr    = aqr_config_intr,
        .handle_interrupt = aqr_handle_interrupt,
        .get_tunable    = aqr107_get_tunable,
-@@ -871,7 +939,7 @@ static struct phy_driver aqr_driver[] =
+@@ -877,7 +945,7 @@ static struct phy_driver aqr_driver[] =
        PHY_ID_MATCH_MODEL(PHY_ID_AQR412),
        .name           = "Aquantia AQR412",
        .probe          = aqr107_probe,
index b3767f13464ecfebd40f3145dba22ea618e93e0c..ed47187a3e87c2da3b8e3d265f4ebc4b557940c3 100644 (file)
@@ -21,7 +21,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  
  #define MDIO_PHYXS_VEND_IF_STATUS             0xe812
  #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK   GENMASK(7, 3)
-@@ -1055,6 +1057,30 @@ static struct phy_driver aqr_driver[] =
+@@ -1061,6 +1063,30 @@ static struct phy_driver aqr_driver[] =
        .led_hw_control_get = aqr_phy_led_hw_control_get,
        .led_polarity_set = aqr_phy_led_polarity_set,
  },
@@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  };
  
  module_phy_driver(aqr_driver);
-@@ -1075,6 +1101,8 @@ static struct mdio_device_id __maybe_unu
+@@ -1081,6 +1107,8 @@ static struct mdio_device_id __maybe_unu
        { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
        { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) },
        { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) },
index aa8396826334b50c58cdd8a9c3adcb38e2d5ea72..a556a9cc40714955005288ac6be75525cc8c1f22 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
                        sysfs_remove_link(&dev->dev.kobj, "phydev");
 --- a/include/linux/phy.h
 +++ b/include/linux/phy.h
-@@ -979,6 +979,12 @@ struct phy_driver {
+@@ -980,6 +980,12 @@ struct phy_driver {
        /** @handle_interrupt: Override default interrupt handling */
        irqreturn_t (*handle_interrupt)(struct phy_device *phydev);
  
diff --git a/target/linux/generic/pending-6.6/750-net-phy-aquantia-fix-setting-active_low-bit.patch b/target/linux/generic/pending-6.6/750-net-phy-aquantia-fix-setting-active_low-bit.patch
deleted file mode 100644 (file)
index 6072e02..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-From patchwork Tue Sep 17 13:49:40 2024
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
-X-Patchwork-Id: 13806176
-X-Patchwork-Delegate: kuba@kernel.org
-Date: Tue, 17 Sep 2024 14:49:40 +0100
-From: Daniel Golle <daniel@makrotopia.org>
-To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>,
-       Russell King <linux@armlinux.org.uk>,
-       "David S. Miller" <davem@davemloft.net>,
-       Eric Dumazet <edumazet@google.com>,
-       Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
-       Daniel Golle <daniel@makrotopia.org>,
-       Christian Marangi <ansuelsmth@gmail.com>,
-       Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
-       Robert Marko <robimarko@gmail.com>,
-       Russell King <rmk+kernel@armlinux.org.uk>, netdev@vger.kernel.org,
-       linux-kernel@vger.kernel.org
-Subject: [PATCH net 1/2] net: phy: aquantia: fix setting active_low bit
-Message-ID: 
- <ab963584b0a7e3b4dac39472a4b82ca264d79630.1726580902.git.daniel@makrotopia.org>
-Precedence: bulk
-X-Mailing-List: netdev@vger.kernel.org
-List-Id: <netdev.vger.kernel.org>
-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
-MIME-Version: 1.0
-Content-Disposition: inline
-X-Patchwork-Delegate: kuba@kernel.org
-
-phy_modify_mmd was used wrongly in aqr_phy_led_active_low_set() resulting
-in a no-op instead of setting the VEND1_GLOBAL_LED_DRIVE_VDD bit.
-Correctly set VEND1_GLOBAL_LED_DRIVE_VDD bit.
-
-Fixes: 61578f679378 ("net: phy: aquantia: add support for PHY LEDs")
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
----
- drivers/net/phy/aquantia/aquantia_leds.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/phy/aquantia/aquantia_leds.c
-+++ b/drivers/net/phy/aquantia/aquantia_leds.c
-@@ -120,7 +120,8 @@ int aqr_phy_led_hw_control_set(struct ph
- int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable)
- {
-       return phy_modify_mmd(phydev, MDIO_MMD_VEND1, AQR_LED_DRIVE(index),
--                            VEND1_GLOBAL_LED_DRIVE_VDD, enable);
-+                            VEND1_GLOBAL_LED_DRIVE_VDD,
-+                            enable ? VEND1_GLOBAL_LED_DRIVE_VDD : 0);
- }
- int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes)
diff --git a/target/linux/generic/pending-6.6/751-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch b/target/linux/generic/pending-6.6/751-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch
deleted file mode 100644 (file)
index 6d71b3d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-From patchwork Tue Sep 17 13:49:55 2024
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
-X-Patchwork-Id: 13806177
-X-Patchwork-Delegate: kuba@kernel.org
-Date: Tue, 17 Sep 2024 14:49:55 +0100
-From: Daniel Golle <daniel@makrotopia.org>
-To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>,
-       Russell King <linux@armlinux.org.uk>,
-       "David S. Miller" <davem@davemloft.net>,
-       Eric Dumazet <edumazet@google.com>,
-       Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
-       Daniel Golle <daniel@makrotopia.org>,
-       Christian Marangi <ansuelsmth@gmail.com>,
-       Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
-       Robert Marko <robimarko@gmail.com>,
-       Russell King <rmk+kernel@armlinux.org.uk>, netdev@vger.kernel.org,
-       linux-kernel@vger.kernel.org
-Subject: [PATCH net 2/2] net: phy: aquantia: fix applying active_low bit
- after reset
-Message-ID: 
- <9b1f0cd91f4cda54c8be56b4fe780480baf4aa0f.1726580902.git.daniel@makrotopia.org>
-References: 
- <ab963584b0a7e3b4dac39472a4b82ca264d79630.1726580902.git.daniel@makrotopia.org>
-Precedence: bulk
-X-Mailing-List: netdev@vger.kernel.org
-List-Id: <netdev.vger.kernel.org>
-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
-MIME-Version: 1.0
-Content-Disposition: inline
-In-Reply-To: 
- <ab963584b0a7e3b4dac39472a4b82ca264d79630.1726580902.git.daniel@makrotopia.org>
-X-Patchwork-Delegate: kuba@kernel.org
-
-for_each_set_bit was used wrongly in aqr107_config_init() when iterating
-over LEDs. Drop misleading 'index' variable and call
-aqr_phy_led_active_low_set() for each set bit representing an LED which
-is driven by VDD instead of GND pin.
-
-Fixes: 61578f679378 ("net: phy: aquantia: add support for PHY LEDs")
-Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
----
- drivers/net/phy/aquantia/aquantia_main.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
---- a/drivers/net/phy/aquantia/aquantia_main.c
-+++ b/drivers/net/phy/aquantia/aquantia_main.c
-@@ -530,7 +530,7 @@ static int aqr107_config_init(struct phy
- {
-       struct aqr107_priv *priv = phydev->priv;
-       u32 led_active_low;
--      int ret, index = 0;
-+      int ret;
-       /* Check that the PHY interface type is compatible */
-       if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
-@@ -570,10 +570,9 @@ static int aqr107_config_init(struct phy
-       /* Restore LED polarity state after reset */
-       for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) {
--              ret = aqr_phy_led_active_low_set(phydev, index, led_active_low);
-+              ret = aqr_phy_led_active_low_set(phydev, led_active_low, true);
-               if (ret)
-                       return ret;
--              index++;
-       }
-       return 0;
index 93bbd0103bb0115c201b902b8dc3c37d18863e6a..ccf85fc1108757f1bfa325ae6d232f4b4d66abf3 100644 (file)
                                reg = <2>;
                                function = LED_FUNCTION_WAN;
                                color = <LED_COLOR_ID_WHITE>;
-                               active-low;
+                               active-high;
                        };
                };
        };
                                reg = <2>;
                                function = LED_FUNCTION_LAN;
                                color = <LED_COLOR_ID_WHITE>;
-                               active-low;
+                               active-high;
                        };
                };
        };