lantiq: new image build process - fix kernel entry address
[openwrt.git] / target / linux / lantiq / patches-4.4 / 0400-xrx200-net-multi-phy.patch
1 --- a/drivers/net/ethernet/lantiq_xrx200.c
2 +++ b/drivers/net/ethernet/lantiq_xrx200.c
3 @@ -1209,13 +1209,18 @@ static void xrx200_gmac_update(struct xr
4  static void xrx200_mdio_link(struct net_device *dev)
5  {
6         struct xrx200_priv *priv = netdev_priv(dev);
7 +       bool changed = false, link = false;
8         int i;
9  
10         for (i = 0; i < priv->num_port; i++) {
11                 if (!priv->port[i].phydev)
12                         continue;
13  
14 +               if (priv->port[i].phydev->link)
15 +                       link = true;
16 +
17                 if (priv->port[i].link != priv->port[i].phydev->link) {
18 +                       changed = true;
19                         xrx200_gmac_update(&priv->port[i]);
20                         priv->port[i].link = priv->port[i].phydev->link;
21                         netdev_info(dev, "port %d %s link\n",
22 @@ -1223,6 +1228,8 @@ static void xrx200_mdio_link(struct net_
23                                 (priv->port[i].link)?("got"):("lost"));
24                 }
25         }
26 +       if (changed && !link)
27 +               netif_carrier_off(dev);
28  }
29  
30  static inline int xrx200_mdio_poll(struct mii_bus *bus)
31 @@ -1300,6 +1307,7 @@ static int xrx200_mdio_probe(struct net_
32                         | SUPPORTED_TP);
33         phydev->advertising = phydev->supported;
34         port->phydev = phydev;
35 +       phydev->no_auto_carrier_off = true;
36  
37         pr_info("%s: attached PHY [%s] (phy_addr=%s, irq=%d)\n",
38                 dev->name, phydev->drv->name,