aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-16 23:40:32 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-17 15:11:22 +0200
commit20ea6adbf199097c4f5f591ffee088340630dae4 (patch)
treed6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch
parentbca05bd072180dc38ef740b37ded9572a6db1981 (diff)
downloadupstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip
bcm27xx: add support for linux v5.15
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.15/950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch b/target/linux/bcm27xx/patches-5.15/950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch
new file mode 100644
index 0000000000..6693f86aea
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.15/950-0700-net-phy-lan87xx-Decrease-phy-polling-rate.patch
@@ -0,0 +1,55 @@
+From 01649f43afb30df3c7450fd09c04a5a8ee6cb2c1 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil@raspberrypi.com>
+Date: Thu, 3 Feb 2022 15:51:41 +0000
+Subject: [PATCH] net: phy: lan87xx: Decrease phy polling rate
+
+Polling at 100Hz for 1.5s consumes quite a bit of kworker time with no
+obvious benefit. Reduce that polling rate to ~6Hz.
+
+To further save CPU and power, defer the next poll if no energy is
+detected.
+
+See: https://github.com/raspberrypi/linux/issues/4780
+
+Signed-off-by: Phil Elwell <phil@raspberrypi.com>
+---
+ drivers/net/phy/smsc.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/phy/smsc.c
++++ b/drivers/net/phy/smsc.c
+@@ -218,6 +218,8 @@ static int lan87xx_read_status(struct ph
+ int err = genphy_read_status(phydev);
+
+ if (!phydev->link && priv->energy_enable) {
++ int energy_detected;
++
+ /* Disable EDPD to wake up PHY */
+ int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
+ if (rc < 0)
+@@ -233,7 +235,7 @@ static int lan87xx_read_status(struct ph
+ */
+ read_poll_timeout(phy_read, rc,
+ rc & MII_LAN83C185_ENERGYON || rc < 0,
+- 10000, 1500000, true, phydev,
++ 150000, 1500000, true, phydev,
+ MII_LAN83C185_CTRL_STATUS);
+ if (rc < 0)
+ return rc;
+@@ -243,10 +245,16 @@ static int lan87xx_read_status(struct ph
+ if (rc < 0)
+ return rc;
+
++ energy_detected = !!(rc & MII_LAN83C185_ENERGYON);
++
+ rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
+ rc | MII_LAN83C185_EDPWRDOWN);
+ if (rc < 0)
+ return rc;
++
++ /* Save CPU and power by deferring the next poll */
++ if (!energy_detected)
++ msleep(2000);
+ }
+
+ return err;