From d374e0346ecedf21b808c07260b31ae3a90f4653 Mon Sep 17 00:00:00 2001 From: Martin Blumenstingl Date: Mon, 21 Mar 2022 18:39:03 +0100 Subject: [PATCH] lantiq: 5.15: refresh patches 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 --- .../0001-MIPS-lantiq-add-pcie-driver.patch | 12 +- .../0004-MIPS-lantiq-add-atm-hack.patch | 6 +- ...-MIPS-lantiq-backport-old-timer-code.patch | 44 +-- ...T-PHY-add-led-support-for-intel-xway.patch | 12 +- ...PS-lantiq-add-FALC-ON-i2c-bus-master.patch | 2 +- ...e-lantiq-settings-match-vendor-drive.patch | 6 +- .../lantiq/patches-5.15/0152-lantiq-VPE.patch | 4 +- ...make-the-burst-length-configurable-b.patch | 4 +- ...le-all-hardware-interrupts-on-second.patch | 4 +- ...-lantiq-add-support-for-jumbo-frames.patch | 4 +- ...q_xrx200-increase-buffer-reservation.patch | 4 +- ...llow-to-use-all-GPHYs-on-xRX300-and-.patch | 275 ------------------ ...-lantiq-enable-jumbo-frames-on-GSWIP.patch | 16 +- ...gure-the-burst-length-in-ethernet-dr.patch | 2 +- ...x200-Hardcode-the-burst-length-value.patch | 2 +- ...tiq_xrx200-increase-napi-poll-weigth.patch | 2 +- ...t-lantiq_xrx200-convert-to-build_skb.patch | 4 +- 17 files changed, 66 insertions(+), 337 deletions(-) delete mode 100644 target/linux/lantiq/patches-5.15/0705-v5.13-net-dsa-lantiq-allow-to-use-all-GPHYs-on-xRX300-and-.patch diff --git a/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch index 99bed24cfd..2276b38c6e 100644 --- a/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch +++ b/target/linux/lantiq/patches-5.15/0001-MIPS-lantiq-add-pcie-driver.patch @@ -242,7 +242,7 @@ Signed-off-by: John Crispin + --- /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 + +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 +#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 + +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 + --- 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 (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 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 diff --git a/target/linux/lantiq/patches-5.15/0004-MIPS-lantiq-add-atm-hack.patch b/target/linux/lantiq/patches-5.15/0004-MIPS-lantiq-add-atm-hack.patch index e215df60ee..e32e4e2daa 100644 --- a/target/linux/lantiq/patches-5.15/0004-MIPS-lantiq-add-atm-hack.patch +++ b/target/linux/lantiq/patches-5.15/0004-MIPS-lantiq-add-atm-hack.patch @@ -423,7 +423,7 @@ Signed-off-by: John Crispin + --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c -@@ -12,6 +12,7 @@ +@@ -13,6 +13,7 @@ #include #include #include @@ -431,7 +431,7 @@ Signed-off-by: John Crispin #include #include -@@ -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(<q_icu_lock, flags); } @@ -441,7 +441,7 @@ Signed-off-by: John Crispin { --- 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); diff --git a/target/linux/lantiq/patches-5.15/0008-MIPS-lantiq-backport-old-timer-code.patch b/target/linux/lantiq/patches-5.15/0008-MIPS-lantiq-backport-old-timer-code.patch index 1d869afd9a..16b87ed0a5 100644 --- a/target/linux/lantiq/patches-5.15/0008-MIPS-lantiq-backport-old-timer-code.patch +++ b/target/linux/lantiq/patches-5.15/0008-MIPS-lantiq-backport-old-timer-code.patch @@ -186,7 +186,7 @@ Signed-off-by: John Crispin 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 @@ -883,7 +883,8 @@ Signed-off-by: John Crispin + + if (!access_ok((void __user *)arg, sizeof(struct gptu_ioctl_param))) + return -EFAULT; -+ copy_from_user(¶m, (void __user *)arg, sizeof(param)); ++ if (copy_from_user(¶m, (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 + (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 + break; + case GPTU_GET_COUNT_VALUE: + ret = lq_get_count_value(param.timer, ¶m.value); -+ if (!ret) -+ copy_to_user(&((struct gptu_ioctl_param *) arg)-> -+ value, ¶m.value, -+ sizeof(param.value)); ++ if (!ret && copy_to_user(&((struct gptu_ioctl_param *) arg)-> ++ value, ¶m.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, ¶m.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 + (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: diff --git a/target/linux/lantiq/patches-5.15/0023-NET-PHY-add-led-support-for-intel-xway.patch b/target/linux/lantiq/patches-5.15/0023-NET-PHY-add-led-support-for-intel-xway.patch index fb8d975110..fcc760b911 100644 --- a/target/linux/lantiq/patches-5.15/0023-NET-PHY-add-led-support-for-intel-xway.patch +++ b/target/linux/lantiq/patches-5.15/0023-NET-PHY-add-led-support-for-intel-xway.patch @@ -13,9 +13,9 @@ Signed-off-by: John Crispin --- 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 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; diff --git a/target/linux/lantiq/patches-5.15/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-5.15/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch index 154cf226c1..2d3b4e2996 100644 --- a/target/linux/lantiq/patches-5.15/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch +++ b/target/linux/lantiq/patches-5.15/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch @@ -18,7 +18,7 @@ Signed-off-by: John Crispin --- 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. diff --git a/target/linux/lantiq/patches-5.15/0050-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch b/target/linux/lantiq/patches-5.15/0050-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch index 333a2e6377..6615a9edbf 100644 --- a/target/linux/lantiq/patches-5.15/0050-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch +++ b/target/linux/lantiq/patches-5.15/0050-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch @@ -23,7 +23,7 @@ Signed-off-by: Hauke Mehrtens --- 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 { 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 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 }, diff --git a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch index 71e9886d2e..34fe761d1e 100644 --- a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch +++ b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch @@ -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); diff --git a/target/linux/lantiq/patches-5.15/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch b/target/linux/lantiq/patches-5.15/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch index 33c06e9d77..4f3210a6c3 100644 --- a/target/linux/lantiq/patches-5.15/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch +++ b/target/linux/lantiq/patches-5.15/0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #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 { 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. */ diff --git a/target/linux/lantiq/patches-5.15/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch b/target/linux/lantiq/patches-5.15/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch index 0ac9adfb96..ad7f781e21 100644 --- a/target/linux/lantiq/patches-5.15/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch +++ b/target/linux/lantiq/patches-5.15/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch @@ -53,7 +53,7 @@ Signed-off-by: Aleksander Jan Bajkowski 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 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) diff --git a/target/linux/lantiq/patches-5.15/0702-v5.16-net-lantiq-add-support-for-jumbo-frames.patch b/target/linux/lantiq/patches-5.15/0702-v5.16-net-lantiq-add-support-for-jumbo-frames.patch index 5bbf752dba..4a4109c772 100644 --- a/target/linux/lantiq/patches-5.15/0702-v5.16-net-lantiq-add-support-for-jumbo-frames.patch +++ b/target/linux/lantiq/patches-5.15/0702-v5.16-net-lantiq-add-support-for-jumbo-frames.patch @@ -134,7 +134,7 @@ Signed-off-by: David S. Miller .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 + 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); diff --git a/target/linux/lantiq/patches-5.15/0703-v5.16-net-lantiq_xrx200-increase-buffer-reservation.patch b/target/linux/lantiq/patches-5.15/0703-v5.16-net-lantiq_xrx200-increase-buffer-reservation.patch index 77c0eb6354..c197b1a1c9 100644 --- a/target/linux/lantiq/patches-5.15/0703-v5.16-net-lantiq_xrx200-increase-buffer-reservation.patch +++ b/target/linux/lantiq/patches-5.15/0703-v5.16-net-lantiq_xrx200-increase-buffer-reservation.patch @@ -110,7 +110,7 @@ Signed-off-by: Jakub Kicinski 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 + 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 index a69f682c03..0000000000 --- a/target/linux/lantiq/patches-5.15/0705-v5.13-net-dsa-lantiq-allow-to-use-all-GPHYs-on-xRX300-and-.patch +++ /dev/null @@ -1,275 +0,0 @@ -From a09d042b086202735c4ed64573cdd79933020001 Mon Sep 17 00:00:00 2001 -From: Aleksander Jan Bajkowski -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 -Acked-by: Hauke Mehrtens -Signed-off-by: David S. Miller ---- - 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 -@@ -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); diff --git a/target/linux/lantiq/patches-5.15/0706-v5.18-net-lantiq-enable-jumbo-frames-on-GSWIP.patch b/target/linux/lantiq/patches-5.15/0706-v5.18-net-lantiq-enable-jumbo-frames-on-GSWIP.patch index 49a19bebee..22aa2eea6e 100644 --- a/target/linux/lantiq/patches-5.15/0706-v5.18-net-lantiq-enable-jumbo-frames-on-GSWIP.patch +++ b/target/linux/lantiq/patches-5.15/0706-v5.18-net-lantiq-enable-jumbo-frames-on-GSWIP.patch @@ -47,7 +47,7 @@ Signed-off-by: Jakub Kicinski 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 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 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 .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, diff --git a/target/linux/lantiq/patches-5.15/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch b/target/linux/lantiq/patches-5.15/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch index 4fb7d0767b..818fa811e9 100644 --- a/target/linux/lantiq/patches-5.15/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch +++ b/target/linux/lantiq/patches-5.15/0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch @@ -105,7 +105,7 @@ Signed-off-by: David S. Miller 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); diff --git a/target/linux/lantiq/patches-5.15/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch b/target/linux/lantiq/patches-5.15/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch index 7448af8c26..e002f81d5a 100644 --- a/target/linux/lantiq/patches-5.15/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch +++ b/target/linux/lantiq/patches-5.15/0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch @@ -52,7 +52,7 @@ Signed-off-by: David S. Miller 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); diff --git a/target/linux/lantiq/patches-5.15/0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch b/target/linux/lantiq/patches-5.15/0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch index 1fa49f406e..10791f9d53 100644 --- a/target/linux/lantiq/patches-5.15/0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch +++ b/target/linux/lantiq/patches-5.15/0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- 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 */ diff --git a/target/linux/lantiq/patches-5.15/0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch b/target/linux/lantiq/patches-5.15/0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch index b2b014832c..6613d0bbd7 100644 --- a/target/linux/lantiq/patches-5.15/0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch +++ b/target/linux/lantiq/patches-5.15/0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch @@ -196,11 +196,11 @@ Signed-off-by: Jakub Kicinski } 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); -- 2.30.2