kernel: rtl8306: fix port link status
[openwrt/openwrt.git] / target / linux / generic / files / drivers / net / phy / rtl8306.c
index 7c70109e633693b657f0c2ff61949cbb208b413e..7bbac40617bc8123d62e6aba2814516560199134 100644 (file)
@@ -592,7 +592,11 @@ 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;