lantiq: 5.15: refresh patches
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Mon, 21 Mar 2022 17:39:03 +0000 (18:39 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 22 Oct 2022 17:44:45 +0000 (19:44 +0200)
0001-MIPS-lantiq-add-pcie-driver.patch needs to drop
MODULE_SUPPORTED_DEVICE because that macro is gone on newer kernels.

Add checks for copy_{to,from}_user in
0008-MIPS-lantiq-backport-old-timer-code.patch which is now mandatory.

0705-v5.13-net-dsa-lantiq-allow-to-use-all-GPHYs-on-xRX300-and-.patch
get dropped because it's a backport from Linux 5.13.

All other patches are refreshed.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
17 files changed:
target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch
target/linux/lantiq/patches-5.15/0004-MIPS-lantiq-add-atm-hack.patch
target/linux/lantiq/patches-5.15/0008-MIPS-lantiq-backport-old-timer-code.patch
target/linux/lantiq/patches-5.15/0023-NET-PHY-add-led-support-for-intel-xway.patch
target/linux/lantiq/patches-5.15/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
target/linux/lantiq/patches-5.15/0050-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch
target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch
target/linux/lantiq/patches-5.15/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch
target/linux/lantiq/patches-5.15/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch
target/linux/lantiq/patches-5.15/0702-v5.16-net-lantiq-add-support-for-jumbo-frames.patch
target/linux/lantiq/patches-5.15/0703-v5.16-net-lantiq_xrx200-increase-buffer-reservation.patch
target/linux/lantiq/patches-5.15/0705-v5.13-net-dsa-lantiq-allow-to-use-all-GPHYs-on-xRX300-and-.patch [deleted file]
target/linux/lantiq/patches-5.15/0706-v5.18-net-lantiq-enable-jumbo-frames-on-GSWIP.patch
target/linux/lantiq/patches-5.15/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch
target/linux/lantiq/patches-5.15/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch
target/linux/lantiq/patches-5.15/0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch
target/linux/lantiq/patches-5.15/0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch

index 99bed24cfd566725d693b42c87b1e3420ff1fcae..2276b38c6e80d66092e4d9f750abbb60e96c38c5 100644 (file)
@@ -242,7 +242,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +
 --- /dev/null
 +++ b/arch/mips/pci/ifxmips_pcie.c
-@@ -0,0 +1,1092 @@
+@@ -0,0 +1,1091 @@
 +/*
 + *  This program is free software; you can redistribute it and/or modify it
 + *  under the terms of the GNU General Public License version 2 as published
@@ -1332,7 +1332,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +
 +MODULE_LICENSE("GPL");
 +MODULE_AUTHOR("Chuanhua.Lei@infineon.com");
-+MODULE_SUPPORTED_DEVICE("Infineon builtin PCIe RC module");
 +MODULE_DESCRIPTION("Infineon builtin PCIe RC driver");
 +
 --- /dev/null
@@ -1764,7 +1763,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +#endif /* IFXMIPS_PCIE_AR10_H */
 --- /dev/null
 +++ b/arch/mips/pci/ifxmips_pcie_msi.c
-@@ -0,0 +1,392 @@
+@@ -0,0 +1,391 @@
 +/******************************************************************************
 +**
 +** FILE NAME    : ifxmips_pcie_msi.c
@@ -2154,7 +2153,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +
 +MODULE_LICENSE("GPL");
 +MODULE_AUTHOR("Chuanhua.Lei@infineon.com");
-+MODULE_SUPPORTED_DEVICE("Infineon PCIe IP builtin MSI PIC module");
 +MODULE_DESCRIPTION("Infineon PCIe IP builtin MSI PIC driver");
 +
 --- /dev/null
@@ -4134,7 +4132,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +
 --- a/arch/mips/pci/pci-legacy.c
 +++ b/arch/mips/pci/pci-legacy.c
-@@ -313,3 +313,30 @@ char *__init pcibios_setup(char *str)
+@@ -305,3 +305,30 @@ char *__init pcibios_setup(char *str)
                return pcibios_plat_setup(str);
        return str;
  }
@@ -5481,7 +5479,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
          (transaction layer end-to-end CRC checking).
 --- a/include/linux/pci.h
 +++ b/include/linux/pci.h
-@@ -1420,6 +1420,8 @@ void pci_walk_bus(struct pci_bus *top, i
+@@ -1480,6 +1480,8 @@ void pci_walk_bus(struct pci_bus *top, i
                  void *userdata);
  int pci_cfg_space_size(struct pci_dev *dev);
  unsigned char pci_bus_max_busnr(struct pci_bus *bus);
@@ -5492,7 +5490,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                                         unsigned long type);
 --- a/include/linux/pci_ids.h
 +++ b/include/linux/pci_ids.h
-@@ -1079,6 +1079,12 @@
+@@ -1085,6 +1085,12 @@
  #define PCI_DEVICE_ID_SGI_IOC3                0x0003
  #define PCI_DEVICE_ID_SGI_LITHIUM     0x1002
  
index e215df60ee717a156103c7ee1d7a3d5359ec2f4a..e32e4e2daaeff3ba29cfffa8047a63530e1dc3c2 100644 (file)
@@ -423,7 +423,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +
 --- a/arch/mips/lantiq/irq.c
 +++ b/arch/mips/lantiq/irq.c
-@@ -12,6 +12,7 @@
+@@ -13,6 +13,7 @@
  #include <linux/of_platform.h>
  #include <linux/of_address.h>
  #include <linux/of_irq.h>
@@ -431,7 +431,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
  #include <asm/bootinfo.h>
  #include <asm/irq_cpu.h>
-@@ -91,6 +92,7 @@ void ltq_disable_irq(struct irq_data *d)
+@@ -92,6 +93,7 @@ void ltq_disable_irq(struct irq_data *d)
        }
        raw_spin_unlock_irqrestore(&ltq_icu_lock, flags);
  }
@@ -441,7 +441,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  {
 --- a/arch/mips/mm/cache.c
 +++ b/arch/mips/mm/cache.c
-@@ -61,6 +61,10 @@ void (*_dma_cache_wback_inv)(unsigned lo
+@@ -63,6 +63,10 @@ void (*_dma_cache_wback_inv)(unsigned lo
  void (*_dma_cache_wback)(unsigned long start, unsigned long size);
  void (*_dma_cache_inv)(unsigned long start, unsigned long size);
  
index 1d869afd9ad631f1a98728dd05af559873c3c53c..16b87ed0a5cfc69c740c82da055ea1f34577688f 100644 (file)
@@ -186,7 +186,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  obj-y += vmmc.o
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/timer.c
-@@ -0,0 +1,846 @@
+@@ -0,0 +1,852 @@
 +#ifndef CONFIG_SOC_AMAZON_SE
 +
 +#include <linux/kernel.h>
@@ -883,7 +883,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +
 +      if (!access_ok((void __user *)arg, sizeof(struct gptu_ioctl_param)))
 +              return -EFAULT;
-+      copy_from_user(&param, (void __user *)arg, sizeof(param));
++      if (copy_from_user(&param, (void __user *)arg, sizeof(param)))
++              return -EFAULT;
 +
 +      if ((((cmd == GPTU_REQUEST_TIMER || cmd == GPTU_SET_TIMER
 +             || GPTU_SET_COUNTER) && param.timer < 2)
@@ -898,9 +899,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +                                   (unsigned long) param.pid,
 +                                   (unsigned long) param.sig);
 +              if (ret > 0) {
-+                      copy_to_user(&((struct gptu_ioctl_param *) arg)->
-+                                    timer, &ret, sizeof(&ret));
-+                      ret = 0;
++                      if (copy_to_user(&((struct gptu_ioctl_param *) arg)->
++                                       timer, &ret, sizeof(&ret)))
++                              ret = -EFAULT;
++                      else
++                              ret = 0;
 +              }
 +              break;
 +      case GPTU_FREE_TIMER:
@@ -914,21 +917,20 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +              break;
 +      case GPTU_GET_COUNT_VALUE:
 +              ret = lq_get_count_value(param.timer, &param.value);
-+              if (!ret)
-+                      copy_to_user(&((struct gptu_ioctl_param *) arg)->
-+                                    value, &param.value,
-+                                    sizeof(param.value));
++              if (!ret && copy_to_user(&((struct gptu_ioctl_param *) arg)->
++                  value, &param.value,sizeof(param.value)))
++                      ret = -EFAULT;
 +              break;
 +      case GPTU_CALCULATE_DIVIDER:
 +              param.value = lq_cal_divider(param.value);
 +              if (param.value == 0)
 +                      ret = -EINVAL;
-+              else {
-+                      copy_to_user(&((struct gptu_ioctl_param *) arg)->
++              else if (copy_to_user(&((struct gptu_ioctl_param *) arg)->
 +                                    value, &param.value,
-+                                    sizeof(param.value));
++                                    sizeof(param.value)))
++                      ret = -EFAULT;
++              else
 +                      ret = 0;
-+              }
 +              break;
 +      case GPTU_SET_TIMER:
 +              ret = lq_set_timer(param.timer, param.value,
@@ -942,17 +944,21 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +                               (unsigned long) param.pid,
 +                               (unsigned long) param.sig);
 +              if (ret > 0) {
-+                      copy_to_user(&((struct gptu_ioctl_param *) arg)->
-+                                    timer, &ret, sizeof(&ret));
-+                      ret = 0;
++                      if (copy_to_user(&((struct gptu_ioctl_param *) arg)->
++                                       timer, &ret, sizeof(&ret)))
++                              ret = -EFAULT;
++                      else
++                              ret = 0;
 +              }
 +              break;
 +      case GPTU_SET_COUNTER:
 +              lq_set_counter(param.timer, param.flag, param.value, 0, 0);
 +              if (ret > 0) {
-+                      copy_to_user(&((struct gptu_ioctl_param *) arg)->
-+                                    timer, &ret, sizeof(&ret));
-+                      ret = 0;
++                      if (copy_to_user(&((struct gptu_ioctl_param *) arg)->
++                                       timer, &ret, sizeof(&ret)))
++                              ret = -EFAULT;
++                      else
++                              ret = 0;
 +              }
 +              break;
 +      default:
index fb8d97511066bd7e20f8cd298401e81f74e02ae9..fcc760b911ae22f28173d86d90591dcb9da3f947 100644 (file)
@@ -13,9 +13,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 
 --- a/drivers/net/phy/intel-xway.c
 +++ b/drivers/net/phy/intel-xway.c
-@@ -157,6 +157,51 @@
- #define PHY_ID_PHY11G_VR9_1_2         0xD565A409
- #define PHY_ID_PHY22F_VR9_1_2         0xD565A419
+@@ -229,6 +229,51 @@ static int xway_gphy_rgmii_init(struct p
+                         XWAY_MDIO_MIICTRL_TXSKEW_MASK, val);
+ }
  
 +#if IS_ENABLED(CONFIG_OF_MDIO)
 +static int vr9_gphy_of_reg_init(struct phy_device *phydev)
@@ -65,9 +65,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  static int xway_gphy_config_init(struct phy_device *phydev)
  {
        int err;
-@@ -204,6 +249,7 @@ static int xway_gphy_config_init(struct
-       phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2H, ledxh);
-       phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2L, ledxl);
+@@ -280,6 +325,7 @@ static int xway_gphy_config_init(struct
+       if (err)
+               return err;
  
 +      vr9_gphy_of_reg_init(phydev);
        return 0;
index 154cf226c139e2a7b7717a138f154f48a370f2fa..2d3b4e2996b2c455adff424e3b71ac99131cd9d4 100644 (file)
@@ -18,7 +18,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 
 --- a/drivers/i2c/busses/Kconfig
 +++ b/drivers/i2c/busses/Kconfig
-@@ -753,6 +753,16 @@ config I2C_MESON
+@@ -757,6 +757,16 @@ config I2C_MESON
          If you say yes to this option, support will be included for the
          I2C interface on the Amlogic Meson family of SoCs.
  
index 333a2e6377d5e66237b5957293ba15c6bd44ec8f..6615a9edbf896c8a85ef827f90d9ef49675bd11b 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 
 --- a/drivers/usb/dwc2/params.c
 +++ b/drivers/usb/dwc2/params.c
-@@ -92,7 +92,14 @@ static void dwc2_set_rk_params(struct dw
+@@ -93,7 +93,14 @@ static void dwc2_set_rk_params(struct dw
        p->power_down = DWC2_POWER_DOWN_PARAM_NONE;
  }
  
@@ -39,7 +39,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  {
        struct dwc2_core_params *p = &hsotg->params;
  
-@@ -100,12 +107,20 @@ static void dwc2_set_ltq_params(struct d
+@@ -101,12 +108,20 @@ static void dwc2_set_ltq_params(struct d
        p->host_rx_fifo_size = 288;
        p->host_nperio_tx_fifo_size = 128;
        p->host_perio_tx_fifo_size = 96;
@@ -62,7 +62,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  static void dwc2_set_amlogic_params(struct dwc2_hsotg *hsotg)
  {
        struct dwc2_core_params *p = &hsotg->params;
-@@ -196,8 +211,11 @@ const struct of_device_id dwc2_of_match_
+@@ -205,8 +220,11 @@ const struct of_device_id dwc2_of_match_
        { .compatible = "brcm,bcm2835-usb", .data = dwc2_set_bcm_params },
        { .compatible = "hisilicon,hi6220-usb", .data = dwc2_set_his_params  },
        { .compatible = "rockchip,rk3066-usb", .data = dwc2_set_rk_params },
index 71e9886d2e1fde0da26d217dd2d392fc66b7074a..34fe761d1e603941a90cba1cfac0b0d1206c69c0 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -2434,6 +2434,12 @@ config MIPS_VPE_LOADER
+@@ -2429,6 +2429,12 @@ config MIPS_VPE_LOADER
          Includes a loader for loading an elf relocatable object
          onto another VPE and running it.
  
@@ -15,7 +15,7 @@
        default "y"
 --- a/arch/mips/include/asm/vpe.h
 +++ b/arch/mips/include/asm/vpe.h
-@@ -127,4 +127,13 @@ void cleanup_tc(struct tc *tc);
+@@ -124,4 +124,13 @@ void cleanup_tc(struct tc *tc);
  
  int __init vpe_module_init(void);
  void __exit vpe_module_exit(void);
index 33c06e9d7785e1893036583fa0aa1bb1d00ab8bd..4f3210a6c39b85387ac6b3ad84401490b3bec0fd 100644 (file)
@@ -26,7 +26,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  #endif
 --- a/arch/mips/lantiq/xway/dma.c
 +++ b/arch/mips/lantiq/xway/dma.c
-@@ -181,7 +181,7 @@ ltq_dma_free(struct ltq_dma_channel *ch)
+@@ -182,7 +182,7 @@ ltq_dma_free(struct ltq_dma_channel *ch)
  EXPORT_SYMBOL_GPL(ltq_dma_free);
  
  void
@@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  {
        ltq_dma_w32(p, LTQ_DMA_PS);
        switch (p) {
-@@ -190,16 +190,44 @@ ltq_dma_init_port(int p)
+@@ -191,16 +191,44 @@ ltq_dma_init_port(int p)
                 * Tell the DMA engine to swap the endianness of data frames and
                 * drop packets if the channel arbitration fails.
                 */
index 0ac9adfb96da7ccb2427f069cc49a90c1a2ce77e..ad7f781e21fbf7d8d2b24f35228d56b011baed9f 100644 (file)
@@ -53,7 +53,7 @@ Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
  const char *get_system_type(void)
  {
        return soc_info.sys_type;
-@@ -100,6 +108,17 @@ void __init device_tree_init(void)
+@@ -93,6 +101,17 @@ void __init device_tree_init(void)
        unflatten_and_copy_device_tree();
  }
  
@@ -71,7 +71,7 @@ Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
  void __init prom_init(void)
  {
        /* call the soc specific detetcion code and get it to fill soc_info */
-@@ -111,7 +130,10 @@ void __init prom_init(void)
+@@ -104,7 +123,10 @@ void __init prom_init(void)
        prom_init_cmdline();
  
  #if defined(CONFIG_MIPS_MT_SMP)
index 5bbf752dbad157a4ca718fd7cbb02ff2bee18e28..4a4109c7725ad4afb1ecf97601cfe0cf1b80e750 100644 (file)
@@ -134,7 +134,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
  };
-@@ -454,7 +504,7 @@ static int xrx200_probe(struct platform_
+@@ -453,7 +503,7 @@ static int xrx200_probe(struct platform_
        net_dev->netdev_ops = &xrx200_netdev_ops;
        SET_NETDEV_DEV(net_dev, dev);
        net_dev->min_mtu = ETH_ZLEN;
@@ -142,4 +142,4 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 +      net_dev->max_mtu = XRX200_DMA_DATA_LEN - VLAN_ETH_HLEN - ETH_FCS_LEN;
  
        /* load the memory ranges */
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
index 77c0eb635491278fb9881348ac7423b7032049ab..c197b1a1c957b0c8f997c292ae35e722814b3ec4 100644 (file)
@@ -110,7 +110,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
                        break;
                }
                dev_kfree_skb_any(skb);
-@@ -504,7 +517,8 @@ static int xrx200_probe(struct platform_
+@@ -503,7 +516,8 @@ static int xrx200_probe(struct platform_
        net_dev->netdev_ops = &xrx200_netdev_ops;
        SET_NETDEV_DEV(net_dev, dev);
        net_dev->min_mtu = ETH_ZLEN;
@@ -119,4 +119,4 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 +      priv->rx_buf_size = xrx200_buffer_size(ETH_DATA_LEN);
  
        /* load the memory ranges */
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
diff --git a/target/linux/lantiq/patches-5.15/0705-v5.13-net-dsa-lantiq-allow-to-use-all-GPHYs-on-xRX300-and-.patch b/target/linux/lantiq/patches-5.15/0705-v5.13-net-dsa-lantiq-allow-to-use-all-GPHYs-on-xRX300-and-.patch
deleted file mode 100644 (file)
index a69f682..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-From a09d042b086202735c4ed64573cdd79933020001 Mon Sep 17 00:00:00 2001
-From: Aleksander Jan Bajkowski <olek2@wp.pl>
-Date: Mon, 22 Mar 2021 21:37:15 +0100
-Subject: [PATCH] net: dsa: lantiq: allow to use all GPHYs on xRX300 and xRX330
-
-This patch allows to use all PHYs on GRX300 and GRX330. The ARX300
-has 3 and the GRX330 has 4 integrated PHYs connected to different
-ports compared to VRX200. Each integrated PHY can work as single
-Gigabit Ethernet PHY (GMII) or as double Fast Ethernet PHY (MII).
-
-Allowed port configurations:
-
-xRX200:
-GMAC0: RGMII, MII, REVMII or RMII port
-GMAC1: RGMII, MII, REVMII or RMII port
-GMAC2: GPHY0 (GMII)
-GMAC3: GPHY0 (MII)
-GMAC4: GPHY1 (GMII)
-GMAC5: GPHY1 (MII) or RGMII port
-
-xRX300:
-GMAC0: RGMII port
-GMAC1: GPHY2 (GMII)
-GMAC2: GPHY0 (GMII)
-GMAC3: GPHY0 (MII)
-GMAC4: GPHY1 (GMII)
-GMAC5: GPHY1 (MII) or RGMII port
-
-xRX330:
-GMAC0: RGMII, GMII or RMII port
-GMAC1: GPHY2 (GMII)
-GMAC2: GPHY0 (GMII)
-GMAC3: GPHY0 (MII) or GPHY3 (GMII)
-GMAC4: GPHY1 (GMII)
-GMAC5: GPHY1 (MII), RGMII or RMII port
-
-Tested on D-Link DWR966 (xRX330) with OpenWRT.
-
-Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
-Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/dsa/lantiq_gswip.c | 142 ++++++++++++++++++++++++++-------
- 1 file changed, 113 insertions(+), 29 deletions(-)
-
---- a/drivers/net/dsa/lantiq_gswip.c
-+++ b/drivers/net/dsa/lantiq_gswip.c
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: GPL-2.0
- /*
-- * Lantiq / Intel GSWIP switch driver for VRX200 SoCs
-+ * Lantiq / Intel GSWIP switch driver for VRX200, xRX300 and xRX330 SoCs
-  *
-  * Copyright (C) 2010 Lantiq Deutschland
-  * Copyright (C) 2012 John Crispin <john@phrozen.org>
-@@ -104,6 +104,7 @@
- #define  GSWIP_MII_CFG_MODE_RMIIP     0x2
- #define  GSWIP_MII_CFG_MODE_RMIIM     0x3
- #define  GSWIP_MII_CFG_MODE_RGMII     0x4
-+#define  GSWIP_MII_CFG_MODE_GMII      0x9
- #define  GSWIP_MII_CFG_MODE_MASK      0xf
- #define  GSWIP_MII_CFG_RATE_M2P5      0x00
- #define  GSWIP_MII_CFG_RATE_M25       0x10
-@@ -241,6 +242,7 @@
- struct gswip_hw_info {
-       int max_ports;
-       int cpu_port;
-+      const struct dsa_switch_ops *ops;
- };
- struct xway_gphy_match_data {
-@@ -1438,12 +1440,42 @@ static int gswip_port_fdb_dump(struct ds
-       return 0;
- }
--static void gswip_phylink_validate(struct dsa_switch *ds, int port,
--                                 unsigned long *supported,
--                                 struct phylink_link_state *state)
-+static void gswip_phylink_set_capab(unsigned long *supported,
-+                                  struct phylink_link_state *state)
- {
-       __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
-+      /* Allow all the expected bits */
-+      phylink_set(mask, Autoneg);
-+      phylink_set_port_modes(mask);
-+      phylink_set(mask, Pause);
-+      phylink_set(mask, Asym_Pause);
-+
-+      /* With the exclusion of MII, Reverse MII and Reduced MII, we
-+       * support Gigabit, including Half duplex
-+       */
-+      if (state->interface != PHY_INTERFACE_MODE_MII &&
-+          state->interface != PHY_INTERFACE_MODE_REVMII &&
-+          state->interface != PHY_INTERFACE_MODE_RMII) {
-+              phylink_set(mask, 1000baseT_Full);
-+              phylink_set(mask, 1000baseT_Half);
-+      }
-+
-+      phylink_set(mask, 10baseT_Half);
-+      phylink_set(mask, 10baseT_Full);
-+      phylink_set(mask, 100baseT_Half);
-+      phylink_set(mask, 100baseT_Full);
-+
-+      bitmap_and(supported, supported, mask,
-+                 __ETHTOOL_LINK_MODE_MASK_NBITS);
-+      bitmap_and(state->advertising, state->advertising, mask,
-+                 __ETHTOOL_LINK_MODE_MASK_NBITS);
-+}
-+
-+static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
-+                                        unsigned long *supported,
-+                                        struct phylink_link_state *state)
-+{
-       switch (port) {
-       case 0:
-       case 1:
-@@ -1470,38 +1502,54 @@ static void gswip_phylink_validate(struc
-               return;
-       }
--      /* Allow all the expected bits */
--      phylink_set(mask, Autoneg);
--      phylink_set_port_modes(mask);
--      phylink_set(mask, Pause);
--      phylink_set(mask, Asym_Pause);
-+      gswip_phylink_set_capab(supported, state);
--      /* With the exclusion of MII, Reverse MII and Reduced MII, we
--       * support Gigabit, including Half duplex
--       */
--      if (state->interface != PHY_INTERFACE_MODE_MII &&
--          state->interface != PHY_INTERFACE_MODE_REVMII &&
--          state->interface != PHY_INTERFACE_MODE_RMII) {
--              phylink_set(mask, 1000baseT_Full);
--              phylink_set(mask, 1000baseT_Half);
-+      return;
-+
-+unsupported:
-+      bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
-+      dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
-+              phy_modes(state->interface), port);
-+}
-+
-+static void gswip_xrx300_phylink_validate(struct dsa_switch *ds, int port,
-+                                        unsigned long *supported,
-+                                        struct phylink_link_state *state)
-+{
-+      switch (port) {
-+      case 0:
-+              if (!phy_interface_mode_is_rgmii(state->interface) &&
-+                  state->interface != PHY_INTERFACE_MODE_GMII &&
-+                  state->interface != PHY_INTERFACE_MODE_RMII)
-+                      goto unsupported;
-+              break;
-+      case 1:
-+      case 2:
-+      case 3:
-+      case 4:
-+              if (state->interface != PHY_INTERFACE_MODE_INTERNAL)
-+                      goto unsupported;
-+              break;
-+      case 5:
-+              if (!phy_interface_mode_is_rgmii(state->interface) &&
-+                  state->interface != PHY_INTERFACE_MODE_INTERNAL &&
-+                  state->interface != PHY_INTERFACE_MODE_RMII)
-+                      goto unsupported;
-+              break;
-+      default:
-+              bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
-+              dev_err(ds->dev, "Unsupported port: %i\n", port);
-+              return;
-       }
--      phylink_set(mask, 10baseT_Half);
--      phylink_set(mask, 10baseT_Full);
--      phylink_set(mask, 100baseT_Half);
--      phylink_set(mask, 100baseT_Full);
-+      gswip_phylink_set_capab(supported, state);
--      bitmap_and(supported, supported, mask,
--                 __ETHTOOL_LINK_MODE_MASK_NBITS);
--      bitmap_and(state->advertising, state->advertising, mask,
--                 __ETHTOOL_LINK_MODE_MASK_NBITS);
-       return;
- unsupported:
-       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
-       dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
-               phy_modes(state->interface), port);
--      return;
- }
- static void gswip_port_set_link(struct gswip_priv *priv, int port, bool link)
-@@ -1636,6 +1684,9 @@ static void gswip_phylink_mac_config(str
-       case PHY_INTERFACE_MODE_RGMII_TXID:
-               miicfg |= GSWIP_MII_CFG_MODE_RGMII;
-               break;
-+      case PHY_INTERFACE_MODE_GMII:
-+              miicfg |= GSWIP_MII_CFG_MODE_GMII;
-+              break;
-       default:
-               dev_err(ds->dev,
-                       "Unsupported interface: %d\n", state->interface);
-@@ -1762,7 +1813,7 @@ static int gswip_get_sset_count(struct d
-       return ARRAY_SIZE(gswip_rmon_cnt);
- }
--static const struct dsa_switch_ops gswip_switch_ops = {
-+static const struct dsa_switch_ops gswip_xrx200_switch_ops = {
-       .get_tag_protocol       = gswip_get_tag_protocol,
-       .setup                  = gswip_setup,
-       .port_enable            = gswip_port_enable,
-@@ -1778,7 +1829,31 @@ static const struct dsa_switch_ops gswip
-       .port_fdb_add           = gswip_port_fdb_add,
-       .port_fdb_del           = gswip_port_fdb_del,
-       .port_fdb_dump          = gswip_port_fdb_dump,
--      .phylink_validate       = gswip_phylink_validate,
-+      .phylink_validate       = gswip_xrx200_phylink_validate,
-+      .phylink_mac_config     = gswip_phylink_mac_config,
-+      .phylink_mac_link_down  = gswip_phylink_mac_link_down,
-+      .phylink_mac_link_up    = gswip_phylink_mac_link_up,
-+      .get_strings            = gswip_get_strings,
-+      .get_ethtool_stats      = gswip_get_ethtool_stats,
-+      .get_sset_count         = gswip_get_sset_count,
-+};
-+
-+static const struct dsa_switch_ops gswip_xrx300_switch_ops = {
-+      .get_tag_protocol       = gswip_get_tag_protocol,
-+      .setup                  = gswip_setup,
-+      .port_enable            = gswip_port_enable,
-+      .port_disable           = gswip_port_disable,
-+      .port_bridge_join       = gswip_port_bridge_join,
-+      .port_bridge_leave      = gswip_port_bridge_leave,
-+      .port_fast_age          = gswip_port_fast_age,
-+      .port_vlan_filtering    = gswip_port_vlan_filtering,
-+      .port_vlan_add          = gswip_port_vlan_add,
-+      .port_vlan_del          = gswip_port_vlan_del,
-+      .port_stp_state_set     = gswip_port_stp_state_set,
-+      .port_fdb_add           = gswip_port_fdb_add,
-+      .port_fdb_del           = gswip_port_fdb_del,
-+      .port_fdb_dump          = gswip_port_fdb_dump,
-+      .phylink_validate       = gswip_xrx300_phylink_validate,
-       .phylink_mac_config     = gswip_phylink_mac_config,
-       .phylink_mac_link_down  = gswip_phylink_mac_link_down,
-       .phylink_mac_link_up    = gswip_phylink_mac_link_up,
-@@ -2042,7 +2117,7 @@ static int gswip_probe(struct platform_d
-       priv->ds->dev = dev;
-       priv->ds->num_ports = priv->hw_info->max_ports;
-       priv->ds->priv = priv;
--      priv->ds->ops = &gswip_switch_ops;
-+      priv->ds->ops = priv->hw_info->ops;
-       priv->dev = dev;
-       version = gswip_switch_r(priv, GSWIP_VERSION);
-@@ -2126,10 +2201,19 @@ static int gswip_remove(struct platform_
- static const struct gswip_hw_info gswip_xrx200 = {
-       .max_ports = 7,
-       .cpu_port = 6,
-+      .ops = &gswip_xrx200_switch_ops,
-+};
-+
-+static const struct gswip_hw_info gswip_xrx300 = {
-+      .max_ports = 7,
-+      .cpu_port = 6,
-+      .ops = &gswip_xrx300_switch_ops,
- };
- static const struct of_device_id gswip_of_match[] = {
-       { .compatible = "lantiq,xrx200-gswip", .data = &gswip_xrx200 },
-+      { .compatible = "lantiq,xrx300-gswip", .data = &gswip_xrx300 },
-+      { .compatible = "lantiq,xrx330-gswip", .data = &gswip_xrx300 },
-       {},
- };
- MODULE_DEVICE_TABLE(of, gswip_of_match);
index 49a19bebeea099ed2c77fd35d3f161b666a24e1f..22aa2eea6e0b6ca388ccc7e0aa84307fcb7e2481 100644 (file)
@@ -47,7 +47,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  struct gswip_hw_info {
        int max_ports;
        int cpu_port;
-@@ -858,10 +868,6 @@ static int gswip_setup(struct dsa_switch
+@@ -846,10 +856,6 @@ static int gswip_setup(struct dsa_switch
        gswip_switch_mask(priv, 0, GSWIP_PCE_PCTRL_0_INGRESS,
                          GSWIP_PCE_PCTRL_0p(cpu_port));
  
@@ -58,17 +58,17 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
        gswip_switch_mask(priv, 0, GSWIP_BM_QUEUE_GCTRL_GL_MOD,
                          GSWIP_BM_QUEUE_GCTRL);
  
-@@ -878,6 +884,8 @@ static int gswip_setup(struct dsa_switch
+@@ -866,6 +872,8 @@ static int gswip_setup(struct dsa_switch
                return err;
        }
  
 +      ds->mtu_enforcement_ingress = true;
 +
        gswip_port_enable(ds, cpu_port, NULL);
-       return 0;
- }
-@@ -1472,6 +1480,39 @@ static void gswip_phylink_set_capab(unsi
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       ds->configure_vlan_while_not_filtering = false;
+@@ -1456,6 +1464,39 @@ static void gswip_phylink_set_capab(unsi
+       linkmode_and(state->advertising, state->advertising, mask);
  }
  
 +static int gswip_port_max_mtu(struct dsa_switch *ds, int port)
@@ -107,7 +107,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
                                          unsigned long *supported,
                                          struct phylink_link_state *state)
-@@ -1829,6 +1870,8 @@ static const struct dsa_switch_ops gswip
+@@ -1812,6 +1853,8 @@ static const struct dsa_switch_ops gswip
        .port_fdb_add           = gswip_port_fdb_add,
        .port_fdb_del           = gswip_port_fdb_del,
        .port_fdb_dump          = gswip_port_fdb_dump,
@@ -116,7 +116,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
        .phylink_validate       = gswip_xrx200_phylink_validate,
        .phylink_mac_config     = gswip_phylink_mac_config,
        .phylink_mac_link_down  = gswip_phylink_mac_link_down,
-@@ -1853,6 +1896,8 @@ static const struct dsa_switch_ops gswip
+@@ -1836,6 +1879,8 @@ static const struct dsa_switch_ops gswip
        .port_fdb_add           = gswip_port_fdb_add,
        .port_fdb_del           = gswip_port_fdb_del,
        .port_fdb_dump          = gswip_port_fdb_dump,
index 4fb7d0767b1d1687c80427c32c0d07ecc3c0721a..818fa811e9f2de7f2c341e22606f7078651e1a78 100644 (file)
@@ -105,7 +105,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  
        ch_rx->dma.nr = XRX200_DMA_RX;
        ch_rx->dma.dev = priv->dev;
-@@ -584,6 +587,18 @@ static int xrx200_probe(struct platform_
+@@ -575,6 +578,18 @@ static int xrx200_probe(struct platform_
        if (err)
                eth_hw_addr_random(net_dev);
  
index 7448af8c2655ad72927b22746214a2a9e47a9ea2..e002f81d5a0da17ec4d99630631bbe471a7f794b 100644 (file)
@@ -52,7 +52,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  
        ch_rx->dma.nr = XRX200_DMA_RX;
        ch_rx->dma.dev = priv->dev;
-@@ -587,18 +586,6 @@ static int xrx200_probe(struct platform_
+@@ -578,18 +577,6 @@ static int xrx200_probe(struct platform_
        if (err)
                eth_hw_addr_random(net_dev);
  
index 1fa49f406e587200003aabfcf4bbbdc12a455c43..10791f9d5366fa98f71e64ba3d06748d3009b736 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 
 --- a/drivers/net/ethernet/lantiq_xrx200.c
 +++ b/drivers/net/ethernet/lantiq_xrx200.c
-@@ -606,8 +606,10 @@ static int xrx200_probe(struct platform_
+@@ -597,8 +597,10 @@ static int xrx200_probe(struct platform_
                         PMAC_HD_CTL);
  
        /* setup NAPI */
index b2b014832c688004daa5b0d9302687442086bacc..6613d0bbd7159568cbfb23d63060a550fdbfbc60 100644 (file)
@@ -196,11 +196,11 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  }
  
  static int xrx200_probe(struct platform_device *pdev)
-@@ -554,6 +569,7 @@ static int xrx200_probe(struct platform_
+@@ -553,6 +568,7 @@ static int xrx200_probe(struct platform_
        net_dev->min_mtu = ETH_ZLEN;
        net_dev->max_mtu = XRX200_DMA_DATA_LEN - xrx200_max_frame_len(0);
        priv->rx_buf_size = xrx200_buffer_size(ETH_DATA_LEN);
 +      priv->rx_skb_size = xrx200_skb_size(priv->rx_buf_size);
  
        /* load the memory ranges */
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);