[source] kernel: rtl8306: fix port link status

LEDE Commits lede-commits at lists.infradead.org
Sat Sep 9 03:24:42 PDT 2017


mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/096dff8fcdf4eeb0d94ea335b95a23b30f5d5f3d

commit 096dff8fcdf4eeb0d94ea335b95a23b30f5d5f3d
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Thu Aug 31 07:52:00 2017 +0200

    kernel: rtl8306: fix port link status
    
    In case the link changes from down to up, the register is only updated
    on read. If the link failed/was down, this bit will be 0 until after
    reading this bit again.
    
    Fixes a reported link down by swconfig alebit the link is up (query for
    the link again will show the correct link status)
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/generic/files/drivers/net/phy/rtl8306.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/linux/generic/files/drivers/net/phy/rtl8306.c b/target/linux/generic/files/drivers/net/phy/rtl8306.c
index 7c70109..7bbac40 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8306.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8306.c
@@ -592,8 +592,12 @@ rtl_get_port_link(struct switch_dev *dev, int port, struct switch_port_link *lin
 	if (port >= RTL8306_NUM_PORTS)
 		return -EINVAL;
 
+	/* in case the link changes from down to up, the register is only updated on read */
 	link->link = rtl_get(dev, RTL_PORT_REG(port, LINK));
 	if (!link->link)
+		link->link = rtl_get(dev, RTL_PORT_REG(port, LINK));
+
+	if (!link->link)
 		return 0;
 
 	link->duplex = rtl_get(dev, RTL_PORT_REG(port, DUPLEX));



More information about the lede-commits mailing list