kernel: bump 4.9 to 4.9.146
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.9 / 703-phy-support-layerscape.patch
index 0e8e3695f31a8b397a178364b7cb43860197659d..9c23279188261d1c78c8db0ace2b295d512c631a 100644 (file)
@@ -1,9 +1,9 @@
-From be07319b9897738a4ab1501880b7dd9be26eba66 Mon Sep 17 00:00:00 2001
+From 8949ebc0c5b982eab7ca493dad7b86c30befa6ec Mon Sep 17 00:00:00 2001
 From: Yangbo Lu <yangbo.lu@nxp.com>
-Date: Mon, 25 Sep 2017 11:54:28 +0800
-Subject: [PATCH] phy: support layerscape
+Date: Wed, 17 Jan 2018 15:01:30 +0800
+Subject: [PATCH 09/30] phy: support layerscape
 
-This is a integrated patch for layerscape mdio-phy support.
+This is an integrated patch for layerscape mdio-phy support.
 
 Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
 Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
@@ -18,16 +18,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  drivers/net/phy/aquantia.c      |   28 +
  drivers/net/phy/cortina.c       |  118 ++++
  drivers/net/phy/fsl_backplane.c | 1358 +++++++++++++++++++++++++++++++++++++++
+ drivers/net/phy/marvell.c       |    2 +-
  drivers/net/phy/phy.c           |   23 +-
  drivers/net/phy/phy_device.c    |    6 +-
  drivers/net/phy/swphy.c         |    1 +
- include/linux/phy.h             |    4 +
9 files changed, 1544 insertions(+), 7 deletions(-)
+ include/linux/phy.h             |    6 +
10 files changed, 1547 insertions(+), 8 deletions(-)
  create mode 100644 drivers/net/phy/cortina.c
  create mode 100644 drivers/net/phy/fsl_backplane.c
 
-diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
-index 30a3a2f5..3521c1ac 100644
 --- a/drivers/net/phy/Kconfig
 +++ b/drivers/net/phy/Kconfig
 @@ -89,6 +89,12 @@ config MDIO_BUS_MUX_MMIOREG
@@ -55,11 +54,9 @@ index 30a3a2f5..3521c1ac 100644
  config DAVICOM_PHY
        tristate "Davicom PHYs"
        ---help---
-diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
-index 93a68fcd..ef3ec265 100644
 --- a/drivers/net/phy/Makefile
 +++ b/drivers/net/phy/Makefile
-@@ -30,6 +30,7 @@ obj-$(CONFIG_MDIO_BUS_MUX_BCM_IPROC) += mdio-mux-bcm-iproc.o
+@@ -30,6 +30,7 @@ obj-$(CONFIG_MDIO_BUS_MUX_BCM_IPROC) +=
  obj-$(CONFIG_MDIO_BUS_MUX_GPIO)       += mdio-mux-gpio.o
  obj-$(CONFIG_MDIO_BUS_MUX_MMIOREG) += mdio-mux-mmioreg.o
  obj-$(CONFIG_MDIO_CAVIUM)     += mdio-cavium.o
@@ -67,7 +64,7 @@ index 93a68fcd..ef3ec265 100644
  obj-$(CONFIG_MDIO_GPIO)               += mdio-gpio.o
  obj-$(CONFIG_MDIO_HISI_FEMAC) += mdio-hisi-femac.o
  obj-$(CONFIG_MDIO_MOXART)     += mdio-moxart.o
-@@ -48,6 +49,7 @@ obj-$(CONFIG_BCM_CYGNUS_PHY) += bcm-cygnus.o
+@@ -48,6 +49,7 @@ obj-$(CONFIG_BCM_CYGNUS_PHY) += bcm-cygn
  obj-$(CONFIG_BCM_NET_PHYLIB)  += bcm-phy-lib.o
  obj-$(CONFIG_BROADCOM_PHY)    += broadcom.o
  obj-$(CONFIG_CICADA_PHY)      += cicada.o
@@ -75,8 +72,6 @@ index 93a68fcd..ef3ec265 100644
  obj-$(CONFIG_DAVICOM_PHY)     += davicom.o
  obj-$(CONFIG_DP83640_PHY)     += dp83640.o
  obj-$(CONFIG_DP83848_PHY)     += dp83848.o
-diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
-index 09b0b0aa..e8ae50e1 100644
 --- a/drivers/net/phy/aquantia.c
 +++ b/drivers/net/phy/aquantia.c
 @@ -21,6 +21,8 @@
@@ -88,11 +83,10 @@ index 09b0b0aa..e8ae50e1 100644
  #define PHY_ID_AQR405 0x03a1b4b0
  
  #define PHY_AQUANTIA_FEATURES (SUPPORTED_10000baseT_Full | \
-@@ -153,6 +155,30 @@ static struct phy_driver aquantia_driver[] = {
-       .ack_interrupt  = aquantia_ack_interrupt,
+@@ -154,6 +156,30 @@ static struct phy_driver aquantia_driver
        .read_status    = aquantia_read_status,
  },
-+{
+ {
 +      .phy_id         = PHY_ID_AQR106,
 +      .phy_id_mask    = 0xfffffff0,
 +      .name           = "Aquantia AQR106",
@@ -116,10 +110,11 @@ index 09b0b0aa..e8ae50e1 100644
 +      .ack_interrupt  = aquantia_ack_interrupt,
 +      .read_status    = aquantia_read_status,
 +},
- {
++{
        .phy_id         = PHY_ID_AQR405,
        .phy_id_mask    = 0xfffffff0,
-@@ -173,6 +199,8 @@ static struct mdio_device_id __maybe_unused aquantia_tbl[] = {
+       .name           = "Aquantia AQR405",
+@@ -173,6 +199,8 @@ static struct mdio_device_id __maybe_unu
        { PHY_ID_AQ1202, 0xfffffff0 },
        { PHY_ID_AQ2104, 0xfffffff0 },
        { PHY_ID_AQR105, 0xfffffff0 },
@@ -128,9 +123,6 @@ index 09b0b0aa..e8ae50e1 100644
        { PHY_ID_AQR405, 0xfffffff0 },
        { }
  };
-diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c
-new file mode 100644
-index 00000000..72f4228a
 --- /dev/null
 +++ b/drivers/net/phy/cortina.c
 @@ -0,0 +1,118 @@
@@ -252,9 +244,6 @@ index 00000000..72f4228a
 +};
 +
 +MODULE_DEVICE_TABLE(mdio, cortina_tbl);
-diff --git a/drivers/net/phy/fsl_backplane.c b/drivers/net/phy/fsl_backplane.c
-new file mode 100644
-index 00000000..76865261
 --- /dev/null
 +++ b/drivers/net/phy/fsl_backplane.c
 @@ -0,0 +1,1358 @@
@@ -1616,11 +1605,9 @@ index 00000000..76865261
 +MODULE_DESCRIPTION("Freescale Backplane driver");
 +MODULE_AUTHOR("Shaohui Xie <Shaohui.Xie@freescale.com>");
 +MODULE_LICENSE("GPL v2");
-diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
-index f3e64a89..42cdd5b7 100644
 --- a/drivers/net/phy/phy.c
 +++ b/drivers/net/phy/phy.c
-@@ -585,7 +585,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
+@@ -591,7 +591,7 @@ int phy_mii_ioctl(struct phy_device *phy
                return 0;
  
        case SIOCSHWTSTAMP:
@@ -1629,7 +1616,7 @@ index f3e64a89..42cdd5b7 100644
                        return phydev->drv->hwtstamp(phydev, ifr);
                /* fall through */
  
-@@ -610,6 +610,9 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync)
+@@ -616,6 +616,9 @@ static int phy_start_aneg_priv(struct ph
        bool trigger = 0;
        int err;
  
@@ -1639,7 +1626,7 @@ index f3e64a89..42cdd5b7 100644
        mutex_lock(&phydev->lock);
  
        if (AUTONEG_DISABLE == phydev->autoneg)
-@@ -1009,7 +1012,7 @@ void phy_state_machine(struct work_struct *work)
+@@ -1015,7 +1018,7 @@ void phy_state_machine(struct work_struc
  
        old_state = phydev->state;
  
@@ -1648,7 +1635,7 @@ index f3e64a89..42cdd5b7 100644
                phydev->drv->link_change_notify(phydev);
  
        switch (phydev->state) {
-@@ -1311,6 +1314,9 @@ EXPORT_SYMBOL(phy_write_mmd_indirect);
+@@ -1317,6 +1320,9 @@ EXPORT_SYMBOL(phy_write_mmd_indirect);
   */
  int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
  {
@@ -1658,7 +1645,7 @@ index f3e64a89..42cdd5b7 100644
        /* According to 802.3az,the EEE is supported only in full duplex-mode.
         * Also EEE feature is active when core is operating with MII, GMII
         * or RGMII (all kinds). Internal PHYs are also allowed to proceed and
-@@ -1388,6 +1394,9 @@ EXPORT_SYMBOL(phy_init_eee);
+@@ -1394,6 +1400,9 @@ EXPORT_SYMBOL(phy_init_eee);
   */
  int phy_get_eee_err(struct phy_device *phydev)
  {
@@ -1668,7 +1655,7 @@ index f3e64a89..42cdd5b7 100644
        return phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_WK_ERR, MDIO_MMD_PCS);
  }
  EXPORT_SYMBOL(phy_get_eee_err);
-@@ -1404,6 +1413,9 @@ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data)
+@@ -1410,6 +1419,9 @@ int phy_ethtool_get_eee(struct phy_devic
  {
        int val;
  
@@ -1678,7 +1665,7 @@ index f3e64a89..42cdd5b7 100644
        /* Get Supported EEE */
        val = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, MDIO_MMD_PCS);
        if (val < 0)
-@@ -1437,6 +1449,9 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
+@@ -1443,6 +1455,9 @@ int phy_ethtool_set_eee(struct phy_devic
  {
        int val = ethtool_adv_to_mmd_eee_adv_t(data->advertised);
  
@@ -1688,7 +1675,7 @@ index f3e64a89..42cdd5b7 100644
        /* Mask prohibited EEE modes */
        val &= ~phydev->eee_broken_modes;
  
-@@ -1448,7 +1463,7 @@ EXPORT_SYMBOL(phy_ethtool_set_eee);
+@@ -1454,7 +1469,7 @@ EXPORT_SYMBOL(phy_ethtool_set_eee);
  
  int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
  {
@@ -1697,7 +1684,7 @@ index f3e64a89..42cdd5b7 100644
                return phydev->drv->set_wol(phydev, wol);
  
        return -EOPNOTSUPP;
-@@ -1457,7 +1472,7 @@ EXPORT_SYMBOL(phy_ethtool_set_wol);
+@@ -1463,7 +1478,7 @@ EXPORT_SYMBOL(phy_ethtool_set_wol);
  
  void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
  {
@@ -1706,11 +1693,9 @@ index f3e64a89..42cdd5b7 100644
                phydev->drv->get_wol(phydev, wol);
  }
  EXPORT_SYMBOL(phy_ethtool_get_wol);
-diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
-index 5fdc491e..039f9664 100644
 --- a/drivers/net/phy/phy_device.c
 +++ b/drivers/net/phy/phy_device.c
-@@ -1046,7 +1046,7 @@ int phy_suspend(struct phy_device *phydev)
+@@ -1046,7 +1046,7 @@ int phy_suspend(struct phy_device *phyde
        if (wol.wolopts)
                return -EBUSY;
  
@@ -1719,7 +1704,7 @@ index 5fdc491e..039f9664 100644
                ret = phydrv->suspend(phydev);
  
        if (ret)
-@@ -1063,7 +1063,7 @@ int phy_resume(struct phy_device *phydev)
+@@ -1063,7 +1063,7 @@ int phy_resume(struct phy_device *phydev
        struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
        int ret = 0;
  
@@ -1728,7 +1713,7 @@ index 5fdc491e..039f9664 100644
                ret = phydrv->resume(phydev);
  
        if (ret)
-@@ -1726,7 +1726,7 @@ static int phy_remove(struct device *dev)
+@@ -1720,7 +1720,7 @@ static int phy_remove(struct device *dev
        phydev->state = PHY_DOWN;
        mutex_unlock(&phydev->lock);
  
@@ -1737,11 +1722,9 @@ index 5fdc491e..039f9664 100644
                phydev->drv->remove(phydev);
        phydev->drv = NULL;
  
-diff --git a/drivers/net/phy/swphy.c b/drivers/net/phy/swphy.c
-index 34f58f23..52ddddbe 100644
 --- a/drivers/net/phy/swphy.c
 +++ b/drivers/net/phy/swphy.c
-@@ -77,6 +77,7 @@ static const struct swmii_regs duplex[] = {
+@@ -77,6 +77,7 @@ static const struct swmii_regs duplex[]
  static int swphy_decode_speed(int speed)
  {
        switch (speed) {
@@ -1749,19 +1732,26 @@ index 34f58f23..52ddddbe 100644
        case 1000:
                return SWMII_SPEED_1000;
        case 100:
-diff --git a/include/linux/phy.h b/include/linux/phy.h
-index 850c8b51..5f253f1a 100644
 --- a/include/linux/phy.h
 +++ b/include/linux/phy.h
 @@ -81,6 +81,7 @@ typedef enum {
        PHY_INTERFACE_MODE_MOCA,
        PHY_INTERFACE_MODE_QSGMII,
        PHY_INTERFACE_MODE_TRGMII,
-+      PHY_INTERFACE_MODE_SGMII_2500,
++      PHY_INTERFACE_MODE_2500SGMII,
        PHY_INTERFACE_MODE_MAX,
  } phy_interface_t;
  
-@@ -784,6 +785,9 @@ int phy_stop_interrupts(struct phy_device *phydev);
+@@ -126,6 +127,8 @@ static inline const char *phy_modes(phy_
+               return "qsgmii";
+       case PHY_INTERFACE_MODE_TRGMII:
+               return "trgmii";
++      case PHY_INTERFACE_MODE_2500SGMII:
++              return "sgmii-2500";
+       default:
+               return "unknown";
+       }
+@@ -791,6 +794,9 @@ int phy_stop_interrupts(struct phy_devic
  
  static inline int phy_read_status(struct phy_device *phydev)
  {
@@ -1771,6 +1761,3 @@ index 850c8b51..5f253f1a 100644
        return phydev->drv->read_status(phydev);
  }
  
--- 
-2.14.1
-