ipq40xx: merge all ar40xx patches into one single patch
[openwrt/staging/jow.git] / target / linux / ipq40xx / patches-5.4 / 705-net-add-qualcomm-ar40xx-phy.patch
index 5feea6d4e02b4fbc5b82adfe96c1703063d2f846..648723df0698f6d9d2cb17b8f6b99d2d294f9bd0 100644 (file)
@@ -1,6 +1,8 @@
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -526,6 +526,13 @@ config MDIO_IPQ40XX
+Index: linux-5.4.51/drivers/net/phy/Kconfig
+===================================================================
+--- linux-5.4.51.orig/drivers/net/phy/Kconfig
++++ linux-5.4.51/drivers/net/phy/Kconfig
+@@ -587,6 +587,13 @@ config MDIO_IPQ40XX
          This driver supports the MDIO interface found in Qualcomm
          Atheros ipq40xx Soc chip.
  
  endif # PHYLIB
  
  config MICREL_KS8995MA
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -62,6 +62,7 @@ obj-y                                += $(sfp-obj-y) $(sfp-obj-m)
- obj-$(CONFIG_AMD_PHY)         += amd.o
+Index: linux-5.4.51/drivers/net/phy/Makefile
+===================================================================
+--- linux-5.4.51.orig/drivers/net/phy/Makefile
++++ linux-5.4.51/drivers/net/phy/Makefile
+@@ -70,6 +70,7 @@ ifdef CONFIG_HWMON
+ aquantia-objs                 += aquantia_hwmon.o
+ endif
  obj-$(CONFIG_AQUANTIA_PHY)    += aquantia.o
 +obj-$(CONFIG_AR40XX_PHY)      += ar40xx.o
  obj-$(CONFIG_AX88796B_PHY)    += ax88796b.o
  obj-$(CONFIG_AT803X_PHY)      += at803x.o
  obj-$(CONFIG_BCM63XX_PHY)     += bcm63xx.o
+Index: linux-5.4.51/drivers/net/phy/ar40xx.c
+===================================================================
 --- /dev/null
-+++ b/drivers/net/phy/ar40xx.c
-@@ -0,0 +1,2090 @@
++++ linux-5.4.51/drivers/net/phy/ar40xx.c
+@@ -0,0 +1,2097 @@
 +/*
 + * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 + *
 +      if (phydev->mdio.addr == 0)
 +              ar40xx_priv->phy = phydev;
 +
-+      phydev->supported |= SUPPORTED_1000baseT_Full;
-+      phydev->advertising |= ADVERTISED_1000baseT_Full;
++      linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported);
++      linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->advertising);
 +      return 0;
 +}
 +
 +      .phy_id         = 0x004d0000,
 +      .name           = "QCA Malibu",
 +      .phy_id_mask    = 0xffff0000,
-+      .features       = PHY_BASIC_FEATURES,
++      .features       = PHY_GBIT_FEATURES,
 +      .probe          = ar40xx_phy_probe,
 +      .remove         = ar40xx_phy_remove,
 +      .config_init    = ar40xx_phy_config_init,
 +      /* register switch */
 +      swdev = &priv->dev;
 +
++      if (priv->mii_bus == NULL) {
++              dev_err(&pdev->dev, "Probe failed - Missing PHYs!\n");
++              ret = -ENODEV;
++              goto err_missing_phy;
++      }
++
 +      swdev->alias = dev_name(&priv->mii_bus->dev);
 +
 +      swdev->cpu_port = AR40XX_PORT_CPU;
 +      unregister_switch(&priv->dev);
 +err_unregister_phy:
 +      phy_driver_unregister(&ar40xx_phy_driver);
++err_missing_phy:
 +      platform_set_drvdata(pdev, NULL);
 +      return ret;
 +}
 +
 +MODULE_DESCRIPTION("IPQ40XX ESS driver");
 +MODULE_LICENSE("Dual BSD/GPL");
+Index: linux-5.4.51/drivers/net/phy/ar40xx.h
+===================================================================
 --- /dev/null
-+++ b/drivers/net/phy/ar40xx.h
++++ linux-5.4.51/drivers/net/phy/ar40xx.h
 @@ -0,0 +1,337 @@
 +/*
 + * Copyright (c) 2016, The Linux Foundation. All rights reserved.