summaryrefslogtreecommitdiff
path: root/target/linux/mvebu/patches-4.9/409-net-phy-don-t-double-read-clause-45-status-register.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2017-02-06 11:46:48 +0100
committerFelix Fietkau <nbd@nbd.name>2017-02-16 17:17:15 +0100
commit2bf9ea6a31736db059aa97addce3a34b933dacc1 (patch)
treeecfe628aabaf38e6bd40ca841443d19079105a83 /target/linux/mvebu/patches-4.9/409-net-phy-don-t-double-read-clause-45-status-register.patch
parent237454991618e0e8b7ceb8a8a2a43fca12c1a454 (diff)
downloadmtk-20170518-2bf9ea6a31736db059aa97addce3a34b933dacc1.zip
mtk-20170518-2bf9ea6a31736db059aa97addce3a34b933dacc1.tar.gz
mtk-20170518-2bf9ea6a31736db059aa97addce3a34b933dacc1.tar.bz2
mvebu: add linux 4.9 support
Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/mvebu/patches-4.9/409-net-phy-don-t-double-read-clause-45-status-register.patch')
-rw-r--r--target/linux/mvebu/patches-4.9/409-net-phy-don-t-double-read-clause-45-status-register.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/target/linux/mvebu/patches-4.9/409-net-phy-don-t-double-read-clause-45-status-register.patch b/target/linux/mvebu/patches-4.9/409-net-phy-don-t-double-read-clause-45-status-register.patch
new file mode 100644
index 0000000..ee53fe0
--- /dev/null
+++ b/target/linux/mvebu/patches-4.9/409-net-phy-don-t-double-read-clause-45-status-register.patch
@@ -0,0 +1,35 @@
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Thu, 5 Jan 2017 00:23:40 +0000
+Subject: [PATCH] net: phy: don't double-read clause 45 status register
+
+One of the design decisions behind the link status bit in the status
+register is that it latches low on link loss. This is so that link loss
+events are not missed. Double-reading the status register means that we
+always read the current state of the link, clearing any link loss event.
+
+This can cause problems - for example, if the link has negotiated a
+different set of operating parameters, these will not be communicated
+to the MAC as the PHY state machine will still think that the link has
+remained active.
+
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+---
+
+--- a/drivers/net/phy/phy-c45.c
++++ b/drivers/net/phy/phy-c45.c
+@@ -143,12 +143,9 @@ int genphy_c45_read_link(struct phy_devi
+ devad = __ffs(mmd_mask);
+ mmd_mask &= ~BIT(devad);
+
+- val = phy_read_mmd(phydev, devad, MDIO_STAT1);
+- if (val < 0)
+- return val;
+-
+- /* Read twice because link state is latched and a
+- * read moves the current state into the register
++ /* The link state is latched low so that momentary link
++ * drops can be detected. Do not double-read the status
++ * register if the link is down.
+ */
+ val = phy_read_mmd(phydev, devad, MDIO_STAT1);
+ if (val < 0)