ipq40xx: add v5.4 support
[openwrt/staging/jow.git] / target / linux / ipq40xx / patches-5.4 / 706-ar40xx-abort-probe-on-missig-phy.patch
1 Index: linux-5.4.11/drivers/net/phy/ar40xx.c
2 ===================================================================
3 --- linux-5.4.11.orig/drivers/net/phy/ar40xx.c
4 +++ linux-5.4.11/drivers/net/phy/ar40xx.c
5 @@ -1808,8 +1808,8 @@ ar40xx_phy_probe(struct phy_device *phyd
6 if (phydev->mdio.addr == 0)
7 ar40xx_priv->phy = phydev;
8
9 - phydev->supported |= SUPPORTED_1000baseT_Full;
10 - phydev->advertising |= ADVERTISED_1000baseT_Full;
11 + phy_set_max_speed(phydev, SPEED_1000);
12 + linkmode_copy(phydev->advertising, phydev->supported);
13 return 0;
14 }
15
16 @@ -2021,6 +2021,12 @@ static int ar40xx_probe(struct platform_
17 /* register switch */
18 swdev = &priv->dev;
19
20 + if (priv->mii_bus == NULL) {
21 + dev_err(&pdev->dev, "Probe failed - Missing PHYs!\n");
22 + ret = -ENODEV;
23 + goto err_missing_phy;
24 + }
25 +
26 swdev->alias = dev_name(&priv->mii_bus->dev);
27
28 swdev->cpu_port = AR40XX_PORT_CPU;
29 @@ -2052,6 +2058,7 @@ err_unregister_switch:
30 unregister_switch(&priv->dev);
31 err_unregister_phy:
32 phy_driver_unregister(&ar40xx_phy_driver);
33 +err_missing_phy:
34 platform_set_drvdata(pdev, NULL);
35 return ret;
36 }