From b8ef54f5da32a654b2f47a2466913faef3ff6bc4 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 19 Oct 2021 20:27:37 +0200 Subject: [PATCH 001/144] ipq40xx: drop 5.4 kernel Since 5.10 is now default, no point in keeping 5.4 around. Signed-off-by: Robert Marko --- target/linux/ipq40xx/config-5.4 | 463 ---- .../files-5.4/drivers/net/phy/ar40xx.c | 1890 ----------------- .../files-5.4/drivers/net/phy/ar40xx.h | 342 --- ...5.7-ARM-qcom-Add-support-for-IPQ40xx.patch | 42 - ...r-add-IPQ4019-SDHCI-VQMMC-LDO-driver.patch | 153 -- ...om-ipq4019-Add-SDHCI-controller-node.patch | 36 - ...om-Add-nodes-for-SMP-boot-in-IPQ40xx.patch | 71 - ...RM-dts-qcom-add-gpio-ranges-property.patch | 119 -- ...om-ipq4019-fix-high-resolution-timer.patch | 33 - ...net-phy-mdio-add-IPQ4019-MDIO-driver.patch | 210 -- ...2-ARM-dts-qcom-ipq4019-add-MDIO-node.patch | 57 - ...add-CRYPTO_ALG_KERN_DRIVER_ONLY-flag.patch | 31 - ....5-crypto-qce-switch-to-skcipher-API.patch | 993 --------- ...ce-fix-ctr-aes-qce-block-chunk-sizes.patch | 43 - ...crypto-qce-fix-xts-aes-qce-key-sizes.patch | 60 - ...-save-a-sg-table-slot-for-result-buf.patch | 85 - ....6-crypto-qce-update-the-skcipher-IV.patch | 31 - ...qce-initialize-fallback-only-for-AES.patch | 54 - ...e-allow-building-only-hashes-ciphers.patch | 419 ---- ...e-use-cryptlen-when-adding-extra-sgl.patch | 89 - ...-use-AES-fallback-for-small-requests.patch | 113 - ...-handle-AES-XTS-cases-that-qce-fails.patch | 59 - ...-driver-for-Qualcomm-IPQ40xx-USB-PHY.patch | 197 -- .../0018-v5.9-pinctrl-msm-open-drain.patch | 81 - ...d-spi-nor-Add-support-for-mx25r3235f.patch | 29 - .../100-GPIO-add-named-gpio-exports.patch | 165 -- ...dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch | 32 - ...com-ipq4019-add-USB-devicetree-nodes.patch | 97 - ...arm-dts-qcom-ipq4019-add-more-labels.patch | 42 - .../104-clk-fix-apss-cpu-overclocking.patch | 115 - .../105-ipq40xx-fix-sleep-clock.patch | 29 - .../300-clk-qcom-ipq4019-add-ess-reset.patch | 52 - ...-compressed-add-appended-DTB-section.patch | 48 - ...d-set-ipq40xx-watchdog-to-allow-boot.patch | 66 - ...msm-use-sdhci_set_clock-instead-of-s.patch | 25 - ...702-dts-ipq4019-add-PHY-switch-nodes.patch | 46 - ...4019-needs-rfs-vlan_tag-callbacks-in.patch | 53 - .../705-net-add-qualcomm-ar40xx-phy.patch | 26 - .../706-dt-bindings-net-add-QCA807x-PHY.patch | 61 - ...7-net-phy-Add-Qualcom-QCA807x-driver.patch | 50 - ...8-arm-dts-ipq4019-QCA807x-properties.patch | 62 - ...add-qualcomm-essedma-ethernet-driver.patch | 37 - ...ts-ipq4019-add-ethernet-essedma-node.patch | 92 - .../850-soc-add-qualcomm-syscon.patch | 180 -- .../900-dts-ipq4019-ap-dk01.1.patch | 176 -- .../901-arm-boot-add-dts-files.patch | 82 - .../902-dts-ipq4019-ap-dk04.1.patch | 167 -- .../patches-5.4/997-device_tree_cmdline.patch | 12 - 48 files changed, 7415 deletions(-) delete mode 100644 target/linux/ipq40xx/config-5.4 delete mode 100644 target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.c delete mode 100644 target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.h delete mode 100644 target/linux/ipq40xx/patches-5.4/0001-v5.7-ARM-qcom-Add-support-for-IPQ40xx.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0002-01-v5.6-regulator-add-IPQ4019-SDHCI-VQMMC-LDO-driver.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0002-02-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0003-v5.6-ARM-dts-qcom-Add-nodes-for-SMP-boot-in-IPQ40xx.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0003-v5.7-ARM-dts-qcom-add-gpio-ranges-property.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0004-v5.8-ARM-dts-qcom-ipq4019-fix-high-resolution-timer.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0005-01-v5.8-net-phy-mdio-add-IPQ4019-MDIO-driver.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0005-02-v5.8-02-ARM-dts-qcom-ipq4019-add-MDIO-node.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0006-v5.5-crypto-qce-add-CRYPTO_ALG_KERN_DRIVER_ONLY-flag.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0007-v5.5-crypto-qce-switch-to-skcipher-API.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0008-v5.6-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0009-v5.6-crypto-qce-fix-xts-aes-qce-key-sizes.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0010-v5.6-crypto-qce-save-a-sg-table-slot-for-result-buf.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0011-v5.6-crypto-qce-update-the-skcipher-IV.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0012-v5.6-crypto-qce-initialize-fallback-only-for-AES.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0013-v5.6-crypto-qce-allow-building-only-hashes-ciphers.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0014-v5.7-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0015-v5.7-crypto-qce-use-AES-fallback-for-small-requests.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0016-v5.7-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0017-v5.8-phy-add-driver-for-Qualcomm-IPQ40xx-USB-PHY.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0018-v5.9-pinctrl-msm-open-drain.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/0019-v5.6-mtd-spi-nor-Add-support-for-mx25r3235f.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/100-GPIO-add-named-gpio-exports.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/101-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/102-ARM-dts-qcom-ipq4019-add-USB-devicetree-nodes.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/103-arm-dts-qcom-ipq4019-add-more-labels.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/104-clk-fix-apss-cpu-overclocking.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/105-ipq40xx-fix-sleep-clock.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/300-clk-qcom-ipq4019-add-ess-reset.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/301-arm-compressed-add-appended-DTB-section.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/702-dts-ipq4019-add-PHY-switch-nodes.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/703-net-IPQ4019-needs-rfs-vlan_tag-callbacks-in.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/706-dt-bindings-net-add-QCA807x-PHY.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/707-net-phy-Add-Qualcom-QCA807x-driver.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/708-arm-dts-ipq4019-QCA807x-properties.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/710-net-add-qualcomm-essedma-ethernet-driver.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/850-soc-add-qualcomm-syscon.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/900-dts-ipq4019-ap-dk01.1.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/902-dts-ipq4019-ap-dk04.1.patch delete mode 100644 target/linux/ipq40xx/patches-5.4/997-device_tree_cmdline.patch diff --git a/target/linux/ipq40xx/config-5.4 b/target/linux/ipq40xx/config-5.4 deleted file mode 100644 index b4251a7748..0000000000 --- a/target/linux/ipq40xx/config-5.4 +++ /dev/null @@ -1,463 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_APQ_GCC_8084 is not set -# CONFIG_APQ_MMCC_8084 is not set -CONFIG_AR40XX_PHY=y -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_IPQ40XX=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -# CONFIG_ARCH_MDM9615 is not set -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_ARCH_MSM8960 is not set -# CONFIG_ARCH_MSM8974 is not set -# CONFIG_ARCH_MSM8X60 is not set -CONFIG_ARCH_MULTIPLATFORM=y -CONFIG_ARCH_MULTI_V6_V7=y -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y -CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y -CONFIG_ARCH_QCOM=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_APPENDED_DTB=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -# CONFIG_ARM_ATAG_DTB_COMPAT is not set -CONFIG_ARM_CPUIDLE=y -CONFIG_ARM_CPU_SUSPEND=y -# CONFIG_ARM_CPU_TOPOLOGY is not set -CONFIG_ARM_CRYPTO=y -CONFIG_ARM_GIC=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_PATCH_IDIV=y -CONFIG_ARM_PATCH_PHYS_VIRT=y -# CONFIG_ARM_QCOM_CPUFREQ_HW is not set -# CONFIG_ARM_SMMU is not set -CONFIG_ARM_THUMB=y -CONFIG_ARM_UNWIND=y -CONFIG_ARM_VIRT_EXT=y -CONFIG_AT803X_PHY=y -CONFIG_AUTO_ZRELADDR=y -CONFIG_BCH=y -CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_MQ_PCI=y -CONFIG_BOUNCE=y -# CONFIG_CACHE_L2X0 is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_QCOM=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE_PARTITION=y -CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_QCOM=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CPUFREQ_DT=y -CONFIG_CPUFREQ_DT_PLATDEV=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y -CONFIG_CPU_HAS_ASID=y -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_PM=y -CONFIG_CPU_RMAP=y -CONFIG_CPU_SPECTRE=y -CONFIG_CPU_THERMAL=y -CONFIG_CPU_THUMB_CAPABLE=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_V7=y -CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_AES_ARM=y -CONFIG_CRYPTO_AES_ARM_BS=y -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CRYPTD=y -CONFIG_CRYPTO_CTR=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_DES=y -CONFIG_CRYPTO_DEV_QCE=y -# CONFIG_CRYPTO_DEV_QCE_ENABLE_ALL is not set -# CONFIG_CRYPTO_DEV_QCE_ENABLE_SHA is not set -CONFIG_CRYPTO_DEV_QCE_ENABLE_SKCIPHER=y -CONFIG_CRYPTO_DEV_QCE_SKCIPHER=y -CONFIG_CRYPTO_DEV_QCE_SW_MAX_LEN=512 -CONFIG_CRYPTO_DEV_QCOM_RNG=y -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_DRBG_HMAC=y -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_LIB_DES=y -CONFIG_CRYPTO_LIB_SHA256=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_SEQIV=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA256_ARM=y -CONFIG_CRYPTO_SIMD=y -CONFIG_CRYPTO_XTS=y -CONFIG_CRYPTO_ZSTD=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -CONFIG_DEBUG_MISC=y -CONFIG_DMADEVICES=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_REMAP=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DTC=y -CONFIG_DT_IDLE_STATES=y -CONFIG_DYNAMIC_DEBUG=y -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -CONFIG_EEPROM_AT24=y -CONFIG_ESSEDMA=y -CONFIG_EXTCON=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_PINCTRL_GROUPS=y -CONFIG_GENERIC_PINMUX_FUNCTIONS=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_74X164=y -CONFIG_GPIO_WATCHDOG=y -CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAVE_SMP=y -CONFIG_HIGHMEM=y -# CONFIG_HIGHPTE is not set -CONFIG_HWSPINLOCK=y -CONFIG_HWSPINLOCK_QCOM=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_OPTEE=y -CONFIG_HZ_FIXED=0 -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_QUP=y -CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set -# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set -CONFIG_IOMMU_SUPPORT=y -CONFIG_IO_URING=y -CONFIG_IPQ_GCC_4019=y -# CONFIG_IPQ_GCC_806X is not set -# CONFIG_IPQ_GCC_8074 is not set -# CONFIG_IPQ_LCC_806X is not set -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -# CONFIG_KPSS_XCC is not set -# CONFIG_KRAITCC is not set -CONFIG_LEDS_LP5523=y -CONFIG_LEDS_LP5562=y -CONFIG_LEDS_LP55XX_COMMON=y -CONFIG_LEDS_TLC591XX=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_GPIO=y -CONFIG_MDIO_IPQ4019=y -# CONFIG_MDM_GCC_9615 is not set -# CONFIG_MDM_LCC_9615 is not set -CONFIG_MEMFD_CREATE=y -# CONFIG_MFD_QCOM_RPM is not set -# CONFIG_MFD_SPMI_PMIC is not set -CONFIG_MFD_SYSCON=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_IO_ACCESSORS=y -CONFIG_MMC_SDHCI_MSM=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MODULES_USE_ELF_REL=y -# CONFIG_MSM_GCC_8660 is not set -# CONFIG_MSM_GCC_8916 is not set -# CONFIG_MSM_GCC_8960 is not set -# CONFIG_MSM_GCC_8974 is not set -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8996 is not set -# CONFIG_MSM_GCC_8998 is not set -# CONFIG_MSM_LCC_8960 is not set -# CONFIG_MSM_MMCC_8960 is not set -# CONFIG_MSM_MMCC_8974 is not set -# CONFIG_MSM_MMCC_8996 is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_NAND_CORE=y -CONFIG_MTD_NAND_ECC_SW_BCH=y -CONFIG_MTD_NAND_ECC_SW_HAMMING=y -CONFIG_MTD_NAND_QCOM=y -CONFIG_MTD_RAW_NAND=y -CONFIG_MTD_SPI_NAND=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_FIT_FW=y -CONFIG_MTD_SPLIT_WRGG_FW=y -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEON=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_PTP_CLASSIFY=y -CONFIG_NLS=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=4 -CONFIG_NVMEM=y -CONFIG_NVMEM_SYSFS=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OPTEE=y -CONFIG_OPTEE_SHM_NUM_PRIV_PAGES=1 -CONFIG_PADATA=y -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI=y -CONFIG_PCIEAER=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCIE_DW=y -CONFIG_PCIE_DW_HOST=y -CONFIG_PCIE_QCOM=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -# CONFIG_PHY_QCOM_APQ8064_SATA is not set -CONFIG_PHY_QCOM_IPQ4019_USB=y -# CONFIG_PHY_QCOM_IPQ806X_SATA is not set -# CONFIG_PHY_QCOM_PCIE2 is not set -# CONFIG_PHY_QCOM_QMP is not set -# CONFIG_PHY_QCOM_QUSB2 is not set -# CONFIG_PHY_QCOM_UFS is not set -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_APQ8064 is not set -# CONFIG_PINCTRL_APQ8084 is not set -CONFIG_PINCTRL_IPQ4019=y -# CONFIG_PINCTRL_IPQ8064 is not set -# CONFIG_PINCTRL_IPQ8074 is not set -# CONFIG_PINCTRL_MDM9615 is not set -CONFIG_PINCTRL_MSM=y -# CONFIG_PINCTRL_MSM8660 is not set -# CONFIG_PINCTRL_MSM8916 is not set -# CONFIG_PINCTRL_MSM8960 is not set -# CONFIG_PINCTRL_MSM8994 is not set -# CONFIG_PINCTRL_MSM8996 is not set -# CONFIG_PINCTRL_MSM8998 is not set -# CONFIG_PINCTRL_QCOM_SPMI_PMIC is not set -# CONFIG_PINCTRL_QCOM_SSBI_PMIC is not set -# CONFIG_PINCTRL_QCS404 is not set -# CONFIG_PINCTRL_SC7180 is not set -# CONFIG_PINCTRL_SDM660 is not set -# CONFIG_PINCTRL_SDM845 is not set -# CONFIG_PINCTRL_SM8150 is not set -CONFIG_PM_OPP=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_MSM=y -CONFIG_POWER_SUPPLY=y -CONFIG_PPS=y -CONFIG_PRINTK_TIME=y -CONFIG_PTP_1588_CLOCK=y -CONFIG_QCA807X_PHY=y -CONFIG_QCOM_A53PLL=y -CONFIG_QCOM_BAM_DMA=y -# CONFIG_QCOM_COMMAND_DB is not set -# CONFIG_QCOM_EBI2 is not set -# CONFIG_QCOM_GENI_SE is not set -# CONFIG_QCOM_GSBI is not set -# CONFIG_QCOM_HFPLL is not set -# CONFIG_QCOM_IOMMU is not set -# CONFIG_QCOM_LLCC is not set -# CONFIG_QCOM_PDC is not set -CONFIG_QCOM_PM=y -CONFIG_QCOM_QFPROM=y -# CONFIG_QCOM_RMTFS_MEM is not set -CONFIG_QCOM_SCM=y -CONFIG_QCOM_SCM_32=y -# CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT is not set -CONFIG_QCOM_SMEM=y -# CONFIG_QCOM_SMSM is not set -# CONFIG_QCOM_SOCINFO is not set -CONFIG_QCOM_TCSR=y -# CONFIG_QCOM_TSENS is not set -CONFIG_QCOM_WDT=y -# CONFIG_QCS_GCC_404 is not set -# CONFIG_QCS_TURING_404 is not set -# CONFIG_QRTR is not set -CONFIG_RAS=y -CONFIG_RATIONAL=y -CONFIG_REFCOUNT_FULL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_QCOM_SPMI is not set -CONFIG_REGULATOR_VCTRL=y -CONFIG_REGULATOR_VQMMC_IPQ4019=y -CONFIG_RESET_CONTROLLER=y -# CONFIG_RESET_QCOM_AOSS is not set -# CONFIG_RESET_QCOM_PDC is not set -CONFIG_RFS_ACCEL=y -CONFIG_RPS=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RTC_MC146818_LIB=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -# CONFIG_SDM_CAMCC_845 is not set -# CONFIG_SDM_DISPCC_845 is not set -# CONFIG_SDM_GCC_660 is not set -# CONFIG_SDM_GCC_845 is not set -# CONFIG_SDM_GPUCC_845 is not set -# CONFIG_SDM_LPASSCC_845 is not set -# CONFIG_SDM_VIDEOCC_845 is not set -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_MSM=y -CONFIG_SERIAL_MSM_CONSOLE=y -CONFIG_SGL_ALLOC=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -# CONFIG_SM_GCC_8150 is not set -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_MEM=y -CONFIG_SPI_QUP=y -CONFIG_SPMI=y -CONFIG_SPMI_MSM_PMIC_ARB=y -# CONFIG_SPMI_PMIC_CLKDIV is not set -CONFIG_SRCU=y -CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_LEDS=y -CONFIG_SWPHY=y -CONFIG_SWP_EMULATE=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TEE=y -CONFIG_THERMAL=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -CONFIG_THERMAL_GOV_STEP_WISE=y -CONFIG_THERMAL_OF=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TREE_RCU=y -CONFIG_TREE_SRCU=y -CONFIG_UBIFS_FS=y -CONFIG_UEVENT_HELPER_PATH="" -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_UNWINDER_ARM=y -CONFIG_USB=y -CONFIG_USB_COMMON=y -CONFIG_USB_SUPPORT=y -CONFIG_USE_OF=y -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_WATCHDOG_CORE=y -CONFIG_XPS=y -CONFIG_XXHASH=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0 -CONFIG_ZBOOT_ROM_TEXT=0 -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZSTD_COMPRESS=y -CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.c b/target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.c deleted file mode 100644 index f7ce42b9ff..0000000000 --- a/target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.c +++ /dev/null @@ -1,1890 +0,0 @@ -/* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ar40xx.h" - -static struct ar40xx_priv *ar40xx_priv; - -#define MIB_DESC(_s , _o, _n) \ - { \ - .size = (_s), \ - .offset = (_o), \ - .name = (_n), \ - } - -static const struct ar40xx_mib_desc ar40xx_mibs[] = { - MIB_DESC(1, AR40XX_STATS_RXBROAD, "RxBroad"), - MIB_DESC(1, AR40XX_STATS_RXPAUSE, "RxPause"), - MIB_DESC(1, AR40XX_STATS_RXMULTI, "RxMulti"), - MIB_DESC(1, AR40XX_STATS_RXFCSERR, "RxFcsErr"), - MIB_DESC(1, AR40XX_STATS_RXALIGNERR, "RxAlignErr"), - MIB_DESC(1, AR40XX_STATS_RXRUNT, "RxRunt"), - MIB_DESC(1, AR40XX_STATS_RXFRAGMENT, "RxFragment"), - MIB_DESC(1, AR40XX_STATS_RX64BYTE, "Rx64Byte"), - MIB_DESC(1, AR40XX_STATS_RX128BYTE, "Rx128Byte"), - MIB_DESC(1, AR40XX_STATS_RX256BYTE, "Rx256Byte"), - MIB_DESC(1, AR40XX_STATS_RX512BYTE, "Rx512Byte"), - MIB_DESC(1, AR40XX_STATS_RX1024BYTE, "Rx1024Byte"), - MIB_DESC(1, AR40XX_STATS_RX1518BYTE, "Rx1518Byte"), - MIB_DESC(1, AR40XX_STATS_RXMAXBYTE, "RxMaxByte"), - MIB_DESC(1, AR40XX_STATS_RXTOOLONG, "RxTooLong"), - MIB_DESC(2, AR40XX_STATS_RXGOODBYTE, "RxGoodByte"), - MIB_DESC(2, AR40XX_STATS_RXBADBYTE, "RxBadByte"), - MIB_DESC(1, AR40XX_STATS_RXOVERFLOW, "RxOverFlow"), - MIB_DESC(1, AR40XX_STATS_FILTERED, "Filtered"), - MIB_DESC(1, AR40XX_STATS_TXBROAD, "TxBroad"), - MIB_DESC(1, AR40XX_STATS_TXPAUSE, "TxPause"), - MIB_DESC(1, AR40XX_STATS_TXMULTI, "TxMulti"), - MIB_DESC(1, AR40XX_STATS_TXUNDERRUN, "TxUnderRun"), - MIB_DESC(1, AR40XX_STATS_TX64BYTE, "Tx64Byte"), - MIB_DESC(1, AR40XX_STATS_TX128BYTE, "Tx128Byte"), - MIB_DESC(1, AR40XX_STATS_TX256BYTE, "Tx256Byte"), - MIB_DESC(1, AR40XX_STATS_TX512BYTE, "Tx512Byte"), - MIB_DESC(1, AR40XX_STATS_TX1024BYTE, "Tx1024Byte"), - MIB_DESC(1, AR40XX_STATS_TX1518BYTE, "Tx1518Byte"), - MIB_DESC(1, AR40XX_STATS_TXMAXBYTE, "TxMaxByte"), - MIB_DESC(1, AR40XX_STATS_TXOVERSIZE, "TxOverSize"), - MIB_DESC(2, AR40XX_STATS_TXBYTE, "TxByte"), - MIB_DESC(1, AR40XX_STATS_TXCOLLISION, "TxCollision"), - MIB_DESC(1, AR40XX_STATS_TXABORTCOL, "TxAbortCol"), - MIB_DESC(1, AR40XX_STATS_TXMULTICOL, "TxMultiCol"), - MIB_DESC(1, AR40XX_STATS_TXSINGLECOL, "TxSingleCol"), - MIB_DESC(1, AR40XX_STATS_TXEXCDEFER, "TxExcDefer"), - MIB_DESC(1, AR40XX_STATS_TXDEFER, "TxDefer"), - MIB_DESC(1, AR40XX_STATS_TXLATECOL, "TxLateCol"), -}; - -static u32 -ar40xx_read(struct ar40xx_priv *priv, int reg) -{ - return readl(priv->hw_addr + reg); -} - -static u32 -ar40xx_psgmii_read(struct ar40xx_priv *priv, int reg) -{ - return readl(priv->psgmii_hw_addr + reg); -} - -static void -ar40xx_write(struct ar40xx_priv *priv, int reg, u32 val) -{ - writel(val, priv->hw_addr + reg); -} - -static u32 -ar40xx_rmw(struct ar40xx_priv *priv, int reg, u32 mask, u32 val) -{ - u32 ret; - - ret = ar40xx_read(priv, reg); - ret &= ~mask; - ret |= val; - ar40xx_write(priv, reg, ret); - return ret; -} - -static void -ar40xx_psgmii_write(struct ar40xx_priv *priv, int reg, u32 val) -{ - writel(val, priv->psgmii_hw_addr + reg); -} - -static void -ar40xx_phy_dbg_write(struct ar40xx_priv *priv, int phy_addr, - u16 dbg_addr, u16 dbg_data) -{ - struct mii_bus *bus = priv->mii_bus; - - mutex_lock(&bus->mdio_lock); - bus->write(bus, phy_addr, AR40XX_MII_ATH_DBG_ADDR, dbg_addr); - bus->write(bus, phy_addr, AR40XX_MII_ATH_DBG_DATA, dbg_data); - mutex_unlock(&bus->mdio_lock); -} - -static void -ar40xx_phy_dbg_read(struct ar40xx_priv *priv, int phy_addr, - u16 dbg_addr, u16 *dbg_data) -{ - struct mii_bus *bus = priv->mii_bus; - - mutex_lock(&bus->mdio_lock); - bus->write(bus, phy_addr, AR40XX_MII_ATH_DBG_ADDR, dbg_addr); - *dbg_data = bus->read(bus, phy_addr, AR40XX_MII_ATH_DBG_DATA); - mutex_unlock(&bus->mdio_lock); -} - -static void -ar40xx_phy_mmd_write(struct ar40xx_priv *priv, u32 phy_id, - u16 mmd_num, u16 reg_id, u16 reg_val) -{ - struct mii_bus *bus = priv->mii_bus; - - mutex_lock(&bus->mdio_lock); - bus->write(bus, phy_id, - AR40XX_MII_ATH_MMD_ADDR, mmd_num); - bus->write(bus, phy_id, - AR40XX_MII_ATH_MMD_DATA, reg_id); - bus->write(bus, phy_id, - AR40XX_MII_ATH_MMD_ADDR, - 0x4000 | mmd_num); - bus->write(bus, phy_id, - AR40XX_MII_ATH_MMD_DATA, reg_val); - mutex_unlock(&bus->mdio_lock); -} - -static u16 -ar40xx_phy_mmd_read(struct ar40xx_priv *priv, u32 phy_id, - u16 mmd_num, u16 reg_id) -{ - u16 value; - struct mii_bus *bus = priv->mii_bus; - - mutex_lock(&bus->mdio_lock); - bus->write(bus, phy_id, - AR40XX_MII_ATH_MMD_ADDR, mmd_num); - bus->write(bus, phy_id, - AR40XX_MII_ATH_MMD_DATA, reg_id); - bus->write(bus, phy_id, - AR40XX_MII_ATH_MMD_ADDR, - 0x4000 | mmd_num); - value = bus->read(bus, phy_id, AR40XX_MII_ATH_MMD_DATA); - mutex_unlock(&bus->mdio_lock); - return value; -} - -/* Start of swconfig support */ - -static void -ar40xx_phy_poll_reset(struct ar40xx_priv *priv) -{ - u32 i, in_reset, retries = 500; - struct mii_bus *bus = priv->mii_bus; - - /* Assume RESET was recently issued to some or all of the phys */ - in_reset = GENMASK(AR40XX_NUM_PHYS - 1, 0); - - while (retries--) { - /* 1ms should be plenty of time. - * 802.3 spec allows for a max wait time of 500ms - */ - usleep_range(1000, 2000); - - for (i = 0; i < AR40XX_NUM_PHYS; i++) { - int val; - - /* skip devices which have completed reset */ - if (!(in_reset & BIT(i))) - continue; - - val = mdiobus_read(bus, i, MII_BMCR); - if (val < 0) - continue; - - /* mark when phy is no longer in reset state */ - if (!(val & BMCR_RESET)) - in_reset &= ~BIT(i); - } - - if (!in_reset) - return; - } - - dev_warn(&bus->dev, "Failed to reset all phys! (in_reset: 0x%x)\n", - in_reset); -} - -static void -ar40xx_phy_init(struct ar40xx_priv *priv) -{ - int i; - struct mii_bus *bus; - u16 val; - - bus = priv->mii_bus; - for (i = 0; i < AR40XX_NUM_PORTS - 1; i++) { - ar40xx_phy_dbg_read(priv, i, AR40XX_PHY_DEBUG_0, &val); - val &= ~AR40XX_PHY_MANU_CTRL_EN; - ar40xx_phy_dbg_write(priv, i, AR40XX_PHY_DEBUG_0, val); - mdiobus_write(bus, i, - MII_ADVERTISE, ADVERTISE_ALL | - ADVERTISE_PAUSE_CAP | - ADVERTISE_PAUSE_ASYM); - mdiobus_write(bus, i, MII_CTRL1000, ADVERTISE_1000FULL); - mdiobus_write(bus, i, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); - } - - ar40xx_phy_poll_reset(priv); -} - -static void -ar40xx_port_phy_linkdown(struct ar40xx_priv *priv) -{ - struct mii_bus *bus; - int i; - u16 val; - - bus = priv->mii_bus; - for (i = 0; i < AR40XX_NUM_PORTS - 1; i++) { - mdiobus_write(bus, i, MII_CTRL1000, 0); - mdiobus_write(bus, i, MII_ADVERTISE, 0); - mdiobus_write(bus, i, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); - ar40xx_phy_dbg_read(priv, i, AR40XX_PHY_DEBUG_0, &val); - val |= AR40XX_PHY_MANU_CTRL_EN; - ar40xx_phy_dbg_write(priv, i, AR40XX_PHY_DEBUG_0, val); - /* disable transmit */ - ar40xx_phy_dbg_read(priv, i, AR40XX_PHY_DEBUG_2, &val); - val &= 0xf00f; - ar40xx_phy_dbg_write(priv, i, AR40XX_PHY_DEBUG_2, val); - } -} - -static void -ar40xx_set_mirror_regs(struct ar40xx_priv *priv) -{ - int port; - - /* reset all mirror registers */ - ar40xx_rmw(priv, AR40XX_REG_FWD_CTRL0, - AR40XX_FWD_CTRL0_MIRROR_PORT, - (0xF << AR40XX_FWD_CTRL0_MIRROR_PORT_S)); - for (port = 0; port < AR40XX_NUM_PORTS; port++) { - ar40xx_rmw(priv, AR40XX_REG_PORT_LOOKUP(port), - AR40XX_PORT_LOOKUP_ING_MIRROR_EN, 0); - - ar40xx_rmw(priv, AR40XX_REG_PORT_HOL_CTRL1(port), - AR40XX_PORT_HOL_CTRL1_EG_MIRROR_EN, 0); - } - - /* now enable mirroring if necessary */ - if (priv->source_port >= AR40XX_NUM_PORTS || - priv->monitor_port >= AR40XX_NUM_PORTS || - priv->source_port == priv->monitor_port) { - return; - } - - ar40xx_rmw(priv, AR40XX_REG_FWD_CTRL0, - AR40XX_FWD_CTRL0_MIRROR_PORT, - (priv->monitor_port << AR40XX_FWD_CTRL0_MIRROR_PORT_S)); - - if (priv->mirror_rx) - ar40xx_rmw(priv, AR40XX_REG_PORT_LOOKUP(priv->source_port), 0, - AR40XX_PORT_LOOKUP_ING_MIRROR_EN); - - if (priv->mirror_tx) - ar40xx_rmw(priv, AR40XX_REG_PORT_HOL_CTRL1(priv->source_port), - 0, AR40XX_PORT_HOL_CTRL1_EG_MIRROR_EN); -} - -static int -ar40xx_sw_get_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - u8 ports = priv->vlan_table[val->port_vlan]; - int i; - - val->len = 0; - for (i = 0; i < dev->ports; i++) { - struct switch_port *p; - - if (!(ports & BIT(i))) - continue; - - p = &val->value.ports[val->len++]; - p->id = i; - if ((priv->vlan_tagged & BIT(i)) || - (priv->pvid[i] != val->port_vlan)) - p->flags = BIT(SWITCH_PORT_FLAG_TAGGED); - else - p->flags = 0; - } - return 0; -} - -static int -ar40xx_sw_set_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - u8 *vt = &priv->vlan_table[val->port_vlan]; - int i; - - *vt = 0; - for (i = 0; i < val->len; i++) { - struct switch_port *p = &val->value.ports[i]; - - if (p->flags & BIT(SWITCH_PORT_FLAG_TAGGED)) { - if (val->port_vlan == priv->pvid[p->id]) - priv->vlan_tagged |= BIT(p->id); - } else { - priv->vlan_tagged &= ~BIT(p->id); - priv->pvid[p->id] = val->port_vlan; - } - - *vt |= BIT(p->id); - } - return 0; -} - -static int -ar40xx_reg_wait(struct ar40xx_priv *priv, u32 reg, u32 mask, u32 val, - unsigned timeout) -{ - int i; - - for (i = 0; i < timeout; i++) { - u32 t; - - t = ar40xx_read(priv, reg); - if ((t & mask) == val) - return 0; - - usleep_range(1000, 2000); - } - - return -ETIMEDOUT; -} - -static int -ar40xx_mib_op(struct ar40xx_priv *priv, u32 op) -{ - int ret; - - lockdep_assert_held(&priv->mib_lock); - - /* Capture the hardware statistics for all ports */ - ar40xx_rmw(priv, AR40XX_REG_MIB_FUNC, - AR40XX_MIB_FUNC, (op << AR40XX_MIB_FUNC_S)); - - /* Wait for the capturing to complete. */ - ret = ar40xx_reg_wait(priv, AR40XX_REG_MIB_FUNC, - AR40XX_MIB_BUSY, 0, 10); - - return ret; -} - -static void -ar40xx_mib_fetch_port_stat(struct ar40xx_priv *priv, int port, bool flush) -{ - unsigned int base; - u64 *mib_stats; - int i; - u32 num_mibs = ARRAY_SIZE(ar40xx_mibs); - - WARN_ON(port >= priv->dev.ports); - - lockdep_assert_held(&priv->mib_lock); - - base = AR40XX_REG_PORT_STATS_START + - AR40XX_REG_PORT_STATS_LEN * port; - - mib_stats = &priv->mib_stats[port * num_mibs]; - if (flush) { - u32 len; - - len = num_mibs * sizeof(*mib_stats); - memset(mib_stats, 0, len); - return; - } - for (i = 0; i < num_mibs; i++) { - const struct ar40xx_mib_desc *mib; - u64 t; - - mib = &ar40xx_mibs[i]; - t = ar40xx_read(priv, base + mib->offset); - if (mib->size == 2) { - u64 hi; - - hi = ar40xx_read(priv, base + mib->offset + 4); - t |= hi << 32; - } - - mib_stats[i] += t; - } -} - -static int -ar40xx_mib_capture(struct ar40xx_priv *priv) -{ - return ar40xx_mib_op(priv, AR40XX_MIB_FUNC_CAPTURE); -} - -static int -ar40xx_mib_flush(struct ar40xx_priv *priv) -{ - return ar40xx_mib_op(priv, AR40XX_MIB_FUNC_FLUSH); -} - -static int -ar40xx_sw_set_reset_mibs(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - unsigned int len; - int ret; - u32 num_mibs = ARRAY_SIZE(ar40xx_mibs); - - mutex_lock(&priv->mib_lock); - - len = priv->dev.ports * num_mibs * sizeof(*priv->mib_stats); - memset(priv->mib_stats, 0, len); - ret = ar40xx_mib_flush(priv); - - mutex_unlock(&priv->mib_lock); - return ret; -} - -static int -ar40xx_sw_set_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - priv->vlan = !!val->value.i; - return 0; -} - -static int -ar40xx_sw_get_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - val->value.i = priv->vlan; - return 0; -} - -static int -ar40xx_sw_set_mirror_rx_enable(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - priv->mirror_rx = !!val->value.i; - ar40xx_set_mirror_regs(priv); - mutex_unlock(&priv->reg_mutex); - - return 0; -} - -static int -ar40xx_sw_get_mirror_rx_enable(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - val->value.i = priv->mirror_rx; - mutex_unlock(&priv->reg_mutex); - return 0; -} - -static int -ar40xx_sw_set_mirror_tx_enable(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - priv->mirror_tx = !!val->value.i; - ar40xx_set_mirror_regs(priv); - mutex_unlock(&priv->reg_mutex); - - return 0; -} - -static int -ar40xx_sw_get_mirror_tx_enable(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - val->value.i = priv->mirror_tx; - mutex_unlock(&priv->reg_mutex); - return 0; -} - -static int -ar40xx_sw_set_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - priv->monitor_port = val->value.i; - ar40xx_set_mirror_regs(priv); - mutex_unlock(&priv->reg_mutex); - - return 0; -} - -static int -ar40xx_sw_get_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - val->value.i = priv->monitor_port; - mutex_unlock(&priv->reg_mutex); - return 0; -} - -static int -ar40xx_sw_set_mirror_source_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - priv->source_port = val->value.i; - ar40xx_set_mirror_regs(priv); - mutex_unlock(&priv->reg_mutex); - - return 0; -} - -static int -ar40xx_sw_get_mirror_source_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - mutex_lock(&priv->reg_mutex); - val->value.i = priv->source_port; - mutex_unlock(&priv->reg_mutex); - return 0; -} - -static int -ar40xx_sw_set_linkdown(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - if (val->value.i == 1) - ar40xx_port_phy_linkdown(priv); - else - ar40xx_phy_init(priv); - - return 0; -} - -static int -ar40xx_sw_set_port_reset_mib(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - int port; - int ret; - - port = val->port_vlan; - if (port >= dev->ports) - return -EINVAL; - - mutex_lock(&priv->mib_lock); - ret = ar40xx_mib_capture(priv); - if (ret) - goto unlock; - - ar40xx_mib_fetch_port_stat(priv, port, true); - -unlock: - mutex_unlock(&priv->mib_lock); - return ret; -} - -static int -ar40xx_sw_get_port_mib(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - u64 *mib_stats; - int port; - int ret; - char *buf = priv->buf; - int i, len = 0; - u32 num_mibs = ARRAY_SIZE(ar40xx_mibs); - - port = val->port_vlan; - if (port >= dev->ports) - return -EINVAL; - - mutex_lock(&priv->mib_lock); - ret = ar40xx_mib_capture(priv); - if (ret) - goto unlock; - - ar40xx_mib_fetch_port_stat(priv, port, false); - - len += snprintf(buf + len, sizeof(priv->buf) - len, - "Port %d MIB counters\n", - port); - - mib_stats = &priv->mib_stats[port * num_mibs]; - for (i = 0; i < num_mibs; i++) - len += snprintf(buf + len, sizeof(priv->buf) - len, - "%-12s: %llu\n", - ar40xx_mibs[i].name, - mib_stats[i]); - - val->value.s = buf; - val->len = len; - -unlock: - mutex_unlock(&priv->mib_lock); - return ret; -} - -static int -ar40xx_sw_set_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - priv->vlan_id[val->port_vlan] = val->value.i; - return 0; -} - -static int -ar40xx_sw_get_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - val->value.i = priv->vlan_id[val->port_vlan]; - return 0; -} - -static int -ar40xx_sw_get_pvid(struct switch_dev *dev, int port, int *vlan) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - *vlan = priv->pvid[port]; - return 0; -} - -static int -ar40xx_sw_set_pvid(struct switch_dev *dev, int port, int vlan) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - /* make sure no invalid PVIDs get set */ - if (vlan >= dev->vlans) - return -EINVAL; - - priv->pvid[port] = vlan; - return 0; -} - -static void -ar40xx_read_port_link(struct ar40xx_priv *priv, int port, - struct switch_port_link *link) -{ - u32 status; - u32 speed; - - memset(link, 0, sizeof(*link)); - - status = ar40xx_read(priv, AR40XX_REG_PORT_STATUS(port)); - - link->aneg = !!(status & AR40XX_PORT_AUTO_LINK_EN); - if (link->aneg || (port != AR40XX_PORT_CPU)) - link->link = !!(status & AR40XX_PORT_STATUS_LINK_UP); - else - link->link = true; - - if (!link->link) - return; - - link->duplex = !!(status & AR40XX_PORT_DUPLEX); - link->tx_flow = !!(status & AR40XX_PORT_STATUS_TXFLOW); - link->rx_flow = !!(status & AR40XX_PORT_STATUS_RXFLOW); - - speed = (status & AR40XX_PORT_SPEED) >> - AR40XX_PORT_STATUS_SPEED_S; - - switch (speed) { - case AR40XX_PORT_SPEED_10M: - link->speed = SWITCH_PORT_SPEED_10; - break; - case AR40XX_PORT_SPEED_100M: - link->speed = SWITCH_PORT_SPEED_100; - break; - case AR40XX_PORT_SPEED_1000M: - link->speed = SWITCH_PORT_SPEED_1000; - break; - default: - link->speed = SWITCH_PORT_SPEED_UNKNOWN; - break; - } -} - -static int -ar40xx_sw_get_port_link(struct switch_dev *dev, int port, - struct switch_port_link *link) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - - ar40xx_read_port_link(priv, port, link); - return 0; -} - -static const struct switch_attr ar40xx_sw_attr_globals[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_vlan", - .description = "Enable VLAN mode", - .set = ar40xx_sw_set_vlan, - .get = ar40xx_sw_get_vlan, - .max = 1 - }, - { - .type = SWITCH_TYPE_NOVAL, - .name = "reset_mibs", - .description = "Reset all MIB counters", - .set = ar40xx_sw_set_reset_mibs, - }, - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_rx", - .description = "Enable mirroring of RX packets", - .set = ar40xx_sw_set_mirror_rx_enable, - .get = ar40xx_sw_get_mirror_rx_enable, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_tx", - .description = "Enable mirroring of TX packets", - .set = ar40xx_sw_set_mirror_tx_enable, - .get = ar40xx_sw_get_mirror_tx_enable, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "mirror_monitor_port", - .description = "Mirror monitor port", - .set = ar40xx_sw_set_mirror_monitor_port, - .get = ar40xx_sw_get_mirror_monitor_port, - .max = AR40XX_NUM_PORTS - 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "mirror_source_port", - .description = "Mirror source port", - .set = ar40xx_sw_set_mirror_source_port, - .get = ar40xx_sw_get_mirror_source_port, - .max = AR40XX_NUM_PORTS - 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "linkdown", - .description = "Link down all the PHYs", - .set = ar40xx_sw_set_linkdown, - .max = 1 - }, -}; - -static const struct switch_attr ar40xx_sw_attr_port[] = { - { - .type = SWITCH_TYPE_NOVAL, - .name = "reset_mib", - .description = "Reset single port MIB counters", - .set = ar40xx_sw_set_port_reset_mib, - }, - { - .type = SWITCH_TYPE_STRING, - .name = "mib", - .description = "Get port's MIB counters", - .set = NULL, - .get = ar40xx_sw_get_port_mib, - }, -}; - -const struct switch_attr ar40xx_sw_attr_vlan[] = { - { - .type = SWITCH_TYPE_INT, - .name = "vid", - .description = "VLAN ID (0-4094)", - .set = ar40xx_sw_set_vid, - .get = ar40xx_sw_get_vid, - .max = 4094, - }, -}; - -/* End of swconfig support */ - -static int -ar40xx_wait_bit(struct ar40xx_priv *priv, int reg, u32 mask, u32 val) -{ - int timeout = 20; - u32 t; - - while (1) { - t = ar40xx_read(priv, reg); - if ((t & mask) == val) - return 0; - - if (timeout-- <= 0) - break; - - usleep_range(10, 20); - } - - pr_err("ar40xx: timeout for reg %08x: %08x & %08x != %08x\n", - (unsigned int)reg, t, mask, val); - return -ETIMEDOUT; -} - -static int -ar40xx_atu_flush(struct ar40xx_priv *priv) -{ - int ret; - - ret = ar40xx_wait_bit(priv, AR40XX_REG_ATU_FUNC, - AR40XX_ATU_FUNC_BUSY, 0); - if (!ret) - ar40xx_write(priv, AR40XX_REG_ATU_FUNC, - AR40XX_ATU_FUNC_OP_FLUSH | - AR40XX_ATU_FUNC_BUSY); - - return ret; -} - -static void -ar40xx_ess_reset(struct ar40xx_priv *priv) -{ - reset_control_assert(priv->ess_rst); - mdelay(10); - reset_control_deassert(priv->ess_rst); - /* Waiting for all inner tables init done. - * It cost 5~10ms. - */ - mdelay(10); - - pr_info("ESS reset ok!\n"); -} - -/* Start of psgmii self test */ - -static void -ar40xx_malibu_psgmii_ess_reset(struct ar40xx_priv *priv) -{ - u32 n; - struct mii_bus *bus = priv->mii_bus; - /* reset phy psgmii */ - /* fix phy psgmii RX 20bit */ - mdiobus_write(bus, 5, 0x0, 0x005b); - /* reset phy psgmii */ - mdiobus_write(bus, 5, 0x0, 0x001b); - /* release reset phy psgmii */ - mdiobus_write(bus, 5, 0x0, 0x005b); - - for (n = 0; n < AR40XX_PSGMII_CALB_NUM; n++) { - u16 status; - - status = ar40xx_phy_mmd_read(priv, 5, 1, 0x28); - if (status & BIT(0)) - break; - /* Polling interval to check PSGMII PLL in malibu is ready - * the worst time is 8.67ms - * for 25MHz reference clock - * [512+(128+2048)*49]*80ns+100us - */ - mdelay(2); - } - - /*check malibu psgmii calibration done end..*/ - - /*freeze phy psgmii RX CDR*/ - mdiobus_write(bus, 5, 0x1a, 0x2230); - - ar40xx_ess_reset(priv); - - /*check psgmii calibration done start*/ - for (n = 0; n < AR40XX_PSGMII_CALB_NUM; n++) { - u32 status; - - status = ar40xx_psgmii_read(priv, 0xa0); - if (status & BIT(0)) - break; - /* Polling interval to check PSGMII PLL in ESS is ready */ - mdelay(2); - } - - /* check dakota psgmii calibration done end..*/ - - /* relesae phy psgmii RX CDR */ - mdiobus_write(bus, 5, 0x1a, 0x3230); - /* release phy psgmii RX 20bit */ - mdiobus_write(bus, 5, 0x0, 0x005f); -} - -static void -ar40xx_psgmii_single_phy_testing(struct ar40xx_priv *priv, int phy) -{ - int j; - u32 tx_ok, tx_error; - u32 rx_ok, rx_error; - u32 tx_ok_high16; - u32 rx_ok_high16; - u32 tx_all_ok, rx_all_ok; - struct mii_bus *bus = priv->mii_bus; - - mdiobus_write(bus, phy, 0x0, 0x9000); - mdiobus_write(bus, phy, 0x0, 0x4140); - - for (j = 0; j < AR40XX_PSGMII_CALB_NUM; j++) { - u16 status; - - status = mdiobus_read(bus, phy, 0x11); - if (status & AR40XX_PHY_SPEC_STATUS_LINK) - break; - /* the polling interval to check if the PHY link up or not - * maxwait_timer: 750 ms +/-10 ms - * minwait_timer : 1 us +/- 0.1us - * time resides in minwait_timer ~ maxwait_timer - * see IEEE 802.3 section 40.4.5.2 - */ - mdelay(8); - } - - /* enable check */ - ar40xx_phy_mmd_write(priv, phy, 7, 0x8029, 0x0000); - ar40xx_phy_mmd_write(priv, phy, 7, 0x8029, 0x0003); - - /* start traffic */ - ar40xx_phy_mmd_write(priv, phy, 7, 0x8020, 0xa000); - /* wait for all traffic end - * 4096(pkt num)*1524(size)*8ns(125MHz)=49.9ms - */ - mdelay(50); - - /* check counter */ - tx_ok = ar40xx_phy_mmd_read(priv, phy, 7, 0x802e); - tx_ok_high16 = ar40xx_phy_mmd_read(priv, phy, 7, 0x802d); - tx_error = ar40xx_phy_mmd_read(priv, phy, 7, 0x802f); - rx_ok = ar40xx_phy_mmd_read(priv, phy, 7, 0x802b); - rx_ok_high16 = ar40xx_phy_mmd_read(priv, phy, 7, 0x802a); - rx_error = ar40xx_phy_mmd_read(priv, phy, 7, 0x802c); - tx_all_ok = tx_ok + (tx_ok_high16 << 16); - rx_all_ok = rx_ok + (rx_ok_high16 << 16); - if (tx_all_ok == 0x1000 && tx_error == 0) { - /* success */ - priv->phy_t_status &= (~BIT(phy)); - } else { - pr_info("PHY %d single test PSGMII issue happen!\n", phy); - priv->phy_t_status |= BIT(phy); - } - - mdiobus_write(bus, phy, 0x0, 0x1840); -} - -static void -ar40xx_psgmii_all_phy_testing(struct ar40xx_priv *priv) -{ - int phy, j; - struct mii_bus *bus = priv->mii_bus; - - mdiobus_write(bus, 0x1f, 0x0, 0x9000); - mdiobus_write(bus, 0x1f, 0x0, 0x4140); - - for (j = 0; j < AR40XX_PSGMII_CALB_NUM; j++) { - for (phy = 0; phy < AR40XX_NUM_PORTS - 1; phy++) { - u16 status; - - status = mdiobus_read(bus, phy, 0x11); - if (!(status & BIT(10))) - break; - } - - if (phy >= (AR40XX_NUM_PORTS - 1)) - break; - /* The polling interva to check if the PHY link up or not */ - mdelay(8); - } - /* enable check */ - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8029, 0x0000); - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8029, 0x0003); - - /* start traffic */ - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8020, 0xa000); - /* wait for all traffic end - * 4096(pkt num)*1524(size)*8ns(125MHz)=49.9ms - */ - mdelay(50); - - for (phy = 0; phy < AR40XX_NUM_PORTS - 1; phy++) { - u32 tx_ok, tx_error; - u32 rx_ok, rx_error; - u32 tx_ok_high16; - u32 rx_ok_high16; - u32 tx_all_ok, rx_all_ok; - - /* check counter */ - tx_ok = ar40xx_phy_mmd_read(priv, phy, 7, 0x802e); - tx_ok_high16 = ar40xx_phy_mmd_read(priv, phy, 7, 0x802d); - tx_error = ar40xx_phy_mmd_read(priv, phy, 7, 0x802f); - rx_ok = ar40xx_phy_mmd_read(priv, phy, 7, 0x802b); - rx_ok_high16 = ar40xx_phy_mmd_read(priv, phy, 7, 0x802a); - rx_error = ar40xx_phy_mmd_read(priv, phy, 7, 0x802c); - tx_all_ok = tx_ok + (tx_ok_high16<<16); - rx_all_ok = rx_ok + (rx_ok_high16<<16); - if (tx_all_ok == 0x1000 && tx_error == 0) { - /* success */ - priv->phy_t_status &= ~BIT(phy + 8); - } else { - pr_info("PHY%d test see issue!\n", phy); - priv->phy_t_status |= BIT(phy + 8); - } - } - - pr_debug("PHY all test 0x%x \r\n", priv->phy_t_status); -} - -void -ar40xx_psgmii_self_test(struct ar40xx_priv *priv) -{ - u32 i, phy; - struct mii_bus *bus = priv->mii_bus; - - ar40xx_malibu_psgmii_ess_reset(priv); - - /* switch to access MII reg for copper */ - mdiobus_write(bus, 4, 0x1f, 0x8500); - for (phy = 0; phy < AR40XX_NUM_PORTS - 1; phy++) { - /*enable phy mdio broadcast write*/ - ar40xx_phy_mmd_write(priv, phy, 7, 0x8028, 0x801f); - } - /* force no link by power down */ - mdiobus_write(bus, 0x1f, 0x0, 0x1840); - /*packet number*/ - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8021, 0x1000); - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8062, 0x05e0); - - /*fix mdi status */ - mdiobus_write(bus, 0x1f, 0x10, 0x6800); - for (i = 0; i < AR40XX_PSGMII_CALB_NUM; i++) { - priv->phy_t_status = 0; - - for (phy = 0; phy < AR40XX_NUM_PORTS - 1; phy++) { - ar40xx_rmw(priv, AR40XX_REG_PORT_LOOKUP(phy + 1), - AR40XX_PORT_LOOKUP_LOOPBACK, - AR40XX_PORT_LOOKUP_LOOPBACK); - } - - for (phy = 0; phy < AR40XX_NUM_PORTS - 1; phy++) - ar40xx_psgmii_single_phy_testing(priv, phy); - - ar40xx_psgmii_all_phy_testing(priv); - - if (priv->phy_t_status) - ar40xx_malibu_psgmii_ess_reset(priv); - else - break; - } - - if (i >= AR40XX_PSGMII_CALB_NUM) - pr_info("PSGMII cannot recover\n"); - else - pr_debug("PSGMII recovered after %d times reset\n", i); - - /* configuration recover */ - /* packet number */ - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8021, 0x0); - /* disable check */ - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8029, 0x0); - /* disable traffic */ - ar40xx_phy_mmd_write(priv, 0x1f, 7, 0x8020, 0x0); -} - -void -ar40xx_psgmii_self_test_clean(struct ar40xx_priv *priv) -{ - int phy; - struct mii_bus *bus = priv->mii_bus; - - /* disable phy internal loopback */ - mdiobus_write(bus, 0x1f, 0x10, 0x6860); - mdiobus_write(bus, 0x1f, 0x0, 0x9040); - - for (phy = 0; phy < AR40XX_NUM_PORTS - 1; phy++) { - /* disable mac loop back */ - ar40xx_rmw(priv, AR40XX_REG_PORT_LOOKUP(phy + 1), - AR40XX_PORT_LOOKUP_LOOPBACK, 0); - /* disable phy mdio broadcast write */ - ar40xx_phy_mmd_write(priv, phy, 7, 0x8028, 0x001f); - } - - /* clear fdb entry */ - ar40xx_atu_flush(priv); -} - -/* End of psgmii self test */ - -static void -ar40xx_mac_mode_init(struct ar40xx_priv *priv, u32 mode) -{ - if (mode == PORT_WRAPPER_PSGMII) { - ar40xx_psgmii_write(priv, AR40XX_PSGMII_MODE_CONTROL, 0x2200); - ar40xx_psgmii_write(priv, AR40XX_PSGMIIPHY_TX_CONTROL, 0x8380); - } -} - -static -int ar40xx_cpuport_setup(struct ar40xx_priv *priv) -{ - u32 t; - - t = AR40XX_PORT_STATUS_TXFLOW | - AR40XX_PORT_STATUS_RXFLOW | - AR40XX_PORT_TXHALF_FLOW | - AR40XX_PORT_DUPLEX | - AR40XX_PORT_SPEED_1000M; - ar40xx_write(priv, AR40XX_REG_PORT_STATUS(0), t); - usleep_range(10, 20); - - t |= AR40XX_PORT_TX_EN | - AR40XX_PORT_RX_EN; - ar40xx_write(priv, AR40XX_REG_PORT_STATUS(0), t); - - return 0; -} - -static void -ar40xx_init_port(struct ar40xx_priv *priv, int port) -{ - u32 t; - - ar40xx_write(priv, AR40XX_REG_PORT_STATUS(port), 0); - - ar40xx_write(priv, AR40XX_REG_PORT_HEADER(port), 0); - - ar40xx_write(priv, AR40XX_REG_PORT_VLAN0(port), 0); - - t = AR40XX_PORT_VLAN1_OUT_MODE_UNTOUCH << AR40XX_PORT_VLAN1_OUT_MODE_S; - ar40xx_write(priv, AR40XX_REG_PORT_VLAN1(port), t); - - t = AR40XX_PORT_LOOKUP_LEARN; - t |= AR40XX_PORT_STATE_FORWARD << AR40XX_PORT_LOOKUP_STATE_S; - ar40xx_write(priv, AR40XX_REG_PORT_LOOKUP(port), t); -} - -void -ar40xx_init_globals(struct ar40xx_priv *priv) -{ - u32 t; - - /* enable CPU port and disable mirror port */ - t = AR40XX_FWD_CTRL0_CPU_PORT_EN | - AR40XX_FWD_CTRL0_MIRROR_PORT; - ar40xx_write(priv, AR40XX_REG_FWD_CTRL0, t); - - /* forward multicast and broadcast frames to CPU */ - t = (AR40XX_PORTS_ALL << AR40XX_FWD_CTRL1_UC_FLOOD_S) | - (AR40XX_PORTS_ALL << AR40XX_FWD_CTRL1_MC_FLOOD_S) | - (AR40XX_PORTS_ALL << AR40XX_FWD_CTRL1_BC_FLOOD_S); - ar40xx_write(priv, AR40XX_REG_FWD_CTRL1, t); - - /* enable jumbo frames */ - ar40xx_rmw(priv, AR40XX_REG_MAX_FRAME_SIZE, - AR40XX_MAX_FRAME_SIZE_MTU, 9018 + 8 + 2); - - /* Enable MIB counters */ - ar40xx_rmw(priv, AR40XX_REG_MODULE_EN, 0, - AR40XX_MODULE_EN_MIB); - - /* Disable AZ */ - ar40xx_write(priv, AR40XX_REG_EEE_CTRL, 0); - - /* set flowctrl thershold for cpu port */ - t = (AR40XX_PORT0_FC_THRESH_ON_DFLT << 16) | - AR40XX_PORT0_FC_THRESH_OFF_DFLT; - ar40xx_write(priv, AR40XX_REG_PORT_FLOWCTRL_THRESH(0), t); -} - -static int -ar40xx_hw_init(struct ar40xx_priv *priv) -{ - u32 i; - - ar40xx_ess_reset(priv); - - if (!priv->mii_bus) - return -1; - - ar40xx_psgmii_self_test(priv); - ar40xx_psgmii_self_test_clean(priv); - - ar40xx_mac_mode_init(priv, priv->mac_mode); - - for (i = 0; i < priv->dev.ports; i++) - ar40xx_init_port(priv, i); - - ar40xx_init_globals(priv); - - return 0; -} - -/* Start of qm error WAR */ - -static -int ar40xx_force_1g_full(struct ar40xx_priv *priv, u32 port_id) -{ - u32 reg; - - if (port_id < 0 || port_id > 6) - return -1; - - reg = AR40XX_REG_PORT_STATUS(port_id); - return ar40xx_rmw(priv, reg, AR40XX_PORT_SPEED, - (AR40XX_PORT_SPEED_1000M | AR40XX_PORT_DUPLEX)); -} - -static -int ar40xx_get_qm_status(struct ar40xx_priv *priv, - u32 port_id, u32 *qm_buffer_err) -{ - u32 reg; - u32 qm_val; - - if (port_id < 1 || port_id > 5) { - *qm_buffer_err = 0; - return -1; - } - - if (port_id < 4) { - reg = AR40XX_REG_QM_PORT0_3_QNUM; - ar40xx_write(priv, AR40XX_REG_QM_DEBUG_ADDR, reg); - qm_val = ar40xx_read(priv, AR40XX_REG_QM_DEBUG_VALUE); - /* every 8 bits for each port */ - *qm_buffer_err = (qm_val >> (port_id * 8)) & 0xFF; - } else { - reg = AR40XX_REG_QM_PORT4_6_QNUM; - ar40xx_write(priv, AR40XX_REG_QM_DEBUG_ADDR, reg); - qm_val = ar40xx_read(priv, AR40XX_REG_QM_DEBUG_VALUE); - /* every 8 bits for each port */ - *qm_buffer_err = (qm_val >> ((port_id-4) * 8)) & 0xFF; - } - - return 0; -} - -static void -ar40xx_sw_mac_polling_task(struct ar40xx_priv *priv) -{ - static int task_count; - u32 i; - u32 reg, value; - u32 link, speed, duplex; - u32 qm_buffer_err; - u16 port_phy_status[AR40XX_NUM_PORTS]; - static u32 qm_err_cnt[AR40XX_NUM_PORTS] = {0, 0, 0, 0, 0, 0}; - static u32 link_cnt[AR40XX_NUM_PORTS] = {0, 0, 0, 0, 0, 0}; - struct mii_bus *bus = NULL; - - if (!priv || !priv->mii_bus) - return; - - bus = priv->mii_bus; - - ++task_count; - - for (i = 1; i < AR40XX_NUM_PORTS; ++i) { - port_phy_status[i] = - mdiobus_read(bus, i-1, AR40XX_PHY_SPEC_STATUS); - - speed = FIELD_GET(AR40XX_PHY_SPEC_STATUS_SPEED, - port_phy_status[i]); - link = FIELD_GET(AR40XX_PHY_SPEC_STATUS_LINK, - port_phy_status[i]); - duplex = FIELD_GET(AR40XX_PHY_SPEC_STATUS_DUPLEX, - port_phy_status[i]); - - if (link != priv->ar40xx_port_old_link[i]) { - ++link_cnt[i]; - /* Up --> Down */ - if ((priv->ar40xx_port_old_link[i] == - AR40XX_PORT_LINK_UP) && - (link == AR40XX_PORT_LINK_DOWN)) { - /* LINK_EN disable(MAC force mode)*/ - reg = AR40XX_REG_PORT_STATUS(i); - ar40xx_rmw(priv, reg, - AR40XX_PORT_AUTO_LINK_EN, 0); - - /* Check queue buffer */ - qm_err_cnt[i] = 0; - ar40xx_get_qm_status(priv, i, &qm_buffer_err); - if (qm_buffer_err) { - priv->ar40xx_port_qm_buf[i] = - AR40XX_QM_NOT_EMPTY; - } else { - u16 phy_val = 0; - - priv->ar40xx_port_qm_buf[i] = - AR40XX_QM_EMPTY; - ar40xx_force_1g_full(priv, i); - /* Ref:QCA8337 Datasheet,Clearing - * MENU_CTRL_EN prevents phy to - * stuck in 100BT mode when - * bringing up the link - */ - ar40xx_phy_dbg_read(priv, i-1, - AR40XX_PHY_DEBUG_0, - &phy_val); - phy_val &= (~AR40XX_PHY_MANU_CTRL_EN); - ar40xx_phy_dbg_write(priv, i-1, - AR40XX_PHY_DEBUG_0, - phy_val); - } - priv->ar40xx_port_old_link[i] = link; - } else if ((priv->ar40xx_port_old_link[i] == - AR40XX_PORT_LINK_DOWN) && - (link == AR40XX_PORT_LINK_UP)) { - /* Down --> Up */ - if (priv->port_link_up[i] < 1) { - ++priv->port_link_up[i]; - } else { - /* Change port status */ - reg = AR40XX_REG_PORT_STATUS(i); - value = ar40xx_read(priv, reg); - priv->port_link_up[i] = 0; - - value &= ~(AR40XX_PORT_DUPLEX | - AR40XX_PORT_SPEED); - value |= speed | (duplex ? BIT(6) : 0); - ar40xx_write(priv, reg, value); - /* clock switch need such time - * to avoid glitch - */ - usleep_range(100, 200); - - value |= AR40XX_PORT_AUTO_LINK_EN; - ar40xx_write(priv, reg, value); - /* HW need such time to make sure link - * stable before enable MAC - */ - usleep_range(100, 200); - - if (speed == AR40XX_PORT_SPEED_100M) { - u16 phy_val = 0; - /* Enable @100M, if down to 10M - * clock will change smoothly - */ - ar40xx_phy_dbg_read(priv, i-1, - 0, - &phy_val); - phy_val |= - AR40XX_PHY_MANU_CTRL_EN; - ar40xx_phy_dbg_write(priv, i-1, - 0, - phy_val); - } - priv->ar40xx_port_old_link[i] = link; - } - } - } - - if (priv->ar40xx_port_qm_buf[i] == AR40XX_QM_NOT_EMPTY) { - /* Check QM */ - ar40xx_get_qm_status(priv, i, &qm_buffer_err); - if (qm_buffer_err) { - ++qm_err_cnt[i]; - } else { - priv->ar40xx_port_qm_buf[i] = - AR40XX_QM_EMPTY; - qm_err_cnt[i] = 0; - ar40xx_force_1g_full(priv, i); - } - } - } -} - -static void -ar40xx_qm_err_check_work_task(struct work_struct *work) -{ - struct ar40xx_priv *priv = container_of(work, struct ar40xx_priv, - qm_dwork.work); - - mutex_lock(&priv->qm_lock); - - ar40xx_sw_mac_polling_task(priv); - - mutex_unlock(&priv->qm_lock); - - schedule_delayed_work(&priv->qm_dwork, - msecs_to_jiffies(AR40XX_QM_WORK_DELAY)); -} - -static int -ar40xx_qm_err_check_work_start(struct ar40xx_priv *priv) -{ - mutex_init(&priv->qm_lock); - - INIT_DELAYED_WORK(&priv->qm_dwork, ar40xx_qm_err_check_work_task); - - schedule_delayed_work(&priv->qm_dwork, - msecs_to_jiffies(AR40XX_QM_WORK_DELAY)); - - return 0; -} - -/* End of qm error WAR */ - -static int -ar40xx_vlan_init(struct ar40xx_priv *priv) -{ - int port; - unsigned long bmp; - - /* By default Enable VLAN */ - priv->vlan = 1; - priv->vlan_table[AR40XX_LAN_VLAN] = priv->cpu_bmp | priv->lan_bmp; - priv->vlan_table[AR40XX_WAN_VLAN] = priv->cpu_bmp | priv->wan_bmp; - priv->vlan_tagged = priv->cpu_bmp; - bmp = priv->lan_bmp; - for_each_set_bit(port, &bmp, AR40XX_NUM_PORTS) - priv->pvid[port] = AR40XX_LAN_VLAN; - - bmp = priv->wan_bmp; - for_each_set_bit(port, &bmp, AR40XX_NUM_PORTS) - priv->pvid[port] = AR40XX_WAN_VLAN; - - return 0; -} - -static void -ar40xx_mib_work_func(struct work_struct *work) -{ - struct ar40xx_priv *priv; - int err; - - priv = container_of(work, struct ar40xx_priv, mib_work.work); - - mutex_lock(&priv->mib_lock); - - err = ar40xx_mib_capture(priv); - if (err) - goto next_port; - - ar40xx_mib_fetch_port_stat(priv, priv->mib_next_port, false); - -next_port: - priv->mib_next_port++; - if (priv->mib_next_port >= priv->dev.ports) - priv->mib_next_port = 0; - - mutex_unlock(&priv->mib_lock); - - schedule_delayed_work(&priv->mib_work, - msecs_to_jiffies(AR40XX_MIB_WORK_DELAY)); -} - -static void -ar40xx_setup_port(struct ar40xx_priv *priv, int port, u32 members) -{ - u32 t; - u32 egress, ingress; - u32 pvid = priv->vlan_id[priv->pvid[port]]; - - if (priv->vlan) { - egress = AR40XX_PORT_VLAN1_OUT_MODE_UNMOD; - - ingress = AR40XX_IN_SECURE; - } else { - egress = AR40XX_PORT_VLAN1_OUT_MODE_UNTOUCH; - ingress = AR40XX_IN_PORT_ONLY; - } - - t = pvid << AR40XX_PORT_VLAN0_DEF_SVID_S; - t |= pvid << AR40XX_PORT_VLAN0_DEF_CVID_S; - ar40xx_write(priv, AR40XX_REG_PORT_VLAN0(port), t); - - t = AR40XX_PORT_VLAN1_PORT_VLAN_PROP; - t |= egress << AR40XX_PORT_VLAN1_OUT_MODE_S; - - ar40xx_write(priv, AR40XX_REG_PORT_VLAN1(port), t); - - t = members; - t |= AR40XX_PORT_LOOKUP_LEARN; - t |= ingress << AR40XX_PORT_LOOKUP_IN_MODE_S; - t |= AR40XX_PORT_STATE_FORWARD << AR40XX_PORT_LOOKUP_STATE_S; - ar40xx_write(priv, AR40XX_REG_PORT_LOOKUP(port), t); -} - -static void -ar40xx_vtu_op(struct ar40xx_priv *priv, u32 op, u32 val) -{ - if (ar40xx_wait_bit(priv, AR40XX_REG_VTU_FUNC1, - AR40XX_VTU_FUNC1_BUSY, 0)) - return; - - if ((op & AR40XX_VTU_FUNC1_OP) == AR40XX_VTU_FUNC1_OP_LOAD) - ar40xx_write(priv, AR40XX_REG_VTU_FUNC0, val); - - op |= AR40XX_VTU_FUNC1_BUSY; - ar40xx_write(priv, AR40XX_REG_VTU_FUNC1, op); -} - -static void -ar40xx_vtu_load_vlan(struct ar40xx_priv *priv, u32 vid, u32 port_mask) -{ - u32 op; - u32 val; - int i; - - op = AR40XX_VTU_FUNC1_OP_LOAD | (vid << AR40XX_VTU_FUNC1_VID_S); - val = AR40XX_VTU_FUNC0_VALID | AR40XX_VTU_FUNC0_IVL; - for (i = 0; i < AR40XX_NUM_PORTS; i++) { - u32 mode; - - if ((port_mask & BIT(i)) == 0) - mode = AR40XX_VTU_FUNC0_EG_MODE_NOT; - else if (priv->vlan == 0) - mode = AR40XX_VTU_FUNC0_EG_MODE_KEEP; - else if ((priv->vlan_tagged & BIT(i)) || - (priv->vlan_id[priv->pvid[i]] != vid)) - mode = AR40XX_VTU_FUNC0_EG_MODE_TAG; - else - mode = AR40XX_VTU_FUNC0_EG_MODE_UNTAG; - - val |= mode << AR40XX_VTU_FUNC0_EG_MODE_S(i); - } - ar40xx_vtu_op(priv, op, val); -} - -static void -ar40xx_vtu_flush(struct ar40xx_priv *priv) -{ - ar40xx_vtu_op(priv, AR40XX_VTU_FUNC1_OP_FLUSH, 0); -} - -static int -ar40xx_sw_hw_apply(struct switch_dev *dev) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - u8 portmask[AR40XX_NUM_PORTS]; - int i, j; - - mutex_lock(&priv->reg_mutex); - /* flush all vlan entries */ - ar40xx_vtu_flush(priv); - - memset(portmask, 0, sizeof(portmask)); - if (priv->vlan) { - for (j = 0; j < AR40XX_MAX_VLANS; j++) { - u8 vp = priv->vlan_table[j]; - - if (!vp) - continue; - - for (i = 0; i < dev->ports; i++) { - u8 mask = BIT(i); - - if (vp & mask) - portmask[i] |= vp & ~mask; - } - - ar40xx_vtu_load_vlan(priv, priv->vlan_id[j], - priv->vlan_table[j]); - } - } else { - /* 8021q vlan disabled */ - for (i = 0; i < dev->ports; i++) { - if (i == AR40XX_PORT_CPU) - continue; - - portmask[i] = BIT(AR40XX_PORT_CPU); - portmask[AR40XX_PORT_CPU] |= BIT(i); - } - } - - /* update the port destination mask registers and tag settings */ - for (i = 0; i < dev->ports; i++) - ar40xx_setup_port(priv, i, portmask[i]); - - ar40xx_set_mirror_regs(priv); - - mutex_unlock(&priv->reg_mutex); - return 0; -} - -static int -ar40xx_sw_reset_switch(struct switch_dev *dev) -{ - struct ar40xx_priv *priv = swdev_to_ar40xx(dev); - int i, rv; - - mutex_lock(&priv->reg_mutex); - memset(&priv->vlan, 0, sizeof(struct ar40xx_priv) - - offsetof(struct ar40xx_priv, vlan)); - - for (i = 0; i < AR40XX_MAX_VLANS; i++) - priv->vlan_id[i] = i; - - ar40xx_vlan_init(priv); - - priv->mirror_rx = false; - priv->mirror_tx = false; - priv->source_port = 0; - priv->monitor_port = 0; - - mutex_unlock(&priv->reg_mutex); - - rv = ar40xx_sw_hw_apply(dev); - return rv; -} - -static int -ar40xx_start(struct ar40xx_priv *priv) -{ - int ret; - - ret = ar40xx_hw_init(priv); - if (ret) - return ret; - - ret = ar40xx_sw_reset_switch(&priv->dev); - if (ret) - return ret; - - /* at last, setup cpu port */ - ret = ar40xx_cpuport_setup(priv); - if (ret) - return ret; - - schedule_delayed_work(&priv->mib_work, - msecs_to_jiffies(AR40XX_MIB_WORK_DELAY)); - - ar40xx_qm_err_check_work_start(priv); - - return 0; -} - -static const struct switch_dev_ops ar40xx_sw_ops = { - .attr_global = { - .attr = ar40xx_sw_attr_globals, - .n_attr = ARRAY_SIZE(ar40xx_sw_attr_globals), - }, - .attr_port = { - .attr = ar40xx_sw_attr_port, - .n_attr = ARRAY_SIZE(ar40xx_sw_attr_port), - }, - .attr_vlan = { - .attr = ar40xx_sw_attr_vlan, - .n_attr = ARRAY_SIZE(ar40xx_sw_attr_vlan), - }, - .get_port_pvid = ar40xx_sw_get_pvid, - .set_port_pvid = ar40xx_sw_set_pvid, - .get_vlan_ports = ar40xx_sw_get_ports, - .set_vlan_ports = ar40xx_sw_set_ports, - .apply_config = ar40xx_sw_hw_apply, - .reset_switch = ar40xx_sw_reset_switch, - .get_port_link = ar40xx_sw_get_port_link, -}; - -/* Platform driver probe function */ - -static int ar40xx_probe(struct platform_device *pdev) -{ - struct device_node *switch_node; - struct device_node *psgmii_node; - struct device_node *mdio_node; - const __be32 *mac_mode; - struct clk *ess_clk; - struct switch_dev *swdev; - struct ar40xx_priv *priv; - u32 len; - u32 num_mibs; - struct resource psgmii_base = {0}; - struct resource switch_base = {0}; - int ret; - - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - platform_set_drvdata(pdev, priv); - ar40xx_priv = priv; - - switch_node = of_node_get(pdev->dev.of_node); - if (of_address_to_resource(switch_node, 0, &switch_base) != 0) - return -EIO; - - priv->hw_addr = devm_ioremap_resource(&pdev->dev, &switch_base); - if (IS_ERR(priv->hw_addr)) { - dev_err(&pdev->dev, "Failed to ioremap switch_base!\n"); - return PTR_ERR(priv->hw_addr); - } - - /*psgmii dts get*/ - psgmii_node = of_find_node_by_name(NULL, "ess-psgmii"); - if (!psgmii_node) { - dev_err(&pdev->dev, "Failed to find ess-psgmii node!\n"); - return -EINVAL; - } - - if (of_address_to_resource(psgmii_node, 0, &psgmii_base) != 0) - return -EIO; - - priv->psgmii_hw_addr = devm_ioremap_resource(&pdev->dev, &psgmii_base); - if (IS_ERR(priv->psgmii_hw_addr)) { - dev_err(&pdev->dev, "psgmii ioremap fail!\n"); - return PTR_ERR(priv->psgmii_hw_addr); - } - - mac_mode = of_get_property(switch_node, "switch_mac_mode", &len); - if (!mac_mode) { - dev_err(&pdev->dev, "Failed to read switch_mac_mode\n"); - return -EINVAL; - } - priv->mac_mode = be32_to_cpup(mac_mode); - - ess_clk = of_clk_get_by_name(switch_node, "ess_clk"); - if (ess_clk) - clk_prepare_enable(ess_clk); - - priv->ess_rst = devm_reset_control_get(&pdev->dev, "ess_rst"); - if (IS_ERR(priv->ess_rst)) { - dev_err(&pdev->dev, "Failed to get ess_rst control!\n"); - return PTR_ERR(priv->ess_rst); - } - - if (of_property_read_u32(switch_node, "switch_cpu_bmp", - &priv->cpu_bmp) || - of_property_read_u32(switch_node, "switch_lan_bmp", - &priv->lan_bmp) || - of_property_read_u32(switch_node, "switch_wan_bmp", - &priv->wan_bmp)) { - dev_err(&pdev->dev, "Failed to read port properties\n"); - return -EIO; - } - - mutex_init(&priv->reg_mutex); - mutex_init(&priv->mib_lock); - INIT_DELAYED_WORK(&priv->mib_work, ar40xx_mib_work_func); - - /* register switch */ - swdev = &priv->dev; - - mdio_node = of_find_compatible_node(NULL, NULL, "qcom,ipq4019-mdio"); - if (!mdio_node) { - dev_err(&pdev->dev, "Probe failed - Cannot find mdio node by phandle!\n"); - ret = -ENODEV; - goto err_missing_phy; - } - - priv->mii_bus = of_mdio_find_bus(mdio_node); - - 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; - swdev->name = "QCA AR40xx"; - swdev->vlans = AR40XX_MAX_VLANS; - swdev->ports = AR40XX_NUM_PORTS; - swdev->ops = &ar40xx_sw_ops; - ret = register_switch(swdev, NULL); - if (ret < 0) { - dev_err(&pdev->dev, "Switch registration failed!\n"); - return ret; - } - - num_mibs = ARRAY_SIZE(ar40xx_mibs); - len = priv->dev.ports * num_mibs * - sizeof(*priv->mib_stats); - priv->mib_stats = devm_kzalloc(&pdev->dev, len, GFP_KERNEL); - if (!priv->mib_stats) { - ret = -ENOMEM; - goto err_unregister_switch; - } - - ar40xx_start(priv); - - return 0; - -err_unregister_switch: - unregister_switch(&priv->dev); -err_missing_phy: - platform_set_drvdata(pdev, NULL); - return ret; -} - -static int ar40xx_remove(struct platform_device *pdev) -{ - struct ar40xx_priv *priv = platform_get_drvdata(pdev); - - cancel_delayed_work_sync(&priv->qm_dwork); - cancel_delayed_work_sync(&priv->mib_work); - - unregister_switch(&priv->dev); - - return 0; -} - -static const struct of_device_id ar40xx_of_mtable[] = { - {.compatible = "qcom,ess-switch" }, - {} -}; - -struct platform_driver ar40xx_drv = { - .probe = ar40xx_probe, - .remove = ar40xx_remove, - .driver = { - .name = "ar40xx", - .of_match_table = ar40xx_of_mtable, - }, -}; - -module_platform_driver(ar40xx_drv); - -MODULE_DESCRIPTION("IPQ40XX ESS driver"); -MODULE_LICENSE("Dual BSD/GPL"); diff --git a/target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.h b/target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.h deleted file mode 100644 index 7ba40ccf75..0000000000 --- a/target/linux/ipq40xx/files-5.4/drivers/net/phy/ar40xx.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - #ifndef __AR40XX_H -#define __AR40XX_H - -#define AR40XX_MAX_VLANS 128 -#define AR40XX_NUM_PORTS 6 -#define AR40XX_NUM_PHYS 5 - -#define BITS(_s, _n) (((1UL << (_n)) - 1) << _s) - -struct ar40xx_priv { - struct switch_dev dev; - - u8 __iomem *hw_addr; - u8 __iomem *psgmii_hw_addr; - u32 mac_mode; - struct reset_control *ess_rst; - u32 cpu_bmp; - u32 lan_bmp; - u32 wan_bmp; - - struct mii_bus *mii_bus; - struct phy_device *phy; - - /* mutex for qm task */ - struct mutex qm_lock; - struct delayed_work qm_dwork; - u32 port_link_up[AR40XX_NUM_PORTS]; - u32 ar40xx_port_old_link[AR40XX_NUM_PORTS]; - u32 ar40xx_port_qm_buf[AR40XX_NUM_PORTS]; - - u32 phy_t_status; - - /* mutex for switch reg access */ - struct mutex reg_mutex; - - /* mutex for mib task */ - struct mutex mib_lock; - struct delayed_work mib_work; - int mib_next_port; - u64 *mib_stats; - - char buf[2048]; - - /* all fields below will be cleared on reset */ - bool vlan; - u16 vlan_id[AR40XX_MAX_VLANS]; - u8 vlan_table[AR40XX_MAX_VLANS]; - u8 vlan_tagged; - u16 pvid[AR40XX_NUM_PORTS]; - - /* mirror */ - bool mirror_rx; - bool mirror_tx; - int source_port; - int monitor_port; -}; - -#define AR40XX_PORT_LINK_UP 1 -#define AR40XX_PORT_LINK_DOWN 0 -#define AR40XX_QM_NOT_EMPTY 1 -#define AR40XX_QM_EMPTY 0 - -#define AR40XX_LAN_VLAN 1 -#define AR40XX_WAN_VLAN 2 - -enum ar40xx_port_wrapper_cfg { - PORT_WRAPPER_PSGMII = 0, -}; - -struct ar40xx_mib_desc { - u32 size; - u32 offset; - const char *name; -}; - -#define AR40XX_PORT_CPU 0 - -#define AR40XX_PSGMII_MODE_CONTROL 0x1b4 -#define AR40XX_PSGMII_ATHR_CSCO_MODE_25M BIT(0) - -#define AR40XX_PSGMIIPHY_TX_CONTROL 0x288 - -#define AR40XX_MII_ATH_MMD_ADDR 0x0d -#define AR40XX_MII_ATH_MMD_DATA 0x0e -#define AR40XX_MII_ATH_DBG_ADDR 0x1d -#define AR40XX_MII_ATH_DBG_DATA 0x1e - -#define AR40XX_STATS_RXBROAD 0x00 -#define AR40XX_STATS_RXPAUSE 0x04 -#define AR40XX_STATS_RXMULTI 0x08 -#define AR40XX_STATS_RXFCSERR 0x0c -#define AR40XX_STATS_RXALIGNERR 0x10 -#define AR40XX_STATS_RXRUNT 0x14 -#define AR40XX_STATS_RXFRAGMENT 0x18 -#define AR40XX_STATS_RX64BYTE 0x1c -#define AR40XX_STATS_RX128BYTE 0x20 -#define AR40XX_STATS_RX256BYTE 0x24 -#define AR40XX_STATS_RX512BYTE 0x28 -#define AR40XX_STATS_RX1024BYTE 0x2c -#define AR40XX_STATS_RX1518BYTE 0x30 -#define AR40XX_STATS_RXMAXBYTE 0x34 -#define AR40XX_STATS_RXTOOLONG 0x38 -#define AR40XX_STATS_RXGOODBYTE 0x3c -#define AR40XX_STATS_RXBADBYTE 0x44 -#define AR40XX_STATS_RXOVERFLOW 0x4c -#define AR40XX_STATS_FILTERED 0x50 -#define AR40XX_STATS_TXBROAD 0x54 -#define AR40XX_STATS_TXPAUSE 0x58 -#define AR40XX_STATS_TXMULTI 0x5c -#define AR40XX_STATS_TXUNDERRUN 0x60 -#define AR40XX_STATS_TX64BYTE 0x64 -#define AR40XX_STATS_TX128BYTE 0x68 -#define AR40XX_STATS_TX256BYTE 0x6c -#define AR40XX_STATS_TX512BYTE 0x70 -#define AR40XX_STATS_TX1024BYTE 0x74 -#define AR40XX_STATS_TX1518BYTE 0x78 -#define AR40XX_STATS_TXMAXBYTE 0x7c -#define AR40XX_STATS_TXOVERSIZE 0x80 -#define AR40XX_STATS_TXBYTE 0x84 -#define AR40XX_STATS_TXCOLLISION 0x8c -#define AR40XX_STATS_TXABORTCOL 0x90 -#define AR40XX_STATS_TXMULTICOL 0x94 -#define AR40XX_STATS_TXSINGLECOL 0x98 -#define AR40XX_STATS_TXEXCDEFER 0x9c -#define AR40XX_STATS_TXDEFER 0xa0 -#define AR40XX_STATS_TXLATECOL 0xa4 - -#define AR40XX_REG_MODULE_EN 0x030 -#define AR40XX_MODULE_EN_MIB BIT(0) - -#define AR40XX_REG_MIB_FUNC 0x034 -#define AR40XX_MIB_BUSY BIT(17) -#define AR40XX_MIB_CPU_KEEP BIT(20) -#define AR40XX_MIB_FUNC BITS(24, 3) -#define AR40XX_MIB_FUNC_S 24 -#define AR40XX_MIB_FUNC_NO_OP 0x0 -#define AR40XX_MIB_FUNC_FLUSH 0x1 - -#define AR40XX_ESS_SERVICE_TAG 0x48 -#define AR40XX_ESS_SERVICE_TAG_STAG BIT(17) - -#define AR40XX_REG_PORT_STATUS(_i) (0x07c + (_i) * 4) -#define AR40XX_PORT_SPEED BITS(0, 2) -#define AR40XX_PORT_STATUS_SPEED_S 0 -#define AR40XX_PORT_TX_EN BIT(2) -#define AR40XX_PORT_RX_EN BIT(3) -#define AR40XX_PORT_STATUS_TXFLOW BIT(4) -#define AR40XX_PORT_STATUS_RXFLOW BIT(5) -#define AR40XX_PORT_DUPLEX BIT(6) -#define AR40XX_PORT_TXHALF_FLOW BIT(7) -#define AR40XX_PORT_STATUS_LINK_UP BIT(8) -#define AR40XX_PORT_AUTO_LINK_EN BIT(9) -#define AR40XX_PORT_STATUS_FLOW_CONTROL BIT(12) - -#define AR40XX_REG_MAX_FRAME_SIZE 0x078 -#define AR40XX_MAX_FRAME_SIZE_MTU BITS(0, 14) - -#define AR40XX_REG_PORT_HEADER(_i) (0x09c + (_i) * 4) - -#define AR40XX_REG_EEE_CTRL 0x100 -#define AR40XX_EEE_CTRL_DISABLE_PHY(_i) BIT(4 + (_i) * 2) - -#define AR40XX_REG_PORT_VLAN0(_i) (0x420 + (_i) * 0x8) -#define AR40XX_PORT_VLAN0_DEF_SVID BITS(0, 12) -#define AR40XX_PORT_VLAN0_DEF_SVID_S 0 -#define AR40XX_PORT_VLAN0_DEF_CVID BITS(16, 12) -#define AR40XX_PORT_VLAN0_DEF_CVID_S 16 - -#define AR40XX_REG_PORT_VLAN1(_i) (0x424 + (_i) * 0x8) -#define AR40XX_PORT_VLAN1_CORE_PORT BIT(9) -#define AR40XX_PORT_VLAN1_PORT_TLS_MODE BIT(7) -#define AR40XX_PORT_VLAN1_PORT_VLAN_PROP BIT(6) -#define AR40XX_PORT_VLAN1_OUT_MODE BITS(12, 2) -#define AR40XX_PORT_VLAN1_OUT_MODE_S 12 -#define AR40XX_PORT_VLAN1_OUT_MODE_UNMOD 0 -#define AR40XX_PORT_VLAN1_OUT_MODE_UNTAG 1 -#define AR40XX_PORT_VLAN1_OUT_MODE_TAG 2 -#define AR40XX_PORT_VLAN1_OUT_MODE_UNTOUCH 3 - -#define AR40XX_REG_VTU_FUNC0 0x0610 -#define AR40XX_VTU_FUNC0_EG_MODE BITS(4, 14) -#define AR40XX_VTU_FUNC0_EG_MODE_S(_i) (4 + (_i) * 2) -#define AR40XX_VTU_FUNC0_EG_MODE_KEEP 0 -#define AR40XX_VTU_FUNC0_EG_MODE_UNTAG 1 -#define AR40XX_VTU_FUNC0_EG_MODE_TAG 2 -#define AR40XX_VTU_FUNC0_EG_MODE_NOT 3 -#define AR40XX_VTU_FUNC0_IVL BIT(19) -#define AR40XX_VTU_FUNC0_VALID BIT(20) - -#define AR40XX_REG_VTU_FUNC1 0x0614 -#define AR40XX_VTU_FUNC1_OP BITS(0, 3) -#define AR40XX_VTU_FUNC1_OP_NOOP 0 -#define AR40XX_VTU_FUNC1_OP_FLUSH 1 -#define AR40XX_VTU_FUNC1_OP_LOAD 2 -#define AR40XX_VTU_FUNC1_OP_PURGE 3 -#define AR40XX_VTU_FUNC1_OP_REMOVE_PORT 4 -#define AR40XX_VTU_FUNC1_OP_GET_NEXT 5 -#define AR40XX7_VTU_FUNC1_OP_GET_ONE 6 -#define AR40XX_VTU_FUNC1_FULL BIT(4) -#define AR40XX_VTU_FUNC1_PORT BIT(8, 4) -#define AR40XX_VTU_FUNC1_PORT_S 8 -#define AR40XX_VTU_FUNC1_VID BIT(16, 12) -#define AR40XX_VTU_FUNC1_VID_S 16 -#define AR40XX_VTU_FUNC1_BUSY BIT(31) - -#define AR40XX_REG_FWD_CTRL0 0x620 -#define AR40XX_FWD_CTRL0_CPU_PORT_EN BIT(10) -#define AR40XX_FWD_CTRL0_MIRROR_PORT BITS(4, 4) -#define AR40XX_FWD_CTRL0_MIRROR_PORT_S 4 - -#define AR40XX_REG_FWD_CTRL1 0x624 -#define AR40XX_FWD_CTRL1_UC_FLOOD BITS(0, 7) -#define AR40XX_FWD_CTRL1_UC_FLOOD_S 0 -#define AR40XX_FWD_CTRL1_MC_FLOOD BITS(8, 7) -#define AR40XX_FWD_CTRL1_MC_FLOOD_S 8 -#define AR40XX_FWD_CTRL1_BC_FLOOD BITS(16, 7) -#define AR40XX_FWD_CTRL1_BC_FLOOD_S 16 -#define AR40XX_FWD_CTRL1_IGMP BITS(24, 7) -#define AR40XX_FWD_CTRL1_IGMP_S 24 - -#define AR40XX_REG_PORT_LOOKUP(_i) (0x660 + (_i) * 0xc) -#define AR40XX_PORT_LOOKUP_MEMBER BITS(0, 7) -#define AR40XX_PORT_LOOKUP_IN_MODE BITS(8, 2) -#define AR40XX_PORT_LOOKUP_IN_MODE_S 8 -#define AR40XX_PORT_LOOKUP_STATE BITS(16, 3) -#define AR40XX_PORT_LOOKUP_STATE_S 16 -#define AR40XX_PORT_LOOKUP_LEARN BIT(20) -#define AR40XX_PORT_LOOKUP_LOOPBACK BIT(21) -#define AR40XX_PORT_LOOKUP_ING_MIRROR_EN BIT(25) - -#define AR40XX_REG_ATU_FUNC 0x60c -#define AR40XX_ATU_FUNC_OP BITS(0, 4) -#define AR40XX_ATU_FUNC_OP_NOOP 0x0 -#define AR40XX_ATU_FUNC_OP_FLUSH 0x1 -#define AR40XX_ATU_FUNC_OP_LOAD 0x2 -#define AR40XX_ATU_FUNC_OP_PURGE 0x3 -#define AR40XX_ATU_FUNC_OP_FLUSH_LOCKED 0x4 -#define AR40XX_ATU_FUNC_OP_FLUSH_UNICAST 0x5 -#define AR40XX_ATU_FUNC_OP_GET_NEXT 0x6 -#define AR40XX_ATU_FUNC_OP_SEARCH_MAC 0x7 -#define AR40XX_ATU_FUNC_OP_CHANGE_TRUNK 0x8 -#define AR40XX_ATU_FUNC_BUSY BIT(31) - -#define AR40XX_REG_QM_DEBUG_ADDR 0x820 -#define AR40XX_REG_QM_DEBUG_VALUE 0x824 -#define AR40XX_REG_QM_PORT0_3_QNUM 0x1d -#define AR40XX_REG_QM_PORT4_6_QNUM 0x1e - -#define AR40XX_REG_PORT_HOL_CTRL1(_i) (0x974 + (_i) * 0x8) -#define AR40XX_PORT_HOL_CTRL1_EG_MIRROR_EN BIT(16) - -#define AR40XX_REG_PORT_FLOWCTRL_THRESH(_i) (0x9b0 + (_i) * 0x4) -#define AR40XX_PORT0_FC_THRESH_ON_DFLT 0x60 -#define AR40XX_PORT0_FC_THRESH_OFF_DFLT 0x90 - -#define AR40XX_PHY_DEBUG_0 0 -#define AR40XX_PHY_MANU_CTRL_EN BIT(12) - -#define AR40XX_PHY_DEBUG_2 2 - -#define AR40XX_PHY_SPEC_STATUS 0x11 -#define AR40XX_PHY_SPEC_STATUS_LINK BIT(10) -#define AR40XX_PHY_SPEC_STATUS_DUPLEX BIT(13) -#define AR40XX_PHY_SPEC_STATUS_SPEED BITS(14, 2) - -/* port forwarding state */ -enum { - AR40XX_PORT_STATE_DISABLED = 0, - AR40XX_PORT_STATE_BLOCK = 1, - AR40XX_PORT_STATE_LISTEN = 2, - AR40XX_PORT_STATE_LEARN = 3, - AR40XX_PORT_STATE_FORWARD = 4 -}; - -/* ingress 802.1q mode */ -enum { - AR40XX_IN_PORT_ONLY = 0, - AR40XX_IN_PORT_FALLBACK = 1, - AR40XX_IN_VLAN_ONLY = 2, - AR40XX_IN_SECURE = 3 -}; - -/* egress 802.1q mode */ -enum { - AR40XX_OUT_KEEP = 0, - AR40XX_OUT_STRIP_VLAN = 1, - AR40XX_OUT_ADD_VLAN = 2 -}; - -/* port speed */ -enum { - AR40XX_PORT_SPEED_10M = 0, - AR40XX_PORT_SPEED_100M = 1, - AR40XX_PORT_SPEED_1000M = 2, - AR40XX_PORT_SPEED_ERR = 3, -}; - -#define AR40XX_MIB_WORK_DELAY 2000 /* msecs */ - -#define AR40XX_QM_WORK_DELAY 100 - -#define AR40XX_MIB_FUNC_CAPTURE 0x3 - -#define AR40XX_REG_PORT_STATS_START 0x1000 -#define AR40XX_REG_PORT_STATS_LEN 0x100 - -#define AR40XX_PORTS_ALL 0x3f - -#define AR40XX_PSGMII_ID 5 -#define AR40XX_PSGMII_CALB_NUM 100 -#define AR40XX_MALIBU_PSGMII_MODE_CTRL 0x6d -#define AR40XX_MALIBU_PHY_PSGMII_MODE_CTRL_ADJUST_VAL 0x220c -#define AR40XX_MALIBU_PHY_MMD7_DAC_CTRL 0x801a -#define AR40XX_MALIBU_DAC_CTRL_MASK 0x380 -#define AR40XX_MALIBU_DAC_CTRL_VALUE 0x280 -#define AR40XX_MALIBU_PHY_RLP_CTRL 0x805a -#define AR40XX_PSGMII_TX_DRIVER_1_CTRL 0xb -#define AR40XX_MALIBU_PHY_PSGMII_REDUCE_SERDES_TX_AMP 0x8a -#define AR40XX_MALIBU_PHY_LAST_ADDR 4 - -static inline struct ar40xx_priv * -swdev_to_ar40xx(struct switch_dev *swdev) -{ - return container_of(swdev, struct ar40xx_priv, dev); -} - -#endif diff --git a/target/linux/ipq40xx/patches-5.4/0001-v5.7-ARM-qcom-Add-support-for-IPQ40xx.patch b/target/linux/ipq40xx/patches-5.4/0001-v5.7-ARM-qcom-Add-support-for-IPQ40xx.patch deleted file mode 100644 index 8aa71f360f..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0001-v5.7-ARM-qcom-Add-support-for-IPQ40xx.patch +++ /dev/null @@ -1,42 +0,0 @@ -From f125e2d4339dda6937865f975470b29c84714c9b Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Mon, 6 Jan 2020 14:57:15 +0100 -Subject: [PATCH] ARM: qcom: Add support for IPQ40xx - -Add support for the Qualcomm IPQ40xx SoC in Kconfig. -Also add its appropriate textofs. - -Signed-off-by: Christian Lamparter -Signed-off-by: John Crispin -Tested-by: Robert Marko -Cc: Luka Perkov -Signed-off-by: Arnd Bergmann ---- - arch/arm/Makefile | 1 + - arch/arm/mach-qcom/Kconfig | 5 +++++ - 2 files changed, 6 insertions(+) - ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -152,6 +152,7 @@ textofs-$(CONFIG_PM_H1940) := 0x001 - ifeq ($(CONFIG_ARCH_SA1100),y) - textofs-$(CONFIG_SA1111) := 0x00208000 - endif -+textofs-$(CONFIG_ARCH_IPQ40XX) := 0x00208000 - textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000 - textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000 - textofs-$(CONFIG_ARCH_MESON) := 0x00208000 ---- a/arch/arm/mach-qcom/Kconfig -+++ b/arch/arm/mach-qcom/Kconfig -@@ -12,6 +12,11 @@ menuconfig ARCH_QCOM - - if ARCH_QCOM - -+config ARCH_IPQ40XX -+ bool "Enable support for IPQ40XX" -+ select CLKSRC_QCOM -+ select HAVE_ARM_ARCH_TIMER -+ - config ARCH_MSM8X60 - bool "Enable support for MSM8X60" - select CLKSRC_QCOM diff --git a/target/linux/ipq40xx/patches-5.4/0002-01-v5.6-regulator-add-IPQ4019-SDHCI-VQMMC-LDO-driver.patch b/target/linux/ipq40xx/patches-5.4/0002-01-v5.6-regulator-add-IPQ4019-SDHCI-VQMMC-LDO-driver.patch deleted file mode 100644 index aaf8c807ed..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0002-01-v5.6-regulator-add-IPQ4019-SDHCI-VQMMC-LDO-driver.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 97043d292365ae39d62b54a6d79dff98d048b501 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 22 Jan 2020 12:44:14 +0100 -Subject: [PATCH] From ebf652b408200504194be32ad0a3f5bb49d6000a Mon Sep 17 - 00:00:00 2001 From: Robert Marko Date: Sun, 12 Jan - 2020 12:30:01 +0100 Subject: [PATCH] regulator: add IPQ4019 SDHCI VQMMC LDO - driver - -This introduces the IPQ4019 VQMMC LDO driver needed for -the SD/EMMC driver I/O level operation. -This will enable introducing SD/EMMC support for the built-in controller. - -Signed-off-by: Mantas Pucka -Signed-off-by: Robert Marko -Link: https://lore.kernel.org/r/20200112113003.11110-1-robert.marko@sartura.hr -Signed-off-by: Mark Brown ---- - drivers/regulator/Kconfig | 7 ++ - drivers/regulator/Makefile | 1 + - drivers/regulator/vqmmc-ipq4019-regulator.c | 101 ++++++++++++++++++++ - 3 files changed, 109 insertions(+) - create mode 100644 drivers/regulator/vqmmc-ipq4019-regulator.c - ---- a/drivers/regulator/Kconfig -+++ b/drivers/regulator/Kconfig -@@ -1077,6 +1077,13 @@ config REGULATOR_VEXPRESS - This driver provides support for voltage regulators available - on the ARM Ltd's Versatile Express platform. - -+config REGULATOR_VQMMC_IPQ4019 -+ tristate "IPQ4019 VQMMC SD LDO regulator support" -+ depends on ARCH_QCOM -+ help -+ This driver provides support for the VQMMC LDO I/0 -+ voltage regulator of the IPQ4019 SD/EMMC controller. -+ - config REGULATOR_WM831X - tristate "Wolfson Microelectronics WM831x PMIC regulators" - depends on MFD_WM831X ---- a/drivers/regulator/Makefile -+++ b/drivers/regulator/Makefile -@@ -132,6 +132,7 @@ obj-$(CONFIG_REGULATOR_TWL4030) += twl-r - obj-$(CONFIG_REGULATOR_UNIPHIER) += uniphier-regulator.o - obj-$(CONFIG_REGULATOR_VCTRL) += vctrl-regulator.o - obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress-regulator.o -+obj-$(CONFIG_REGULATOR_VQMMC_IPQ4019) += vqmmc-ipq4019-regulator.o - obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o - obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o - obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o ---- /dev/null -+++ b/drivers/regulator/vqmmc-ipq4019-regulator.c -@@ -0,0 +1,101 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// -+// Copyright (c) 2019 Mantas Pucka -+// Copyright (c) 2019 Robert Marko -+// -+// Driver for IPQ4019 SD/MMC controller's I/O LDO voltage regulator -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static const unsigned int ipq4019_vmmc_voltages[] = { -+ 1500000, 1800000, 2500000, 3000000, -+}; -+ -+static const struct regulator_ops ipq4019_regulator_voltage_ops = { -+ .list_voltage = regulator_list_voltage_table, -+ .map_voltage = regulator_map_voltage_ascend, -+ .get_voltage_sel = regulator_get_voltage_sel_regmap, -+ .set_voltage_sel = regulator_set_voltage_sel_regmap, -+}; -+ -+static const struct regulator_desc vmmc_regulator = { -+ .name = "vmmcq", -+ .ops = &ipq4019_regulator_voltage_ops, -+ .type = REGULATOR_VOLTAGE, -+ .owner = THIS_MODULE, -+ .volt_table = ipq4019_vmmc_voltages, -+ .n_voltages = ARRAY_SIZE(ipq4019_vmmc_voltages), -+ .vsel_reg = 0, -+ .vsel_mask = 0x3, -+}; -+ -+static const struct regmap_config ipq4019_vmmcq_regmap_config = { -+ .reg_bits = 32, -+ .reg_stride = 4, -+ .val_bits = 32, -+}; -+ -+static int ipq4019_regulator_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct regulator_init_data *init_data; -+ struct regulator_config cfg = {}; -+ struct regulator_dev *rdev; -+ struct resource *res; -+ struct regmap *rmap; -+ void __iomem *base; -+ -+ init_data = of_get_regulator_init_data(dev, dev->of_node, -+ &vmmc_regulator); -+ if (!init_data) -+ return -EINVAL; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ base = devm_ioremap_resource(dev, res); -+ if (IS_ERR(base)) -+ return PTR_ERR(base); -+ -+ rmap = devm_regmap_init_mmio(dev, base, &ipq4019_vmmcq_regmap_config); -+ if (IS_ERR(rmap)) -+ return PTR_ERR(rmap); -+ -+ cfg.dev = dev; -+ cfg.init_data = init_data; -+ cfg.of_node = dev->of_node; -+ cfg.regmap = rmap; -+ -+ rdev = devm_regulator_register(dev, &vmmc_regulator, &cfg); -+ if (IS_ERR(rdev)) { -+ dev_err(dev, "Failed to register regulator: %ld\n", -+ PTR_ERR(rdev)); -+ return PTR_ERR(rdev); -+ } -+ platform_set_drvdata(pdev, rdev); -+ -+ return 0; -+} -+ -+static const struct of_device_id regulator_ipq4019_of_match[] = { -+ { .compatible = "qcom,vqmmc-ipq4019-regulator", }, -+ {}, -+}; -+ -+static struct platform_driver ipq4019_regulator_driver = { -+ .probe = ipq4019_regulator_probe, -+ .driver = { -+ .name = "vqmmc-ipq4019-regulator", -+ .of_match_table = of_match_ptr(regulator_ipq4019_of_match), -+ }, -+}; -+module_platform_driver(ipq4019_regulator_driver); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Mantas Pucka "); -+MODULE_DESCRIPTION("IPQ4019 VQMMC voltage regulator"); diff --git a/target/linux/ipq40xx/patches-5.4/0002-02-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch b/target/linux/ipq40xx/patches-5.4/0002-02-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch deleted file mode 100644 index 25fce8daf0..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0002-02-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 04b3b72b5b8fdb883bfdc619cb29b03641b1cc6a Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 15 Aug 2019 19:28:23 +0200 -Subject: [PATCH] ARM: dts: qcom: ipq4019: Add SDHCI controller node - -IPQ4019 has a built in SD/eMMC controller which is supported by the -SDHCI MSM driver, by the "qcom,sdhci-msm-v4" binding. -So lets add the appropriate node for it. - -Signed-off-by: Robert Marko -Signed-off-by: Bjorn Andersson ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -206,6 +206,18 @@ - interrupts = ; - }; - -+ sdhci: sdhci@7824900 { -+ compatible = "qcom,sdhci-msm-v4"; -+ reg = <0x7824900 0x11c>, <0x7824000 0x800>; -+ interrupts = , ; -+ interrupt-names = "hc_irq", "pwr_irq"; -+ bus-width = <8>; -+ clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>, -+ <&gcc GCC_DCD_XO_CLK>; -+ clock-names = "core", "iface", "xo"; -+ status = "disabled"; -+ }; -+ - blsp_dma: dma@7884000 { - compatible = "qcom,bam-v1.7.0"; - reg = <0x07884000 0x23000>; diff --git a/target/linux/ipq40xx/patches-5.4/0003-v5.6-ARM-dts-qcom-Add-nodes-for-SMP-boot-in-IPQ40xx.patch b/target/linux/ipq40xx/patches-5.4/0003-v5.6-ARM-dts-qcom-Add-nodes-for-SMP-boot-in-IPQ40xx.patch deleted file mode 100644 index 3a4127febf..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0003-v5.6-ARM-dts-qcom-Add-nodes-for-SMP-boot-in-IPQ40xx.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 5e4548922009870a38bcf1d887317676d4e08f54 Mon Sep 17 00:00:00 2001 -From: Damir Franusic -Date: Thu, 21 Nov 2019 16:29:02 +0100 -Subject: [PATCH] ARM: dts: qcom: Add nodes for SMP boot in IPQ40xx - -Add missing nodes and properties to enable SMP -support on IPQ40xx devices. - -Booting without "saw_l2" node: - -[ 0.001400] CPU: Testing write buffer coherency: ok -[ 0.001856] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 -[ 0.060163] Setting up static identity map for 0x80300000 - 0x80300060 -[ 0.080140] rcu: Hierarchical SRCU implementation. -[ 0.120258] smp: Bringing up secondary CPUs ... -[ 0.200540] CPU1: failed to boot: -19 -[ 0.280689] CPU2: failed to boot: -19 -[ 0.360874] CPU3: failed to boot: -19 -[ 0.360966] smp: Brought up 1 node, 1 CPU -[ 0.360979] SMP: Total of 1 processors activated (96.00 BogoMIPS). -[ 0.360988] CPU: All CPU(s) started in SVC mode. - -Then, booting with "saw_l2" node present (this patch applied): - -[ 0.001450] CPU: Testing write buffer coherency: ok -[ 0.001904] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 -[ 0.060161] Setting up static identity map for 0x80300000 - 0x80300060 -[ 0.080137] rcu: Hierarchical SRCU implementation. -[ 0.120252] smp: Bringing up secondary CPUs ... -[ 0.200958] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 -[ 0.281091] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002 -[ 0.361264] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003 -[ 0.361430] smp: Brought up 1 node, 4 CPUs -[ 0.361460] SMP: Total of 4 processors activated (384.00 BogoMIPS). -[ 0.361469] CPU: All CPU(s) started in SVC mode. - -Signed-off-by: Damir Franusic -Cc: Luka Perkov -Cc: Robert Marko -Cc: Andy Gross -Cc: Rob Herring -Cc: linux-arm-msm@vger.kernel.org -Link: https://lore.kernel.org/r/20191121152902.21394-1-damir.franusic@gmail.com -Signed-off-by: Bjorn Andersson ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -102,6 +102,7 @@ - L2: l2-cache { - compatible = "cache"; - cache-level = <2>; -+ qcom,saw = <&saw_l2>; - }; - }; - -@@ -353,6 +354,12 @@ - regulator; - }; - -+ saw_l2: regulator@b012000 { -+ compatible = "qcom,saw2"; -+ reg = <0xb012000 0x1000>; -+ regulator; -+ }; -+ - blsp1_uart1: serial@78af000 { - compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; - reg = <0x78af000 0x200>; diff --git a/target/linux/ipq40xx/patches-5.4/0003-v5.7-ARM-dts-qcom-add-gpio-ranges-property.patch b/target/linux/ipq40xx/patches-5.4/0003-v5.7-ARM-dts-qcom-add-gpio-ranges-property.patch deleted file mode 100644 index 6922bc8ff3..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0003-v5.7-ARM-dts-qcom-add-gpio-ranges-property.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 8b99dc0922618062a1589ebd74df6108b4f9ac22 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Wed, 8 Jan 2020 13:54:55 +0100 -Subject: [PATCH] ARM: dts: qcom: add gpio-ranges property - -This patch adds the gpio-ranges property to almost all of -the Qualcomm ARM platforms that utilize the pinctrl-msm -framework. - -The gpio-ranges property is part of the gpiolib subsystem. -As a result, the binding text is available in section -"2.1 gpio- and pin-controller interaction" of -Documentation/devicetree/bindings/gpio/gpio.txt - -For more information please see the patch titled: -"pinctrl: msm: fix gpio-hog related boot issues" from -this series. - -Reported-by: Sven Eckelmann -Tested-by: Sven Eckelmann [ipq4019] -Reviewed-by: Bjorn Andersson -Reviewed-by: Linus Walleij -Signed-off-by: Christian Lamparter -Tested-by: Robert Marko [ipq4019] -Cc: Luka Perkov -Signed-off-by: Robert Marko -Link: https://lore.kernel.org/r/20200108125455.308969-1-robert.marko@sartura.hr -Signed-off-by: Bjorn Andersson ---- - arch/arm/boot/dts/qcom-apq8064.dtsi | 1 + - arch/arm/boot/dts/qcom-apq8084.dtsi | 1 + - arch/arm/boot/dts/qcom-ipq4019.dtsi | 1 + - arch/arm/boot/dts/qcom-ipq8064.dtsi | 1 + - arch/arm/boot/dts/qcom-mdm9615.dtsi | 1 + - arch/arm/boot/dts/qcom-msm8660.dtsi | 1 + - arch/arm/boot/dts/qcom-msm8960.dtsi | 1 + - arch/arm/boot/dts/qcom-msm8974.dtsi | 1 + - 8 files changed, 8 insertions(+) - ---- a/arch/arm/boot/dts/qcom-apq8064.dtsi -+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi -@@ -350,6 +350,7 @@ - reg = <0x800000 0x4000>; - - gpio-controller; -+ gpio-ranges = <&tlmm_pinmux 0 0 90>; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; ---- a/arch/arm/boot/dts/qcom-apq8084.dtsi -+++ b/arch/arm/boot/dts/qcom-apq8084.dtsi -@@ -401,6 +401,7 @@ - compatible = "qcom,apq8084-pinctrl"; - reg = <0xfd510000 0x4000>; - gpio-controller; -+ gpio-ranges = <&tlmm 0 0 147>; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -201,6 +201,7 @@ - compatible = "qcom,ipq4019-pinctrl"; - reg = <0x01000000 0x300000>; - gpio-controller; -+ gpio-ranges = <&tlmm 0 0 100>; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; ---- a/arch/arm/boot/dts/qcom-ipq8064.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi -@@ -119,6 +119,7 @@ - reg = <0x800000 0x4000>; - - gpio-controller; -+ gpio-ranges = <&qcom_pinmux 0 0 69>; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; ---- a/arch/arm/boot/dts/qcom-mdm9615.dtsi -+++ b/arch/arm/boot/dts/qcom-mdm9615.dtsi -@@ -128,6 +128,7 @@ - msmgpio: pinctrl@800000 { - compatible = "qcom,mdm9615-pinctrl"; - gpio-controller; -+ gpio-ranges = <&msmgpio 0 0 88>; - #gpio-cells = <2>; - interrupts = ; - interrupt-controller; ---- a/arch/arm/boot/dts/qcom-msm8660.dtsi -+++ b/arch/arm/boot/dts/qcom-msm8660.dtsi -@@ -115,6 +115,7 @@ - reg = <0x800000 0x4000>; - - gpio-controller; -+ gpio-ranges = <&tlmm 0 0 173>; - #gpio-cells = <2>; - interrupts = <0 16 0x4>; - interrupt-controller; ---- a/arch/arm/boot/dts/qcom-msm8960.dtsi -+++ b/arch/arm/boot/dts/qcom-msm8960.dtsi -@@ -107,6 +107,7 @@ - msmgpio: pinctrl@800000 { - compatible = "qcom,msm8960-pinctrl"; - gpio-controller; -+ gpio-ranges = <&msmgpio 0 0 152>; - #gpio-cells = <2>; - interrupts = <0 16 0x4>; - interrupt-controller; ---- a/arch/arm/boot/dts/qcom-msm8974.dtsi -+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi -@@ -707,6 +707,7 @@ - compatible = "qcom,msm8974-pinctrl"; - reg = <0xfd510000 0x4000>; - gpio-controller; -+ gpio-ranges = <&msmgpio 0 0 146>; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; diff --git a/target/linux/ipq40xx/patches-5.4/0004-v5.8-ARM-dts-qcom-ipq4019-fix-high-resolution-timer.patch b/target/linux/ipq40xx/patches-5.4/0004-v5.8-ARM-dts-qcom-ipq4019-fix-high-resolution-timer.patch deleted file mode 100644 index f82021f4cd..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0004-v5.8-ARM-dts-qcom-ipq4019-fix-high-resolution-timer.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 8acc36189dcaf4487d8c6ba7445948f39b1d248a Mon Sep 17 00:00:00 2001 -From: Abhishek Sahu -Date: Fri, 3 Apr 2020 13:40:40 +0200 -Subject: [PATCH] ARM: dts: qcom: ipq4019: fix high resolution timer - -Cherry-picked from CAF QSDK repo. -Original commit message: -The kernel is failing in switching the timer for high resolution -mode and clock source operates in 10ms resolution. The always-on -property needs to be given for timer device tree node to make -clock source working in 1ns resolution. - -Signed-off-by: Abhishek Sahu -Signed-off-by: Pavel Kubelun -Signed-off-by: Christian Lamparter -Tested-by: Robert Marko -Cc: Luka Perkov -Link: https://lore.kernel.org/r/20200403114040.349787-1-robert.marko@sartura.hr -Signed-off-by: Bjorn Andersson ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -166,6 +166,7 @@ - <1 4 0xf08>, - <1 1 0xf08>; - clock-frequency = <48000000>; -+ always-on; - }; - - soc { diff --git a/target/linux/ipq40xx/patches-5.4/0005-01-v5.8-net-phy-mdio-add-IPQ4019-MDIO-driver.patch b/target/linux/ipq40xx/patches-5.4/0005-01-v5.8-net-phy-mdio-add-IPQ4019-MDIO-driver.patch deleted file mode 100644 index b48e922fb0..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0005-01-v5.8-net-phy-mdio-add-IPQ4019-MDIO-driver.patch +++ /dev/null @@ -1,210 +0,0 @@ -From 466ed24fb22342f3ae1c10758a6a0c6a8c081b2d Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 30 Apr 2020 11:07:05 +0200 -Subject: [PATCH] net: phy: mdio: add IPQ4019 MDIO driver - -This patch adds the driver for the MDIO interface -inside of Qualcomm IPQ40xx series SoC-s. - -Signed-off-by: Christian Lamparter -Signed-off-by: Robert Marko -Reviewed-by: Andrew Lunn -Reviewed-by: Florian Fainelli -Cc: Luka Perkov -Signed-off-by: David S. Miller ---- - drivers/net/phy/Kconfig | 7 ++ - drivers/net/phy/Makefile | 1 + - drivers/net/phy/mdio-ipq4019.c | 160 +++++++++++++++++++++++++++++++++ - 3 files changed, 168 insertions(+) - create mode 100644 drivers/net/phy/mdio-ipq4019.c - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -156,6 +156,13 @@ config MDIO_I2C - - This is library mode. - -+config MDIO_IPQ4019 -+ tristate "Qualcomm IPQ4019 MDIO interface support" -+ depends on HAS_IOMEM && OF_MDIO -+ help -+ This driver supports the MDIO interface found in Qualcomm -+ IPQ40xx series Soc-s. -+ - config MDIO_MOXART - tristate "MOXA ART MDIO interface support" - depends on ARCH_MOXART || COMPILE_TEST ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -49,6 +49,7 @@ obj-$(CONFIG_MDIO_CAVIUM) += mdio-cavium - obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o - obj-$(CONFIG_MDIO_HISI_FEMAC) += mdio-hisi-femac.o - obj-$(CONFIG_MDIO_I2C) += mdio-i2c.o -+obj-$(CONFIG_MDIO_IPQ4019) += mdio-ipq4019.o - obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o - obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-mscc-miim.o - obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o ---- /dev/null -+++ b/drivers/net/phy/mdio-ipq4019.c -@@ -0,0 +1,160 @@ -+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause -+/* Copyright (c) 2015, The Linux Foundation. All rights reserved. */ -+/* Copyright (c) 2020 Sartura Ltd. */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define MDIO_ADDR_REG 0x44 -+#define MDIO_DATA_WRITE_REG 0x48 -+#define MDIO_DATA_READ_REG 0x4c -+#define MDIO_CMD_REG 0x50 -+#define MDIO_CMD_ACCESS_BUSY BIT(16) -+#define MDIO_CMD_ACCESS_START BIT(8) -+#define MDIO_CMD_ACCESS_CODE_READ 0 -+#define MDIO_CMD_ACCESS_CODE_WRITE 1 -+ -+#define ipq4019_MDIO_TIMEOUT 10000 -+#define ipq4019_MDIO_SLEEP 10 -+ -+struct ipq4019_mdio_data { -+ void __iomem *membase; -+}; -+ -+static int ipq4019_mdio_wait_busy(struct mii_bus *bus) -+{ -+ struct ipq4019_mdio_data *priv = bus->priv; -+ unsigned int busy; -+ -+ return readl_poll_timeout(priv->membase + MDIO_CMD_REG, busy, -+ (busy & MDIO_CMD_ACCESS_BUSY) == 0, -+ ipq4019_MDIO_SLEEP, ipq4019_MDIO_TIMEOUT); -+} -+ -+static int ipq4019_mdio_read(struct mii_bus *bus, int mii_id, int regnum) -+{ -+ struct ipq4019_mdio_data *priv = bus->priv; -+ unsigned int cmd; -+ -+ /* Reject clause 45 */ -+ if (regnum & MII_ADDR_C45) -+ return -EOPNOTSUPP; -+ -+ if (ipq4019_mdio_wait_busy(bus)) -+ return -ETIMEDOUT; -+ -+ /* issue the phy address and reg */ -+ writel((mii_id << 8) | regnum, priv->membase + MDIO_ADDR_REG); -+ -+ cmd = MDIO_CMD_ACCESS_START | MDIO_CMD_ACCESS_CODE_READ; -+ -+ /* issue read command */ -+ writel(cmd, priv->membase + MDIO_CMD_REG); -+ -+ /* Wait read complete */ -+ if (ipq4019_mdio_wait_busy(bus)) -+ return -ETIMEDOUT; -+ -+ /* Read and return data */ -+ return readl(priv->membase + MDIO_DATA_READ_REG); -+} -+ -+static int ipq4019_mdio_write(struct mii_bus *bus, int mii_id, int regnum, -+ u16 value) -+{ -+ struct ipq4019_mdio_data *priv = bus->priv; -+ unsigned int cmd; -+ -+ /* Reject clause 45 */ -+ if (regnum & MII_ADDR_C45) -+ return -EOPNOTSUPP; -+ -+ if (ipq4019_mdio_wait_busy(bus)) -+ return -ETIMEDOUT; -+ -+ /* issue the phy address and reg */ -+ writel((mii_id << 8) | regnum, priv->membase + MDIO_ADDR_REG); -+ -+ /* issue write data */ -+ writel(value, priv->membase + MDIO_DATA_WRITE_REG); -+ -+ cmd = MDIO_CMD_ACCESS_START | MDIO_CMD_ACCESS_CODE_WRITE; -+ /* issue write command */ -+ writel(cmd, priv->membase + MDIO_CMD_REG); -+ -+ /* Wait write complete */ -+ if (ipq4019_mdio_wait_busy(bus)) -+ return -ETIMEDOUT; -+ -+ return 0; -+} -+ -+static int ipq4019_mdio_probe(struct platform_device *pdev) -+{ -+ struct ipq4019_mdio_data *priv; -+ struct mii_bus *bus; -+ int ret; -+ -+ bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv)); -+ if (!bus) -+ return -ENOMEM; -+ -+ priv = bus->priv; -+ -+ priv->membase = devm_platform_ioremap_resource(pdev, 0); -+ if (IS_ERR(priv->membase)) -+ return PTR_ERR(priv->membase); -+ -+ bus->name = "ipq4019_mdio"; -+ bus->read = ipq4019_mdio_read; -+ bus->write = ipq4019_mdio_write; -+ bus->parent = &pdev->dev; -+ snprintf(bus->id, MII_BUS_ID_SIZE, "%s%d", pdev->name, pdev->id); -+ -+ ret = of_mdiobus_register(bus, pdev->dev.of_node); -+ if (ret) { -+ dev_err(&pdev->dev, "Cannot register MDIO bus!\n"); -+ return ret; -+ } -+ -+ platform_set_drvdata(pdev, bus); -+ -+ return 0; -+} -+ -+static int ipq4019_mdio_remove(struct platform_device *pdev) -+{ -+ struct mii_bus *bus = platform_get_drvdata(pdev); -+ -+ mdiobus_unregister(bus); -+ -+ return 0; -+} -+ -+static const struct of_device_id ipq4019_mdio_dt_ids[] = { -+ { .compatible = "qcom,ipq4019-mdio" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, ipq4019_mdio_dt_ids); -+ -+static struct platform_driver ipq4019_mdio_driver = { -+ .probe = ipq4019_mdio_probe, -+ .remove = ipq4019_mdio_remove, -+ .driver = { -+ .name = "ipq4019-mdio", -+ .of_match_table = ipq4019_mdio_dt_ids, -+ }, -+}; -+ -+module_platform_driver(ipq4019_mdio_driver); -+ -+MODULE_DESCRIPTION("ipq4019 MDIO interface driver"); -+MODULE_AUTHOR("Qualcomm Atheros"); -+MODULE_LICENSE("Dual BSD/GPL"); diff --git a/target/linux/ipq40xx/patches-5.4/0005-02-v5.8-02-ARM-dts-qcom-ipq4019-add-MDIO-node.patch b/target/linux/ipq40xx/patches-5.4/0005-02-v5.8-02-ARM-dts-qcom-ipq4019-add-MDIO-node.patch deleted file mode 100644 index 1976686e8f..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0005-02-v5.8-02-ARM-dts-qcom-ipq4019-add-MDIO-node.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 9c8c0f70ec6fdac2398632c723c48277be09b7c0 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 30 Apr 2020 11:07:07 +0200 -Subject: [PATCH] ARM: dts: qcom: ipq4019: add MDIO node - -This patch adds the necessary MDIO interface node -to the Qualcomm IPQ4019 DTSI. - -Built-in QCA8337N switch is managed using it, -and since we have a driver for it lets add it. - -Signed-off-by: Christian Lamparter -Signed-off-by: Robert Marko -Reviewed-by: Andrew Lunn -Reviewed-by: Florian Fainelli -Cc: Luka Perkov -Signed-off-by: David S. Miller ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -577,5 +577,33 @@ - "legacy"; - status = "disabled"; - }; -+ -+ mdio: mdio@90000 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "qcom,ipq4019-mdio"; -+ reg = <0x90000 0x64>; -+ status = "disabled"; -+ -+ ethphy0: ethernet-phy@0 { -+ reg = <0>; -+ }; -+ -+ ethphy1: ethernet-phy@1 { -+ reg = <1>; -+ }; -+ -+ ethphy2: ethernet-phy@2 { -+ reg = <2>; -+ }; -+ -+ ethphy3: ethernet-phy@3 { -+ reg = <3>; -+ }; -+ -+ ethphy4: ethernet-phy@4 { -+ reg = <4>; -+ }; -+ }; - }; - }; diff --git a/target/linux/ipq40xx/patches-5.4/0006-v5.5-crypto-qce-add-CRYPTO_ALG_KERN_DRIVER_ONLY-flag.patch b/target/linux/ipq40xx/patches-5.4/0006-v5.5-crypto-qce-add-CRYPTO_ALG_KERN_DRIVER_ONLY-flag.patch deleted file mode 100644 index 415d6fff99..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0006-v5.5-crypto-qce-add-CRYPTO_ALG_KERN_DRIVER_ONLY-flag.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Eneas U de Queiroz -Subject: [PATCH] crypto: qce - add CRYPTO_ALG_KERN_DRIVER_ONLY flag - -Set the CRYPTO_ALG_KERN_DRIVER_ONLY flag to all algorithms exposed by -the qce driver, since they are all hardware accelerated, accessible -through a kernel driver only, and not available directly to userspace. - -Signed-off-by: Eneas U de Queiroz - ---- a/drivers/crypto/qce/ablkcipher.c -+++ b/drivers/crypto/qce/ablkcipher.c -@@ -380,7 +380,7 @@ static int qce_ablkcipher_register_one(c - - alg->cra_priority = 300; - alg->cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC | -- CRYPTO_ALG_NEED_FALLBACK; -+ CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY; - alg->cra_ctxsize = sizeof(struct qce_cipher_ctx); - alg->cra_alignmask = 0; - alg->cra_type = &crypto_ablkcipher_type; ---- a/drivers/crypto/qce/sha.c -+++ b/drivers/crypto/qce/sha.c -@@ -495,7 +495,7 @@ static int qce_ahash_register_one(const - base = &alg->halg.base; - base->cra_blocksize = def->blocksize; - base->cra_priority = 300; -- base->cra_flags = CRYPTO_ALG_ASYNC; -+ base->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY; - base->cra_ctxsize = sizeof(struct qce_sha_ctx); - base->cra_alignmask = 0; - base->cra_module = THIS_MODULE; diff --git a/target/linux/ipq40xx/patches-5.4/0007-v5.5-crypto-qce-switch-to-skcipher-API.patch b/target/linux/ipq40xx/patches-5.4/0007-v5.5-crypto-qce-switch-to-skcipher-API.patch deleted file mode 100644 index 4dcb942150..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0007-v5.5-crypto-qce-switch-to-skcipher-API.patch +++ /dev/null @@ -1,993 +0,0 @@ -From f441873642eebf20566c18d2966a8cd4b433ec1c Mon Sep 17 00:00:00 2001 -From: Ard Biesheuvel -Date: Tue, 5 Nov 2019 14:28:17 +0100 -Subject: [PATCH] crypto: qce - switch to skcipher API - -Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-level skcipher interface") -dated 20 august 2015 introduced the new skcipher API which is supposed to -replace both blkcipher and ablkcipher. While all consumers of the API have -been converted long ago, some producers of the ablkcipher remain, forcing -us to keep the ablkcipher support routines alive, along with the matching -code to expose [a]blkciphers via the skcipher API. - -So switch this driver to the skcipher API, allowing us to finally drop the -blkcipher code in the near future. - -Reviewed-by: Stanimir Varbanov -Signed-off-by: Ard Biesheuvel -Backported-to-4.19-by: Eneas U de Queiroz - ---- a/drivers/crypto/qce/Makefile -+++ b/drivers/crypto/qce/Makefile -@@ -4,4 +4,4 @@ qcrypto-objs := core.o \ - common.o \ - dma.o \ - sha.o \ -- ablkcipher.o -+ skcipher.o ---- a/drivers/crypto/qce/cipher.h -+++ b/drivers/crypto/qce/cipher.h -@@ -45,12 +45,12 @@ struct qce_cipher_reqctx { - unsigned int cryptlen; - }; - --static inline struct qce_alg_template *to_cipher_tmpl(struct crypto_tfm *tfm) -+static inline struct qce_alg_template *to_cipher_tmpl(struct crypto_skcipher *tfm) - { -- struct crypto_alg *alg = tfm->__crt_alg; -- return container_of(alg, struct qce_alg_template, alg.crypto); -+ struct skcipher_alg *alg = crypto_skcipher_alg(tfm); -+ return container_of(alg, struct qce_alg_template, alg.skcipher); - } - --extern const struct qce_algo_ops ablkcipher_ops; -+extern const struct qce_algo_ops skcipher_ops; - - #endif /* _CIPHER_H_ */ ---- a/drivers/crypto/qce/common.c -+++ b/drivers/crypto/qce/common.c -@@ -304,13 +304,13 @@ go_proc: - return 0; - } - --static int qce_setup_regs_ablkcipher(struct crypto_async_request *async_req, -+static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, - u32 totallen, u32 offset) - { -- struct ablkcipher_request *req = ablkcipher_request_cast(async_req); -- struct qce_cipher_reqctx *rctx = ablkcipher_request_ctx(req); -+ struct skcipher_request *req = skcipher_request_cast(async_req); -+ struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); - struct qce_cipher_ctx *ctx = crypto_tfm_ctx(async_req->tfm); -- struct qce_alg_template *tmpl = to_cipher_tmpl(async_req->tfm); -+ struct qce_alg_template *tmpl = to_cipher_tmpl(crypto_skcipher_reqtfm(req)); - struct qce_device *qce = tmpl->qce; - __be32 enckey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(__be32)] = {0}; - __be32 enciv[QCE_MAX_IV_SIZE / sizeof(__be32)] = {0}; -@@ -389,8 +389,8 @@ int qce_start(struct crypto_async_reques - u32 offset) - { - switch (type) { -- case CRYPTO_ALG_TYPE_ABLKCIPHER: -- return qce_setup_regs_ablkcipher(async_req, totallen, offset); -+ case CRYPTO_ALG_TYPE_SKCIPHER: -+ return qce_setup_regs_skcipher(async_req, totallen, offset); - case CRYPTO_ALG_TYPE_AHASH: - return qce_setup_regs_ahash(async_req, totallen, offset); - default: ---- a/drivers/crypto/qce/common.h -+++ b/drivers/crypto/qce/common.h -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - /* key size in bytes */ - #define QCE_SHA_HMAC_KEY_SIZE 64 -@@ -79,7 +80,7 @@ struct qce_alg_template { - unsigned long alg_flags; - const u32 *std_iv; - union { -- struct crypto_alg crypto; -+ struct skcipher_alg skcipher; - struct ahash_alg ahash; - } alg; - struct qce_device *qce; ---- a/drivers/crypto/qce/core.c -+++ b/drivers/crypto/qce/core.c -@@ -22,7 +22,7 @@ - #define QCE_QUEUE_LENGTH 1 - - static const struct qce_algo_ops *qce_ops[] = { -- &ablkcipher_ops, -+ &skcipher_ops, - &ahash_ops, - }; - ---- a/drivers/crypto/qce/ablkcipher.c -+++ /dev/null -@@ -1,440 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0-only --/* -- * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. -- */ -- --#include --#include --#include --#include --#include --#include -- --#include "cipher.h" -- --static LIST_HEAD(ablkcipher_algs); -- --static void qce_ablkcipher_done(void *data) --{ -- struct crypto_async_request *async_req = data; -- struct ablkcipher_request *req = ablkcipher_request_cast(async_req); -- struct qce_cipher_reqctx *rctx = ablkcipher_request_ctx(req); -- struct qce_alg_template *tmpl = to_cipher_tmpl(async_req->tfm); -- struct qce_device *qce = tmpl->qce; -- enum dma_data_direction dir_src, dir_dst; -- u32 status; -- int error; -- bool diff_dst; -- -- diff_dst = (req->src != req->dst) ? true : false; -- dir_src = diff_dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; -- dir_dst = diff_dst ? DMA_FROM_DEVICE : DMA_BIDIRECTIONAL; -- -- error = qce_dma_terminate_all(&qce->dma); -- if (error) -- dev_dbg(qce->dev, "ablkcipher dma termination error (%d)\n", -- error); -- -- if (diff_dst) -- dma_unmap_sg(qce->dev, rctx->src_sg, rctx->src_nents, dir_src); -- dma_unmap_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); -- -- sg_free_table(&rctx->dst_tbl); -- -- error = qce_check_status(qce, &status); -- if (error < 0) -- dev_dbg(qce->dev, "ablkcipher operation error (%x)\n", status); -- -- qce->async_req_done(tmpl->qce, error); --} -- --static int --qce_ablkcipher_async_req_handle(struct crypto_async_request *async_req) --{ -- struct ablkcipher_request *req = ablkcipher_request_cast(async_req); -- struct qce_cipher_reqctx *rctx = ablkcipher_request_ctx(req); -- struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req); -- struct qce_alg_template *tmpl = to_cipher_tmpl(async_req->tfm); -- struct qce_device *qce = tmpl->qce; -- enum dma_data_direction dir_src, dir_dst; -- struct scatterlist *sg; -- bool diff_dst; -- gfp_t gfp; -- int ret; -- -- rctx->iv = req->info; -- rctx->ivsize = crypto_ablkcipher_ivsize(ablkcipher); -- rctx->cryptlen = req->nbytes; -- -- diff_dst = (req->src != req->dst) ? true : false; -- dir_src = diff_dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; -- dir_dst = diff_dst ? DMA_FROM_DEVICE : DMA_BIDIRECTIONAL; -- -- rctx->src_nents = sg_nents_for_len(req->src, req->nbytes); -- if (diff_dst) -- rctx->dst_nents = sg_nents_for_len(req->dst, req->nbytes); -- else -- rctx->dst_nents = rctx->src_nents; -- if (rctx->src_nents < 0) { -- dev_err(qce->dev, "Invalid numbers of src SG.\n"); -- return rctx->src_nents; -- } -- if (rctx->dst_nents < 0) { -- dev_err(qce->dev, "Invalid numbers of dst SG.\n"); -- return -rctx->dst_nents; -- } -- -- rctx->dst_nents += 1; -- -- gfp = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? -- GFP_KERNEL : GFP_ATOMIC; -- -- ret = sg_alloc_table(&rctx->dst_tbl, rctx->dst_nents, gfp); -- if (ret) -- return ret; -- -- sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); -- -- sg = qce_sgtable_add(&rctx->dst_tbl, req->dst); -- if (IS_ERR(sg)) { -- ret = PTR_ERR(sg); -- goto error_free; -- } -- -- sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg); -- if (IS_ERR(sg)) { -- ret = PTR_ERR(sg); -- goto error_free; -- } -- -- sg_mark_end(sg); -- rctx->dst_sg = rctx->dst_tbl.sgl; -- -- ret = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); -- if (ret < 0) -- goto error_free; -- -- if (diff_dst) { -- ret = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src); -- if (ret < 0) -- goto error_unmap_dst; -- rctx->src_sg = req->src; -- } else { -- rctx->src_sg = rctx->dst_sg; -- } -- -- ret = qce_dma_prep_sgs(&qce->dma, rctx->src_sg, rctx->src_nents, -- rctx->dst_sg, rctx->dst_nents, -- qce_ablkcipher_done, async_req); -- if (ret) -- goto error_unmap_src; -- -- qce_dma_issue_pending(&qce->dma); -- -- ret = qce_start(async_req, tmpl->crypto_alg_type, req->nbytes, 0); -- if (ret) -- goto error_terminate; -- -- return 0; -- --error_terminate: -- qce_dma_terminate_all(&qce->dma); --error_unmap_src: -- if (diff_dst) -- dma_unmap_sg(qce->dev, req->src, rctx->src_nents, dir_src); --error_unmap_dst: -- dma_unmap_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); --error_free: -- sg_free_table(&rctx->dst_tbl); -- return ret; --} -- --static int qce_ablkcipher_setkey(struct crypto_ablkcipher *ablk, const u8 *key, -- unsigned int keylen) --{ -- struct crypto_tfm *tfm = crypto_ablkcipher_tfm(ablk); -- struct qce_cipher_ctx *ctx = crypto_tfm_ctx(tfm); -- int ret; -- -- if (!key || !keylen) -- return -EINVAL; -- -- switch (keylen) { -- case AES_KEYSIZE_128: -- case AES_KEYSIZE_256: -- break; -- default: -- goto fallback; -- } -- -- ctx->enc_keylen = keylen; -- memcpy(ctx->enc_key, key, keylen); -- return 0; --fallback: -- ret = crypto_sync_skcipher_setkey(ctx->fallback, key, keylen); -- if (!ret) -- ctx->enc_keylen = keylen; -- return ret; --} -- --static int qce_des_setkey(struct crypto_ablkcipher *ablk, const u8 *key, -- unsigned int keylen) --{ -- struct qce_cipher_ctx *ctx = crypto_ablkcipher_ctx(ablk); -- int err; -- -- err = verify_ablkcipher_des_key(ablk, key); -- if (err) -- return err; -- -- ctx->enc_keylen = keylen; -- memcpy(ctx->enc_key, key, keylen); -- return 0; --} -- --static int qce_des3_setkey(struct crypto_ablkcipher *ablk, const u8 *key, -- unsigned int keylen) --{ -- struct qce_cipher_ctx *ctx = crypto_ablkcipher_ctx(ablk); -- int err; -- -- err = verify_ablkcipher_des3_key(ablk, key); -- if (err) -- return err; -- -- ctx->enc_keylen = keylen; -- memcpy(ctx->enc_key, key, keylen); -- return 0; --} -- --static int qce_ablkcipher_crypt(struct ablkcipher_request *req, int encrypt) --{ -- struct crypto_tfm *tfm = -- crypto_ablkcipher_tfm(crypto_ablkcipher_reqtfm(req)); -- struct qce_cipher_ctx *ctx = crypto_tfm_ctx(tfm); -- struct qce_cipher_reqctx *rctx = ablkcipher_request_ctx(req); -- struct qce_alg_template *tmpl = to_cipher_tmpl(tfm); -- int ret; -- -- rctx->flags = tmpl->alg_flags; -- rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; -- -- if (IS_AES(rctx->flags) && ctx->enc_keylen != AES_KEYSIZE_128 && -- ctx->enc_keylen != AES_KEYSIZE_256) { -- SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); -- -- skcipher_request_set_sync_tfm(subreq, ctx->fallback); -- skcipher_request_set_callback(subreq, req->base.flags, -- NULL, NULL); -- skcipher_request_set_crypt(subreq, req->src, req->dst, -- req->nbytes, req->info); -- ret = encrypt ? crypto_skcipher_encrypt(subreq) : -- crypto_skcipher_decrypt(subreq); -- skcipher_request_zero(subreq); -- return ret; -- } -- -- return tmpl->qce->async_req_enqueue(tmpl->qce, &req->base); --} -- --static int qce_ablkcipher_encrypt(struct ablkcipher_request *req) --{ -- return qce_ablkcipher_crypt(req, 1); --} -- --static int qce_ablkcipher_decrypt(struct ablkcipher_request *req) --{ -- return qce_ablkcipher_crypt(req, 0); --} -- --static int qce_ablkcipher_init(struct crypto_tfm *tfm) --{ -- struct qce_cipher_ctx *ctx = crypto_tfm_ctx(tfm); -- -- memset(ctx, 0, sizeof(*ctx)); -- tfm->crt_ablkcipher.reqsize = sizeof(struct qce_cipher_reqctx); -- -- ctx->fallback = crypto_alloc_sync_skcipher(crypto_tfm_alg_name(tfm), -- 0, CRYPTO_ALG_NEED_FALLBACK); -- return PTR_ERR_OR_ZERO(ctx->fallback); --} -- --static void qce_ablkcipher_exit(struct crypto_tfm *tfm) --{ -- struct qce_cipher_ctx *ctx = crypto_tfm_ctx(tfm); -- -- crypto_free_sync_skcipher(ctx->fallback); --} -- --struct qce_ablkcipher_def { -- unsigned long flags; -- const char *name; -- const char *drv_name; -- unsigned int blocksize; -- unsigned int ivsize; -- unsigned int min_keysize; -- unsigned int max_keysize; --}; -- --static const struct qce_ablkcipher_def ablkcipher_def[] = { -- { -- .flags = QCE_ALG_AES | QCE_MODE_ECB, -- .name = "ecb(aes)", -- .drv_name = "ecb-aes-qce", -- .blocksize = AES_BLOCK_SIZE, -- .ivsize = AES_BLOCK_SIZE, -- .min_keysize = AES_MIN_KEY_SIZE, -- .max_keysize = AES_MAX_KEY_SIZE, -- }, -- { -- .flags = QCE_ALG_AES | QCE_MODE_CBC, -- .name = "cbc(aes)", -- .drv_name = "cbc-aes-qce", -- .blocksize = AES_BLOCK_SIZE, -- .ivsize = AES_BLOCK_SIZE, -- .min_keysize = AES_MIN_KEY_SIZE, -- .max_keysize = AES_MAX_KEY_SIZE, -- }, -- { -- .flags = QCE_ALG_AES | QCE_MODE_CTR, -- .name = "ctr(aes)", -- .drv_name = "ctr-aes-qce", -- .blocksize = AES_BLOCK_SIZE, -- .ivsize = AES_BLOCK_SIZE, -- .min_keysize = AES_MIN_KEY_SIZE, -- .max_keysize = AES_MAX_KEY_SIZE, -- }, -- { -- .flags = QCE_ALG_AES | QCE_MODE_XTS, -- .name = "xts(aes)", -- .drv_name = "xts-aes-qce", -- .blocksize = AES_BLOCK_SIZE, -- .ivsize = AES_BLOCK_SIZE, -- .min_keysize = AES_MIN_KEY_SIZE, -- .max_keysize = AES_MAX_KEY_SIZE, -- }, -- { -- .flags = QCE_ALG_DES | QCE_MODE_ECB, -- .name = "ecb(des)", -- .drv_name = "ecb-des-qce", -- .blocksize = DES_BLOCK_SIZE, -- .ivsize = 0, -- .min_keysize = DES_KEY_SIZE, -- .max_keysize = DES_KEY_SIZE, -- }, -- { -- .flags = QCE_ALG_DES | QCE_MODE_CBC, -- .name = "cbc(des)", -- .drv_name = "cbc-des-qce", -- .blocksize = DES_BLOCK_SIZE, -- .ivsize = DES_BLOCK_SIZE, -- .min_keysize = DES_KEY_SIZE, -- .max_keysize = DES_KEY_SIZE, -- }, -- { -- .flags = QCE_ALG_3DES | QCE_MODE_ECB, -- .name = "ecb(des3_ede)", -- .drv_name = "ecb-3des-qce", -- .blocksize = DES3_EDE_BLOCK_SIZE, -- .ivsize = 0, -- .min_keysize = DES3_EDE_KEY_SIZE, -- .max_keysize = DES3_EDE_KEY_SIZE, -- }, -- { -- .flags = QCE_ALG_3DES | QCE_MODE_CBC, -- .name = "cbc(des3_ede)", -- .drv_name = "cbc-3des-qce", -- .blocksize = DES3_EDE_BLOCK_SIZE, -- .ivsize = DES3_EDE_BLOCK_SIZE, -- .min_keysize = DES3_EDE_KEY_SIZE, -- .max_keysize = DES3_EDE_KEY_SIZE, -- }, --}; -- --static int qce_ablkcipher_register_one(const struct qce_ablkcipher_def *def, -- struct qce_device *qce) --{ -- struct qce_alg_template *tmpl; -- struct crypto_alg *alg; -- int ret; -- -- tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL); -- if (!tmpl) -- return -ENOMEM; -- -- alg = &tmpl->alg.crypto; -- -- snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name); -- snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", -- def->drv_name); -- -- alg->cra_blocksize = def->blocksize; -- alg->cra_ablkcipher.ivsize = def->ivsize; -- alg->cra_ablkcipher.min_keysize = def->min_keysize; -- alg->cra_ablkcipher.max_keysize = def->max_keysize; -- alg->cra_ablkcipher.setkey = IS_3DES(def->flags) ? qce_des3_setkey : -- IS_DES(def->flags) ? qce_des_setkey : -- qce_ablkcipher_setkey; -- alg->cra_ablkcipher.encrypt = qce_ablkcipher_encrypt; -- alg->cra_ablkcipher.decrypt = qce_ablkcipher_decrypt; -- -- alg->cra_priority = 300; -- alg->cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC | -- CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY; -- alg->cra_ctxsize = sizeof(struct qce_cipher_ctx); -- alg->cra_alignmask = 0; -- alg->cra_type = &crypto_ablkcipher_type; -- alg->cra_module = THIS_MODULE; -- alg->cra_init = qce_ablkcipher_init; -- alg->cra_exit = qce_ablkcipher_exit; -- -- INIT_LIST_HEAD(&tmpl->entry); -- tmpl->crypto_alg_type = CRYPTO_ALG_TYPE_ABLKCIPHER; -- tmpl->alg_flags = def->flags; -- tmpl->qce = qce; -- -- ret = crypto_register_alg(alg); -- if (ret) { -- kfree(tmpl); -- dev_err(qce->dev, "%s registration failed\n", alg->cra_name); -- return ret; -- } -- -- list_add_tail(&tmpl->entry, &ablkcipher_algs); -- dev_dbg(qce->dev, "%s is registered\n", alg->cra_name); -- return 0; --} -- --static void qce_ablkcipher_unregister(struct qce_device *qce) --{ -- struct qce_alg_template *tmpl, *n; -- -- list_for_each_entry_safe(tmpl, n, &ablkcipher_algs, entry) { -- crypto_unregister_alg(&tmpl->alg.crypto); -- list_del(&tmpl->entry); -- kfree(tmpl); -- } --} -- --static int qce_ablkcipher_register(struct qce_device *qce) --{ -- int ret, i; -- -- for (i = 0; i < ARRAY_SIZE(ablkcipher_def); i++) { -- ret = qce_ablkcipher_register_one(&ablkcipher_def[i], qce); -- if (ret) -- goto err; -- } -- -- return 0; --err: -- qce_ablkcipher_unregister(qce); -- return ret; --} -- --const struct qce_algo_ops ablkcipher_ops = { -- .type = CRYPTO_ALG_TYPE_ABLKCIPHER, -- .register_algs = qce_ablkcipher_register, -- .unregister_algs = qce_ablkcipher_unregister, -- .async_req_handle = qce_ablkcipher_async_req_handle, --}; ---- /dev/null -+++ b/drivers/crypto/qce/skcipher.c -@@ -0,0 +1,440 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "cipher.h" -+ -+static LIST_HEAD(skcipher_algs); -+ -+static void qce_skcipher_done(void *data) -+{ -+ struct crypto_async_request *async_req = data; -+ struct skcipher_request *req = skcipher_request_cast(async_req); -+ struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); -+ struct qce_alg_template *tmpl = to_cipher_tmpl(crypto_skcipher_reqtfm(req)); -+ struct qce_device *qce = tmpl->qce; -+ enum dma_data_direction dir_src, dir_dst; -+ u32 status; -+ int error; -+ bool diff_dst; -+ -+ diff_dst = (req->src != req->dst) ? true : false; -+ dir_src = diff_dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; -+ dir_dst = diff_dst ? DMA_FROM_DEVICE : DMA_BIDIRECTIONAL; -+ -+ error = qce_dma_terminate_all(&qce->dma); -+ if (error) -+ dev_dbg(qce->dev, "skcipher dma termination error (%d)\n", -+ error); -+ -+ if (diff_dst) -+ dma_unmap_sg(qce->dev, rctx->src_sg, rctx->src_nents, dir_src); -+ dma_unmap_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); -+ -+ sg_free_table(&rctx->dst_tbl); -+ -+ error = qce_check_status(qce, &status); -+ if (error < 0) -+ dev_dbg(qce->dev, "skcipher operation error (%x)\n", status); -+ -+ qce->async_req_done(tmpl->qce, error); -+} -+ -+static int -+qce_skcipher_async_req_handle(struct crypto_async_request *async_req) -+{ -+ struct skcipher_request *req = skcipher_request_cast(async_req); -+ struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); -+ struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req); -+ struct qce_alg_template *tmpl = to_cipher_tmpl(crypto_skcipher_reqtfm(req)); -+ struct qce_device *qce = tmpl->qce; -+ enum dma_data_direction dir_src, dir_dst; -+ struct scatterlist *sg; -+ bool diff_dst; -+ gfp_t gfp; -+ int ret; -+ -+ rctx->iv = req->iv; -+ rctx->ivsize = crypto_skcipher_ivsize(skcipher); -+ rctx->cryptlen = req->cryptlen; -+ -+ diff_dst = (req->src != req->dst) ? true : false; -+ dir_src = diff_dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; -+ dir_dst = diff_dst ? DMA_FROM_DEVICE : DMA_BIDIRECTIONAL; -+ -+ rctx->src_nents = sg_nents_for_len(req->src, req->cryptlen); -+ if (diff_dst) -+ rctx->dst_nents = sg_nents_for_len(req->dst, req->cryptlen); -+ else -+ rctx->dst_nents = rctx->src_nents; -+ if (rctx->src_nents < 0) { -+ dev_err(qce->dev, "Invalid numbers of src SG.\n"); -+ return rctx->src_nents; -+ } -+ if (rctx->dst_nents < 0) { -+ dev_err(qce->dev, "Invalid numbers of dst SG.\n"); -+ return -rctx->dst_nents; -+ } -+ -+ rctx->dst_nents += 1; -+ -+ gfp = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? -+ GFP_KERNEL : GFP_ATOMIC; -+ -+ ret = sg_alloc_table(&rctx->dst_tbl, rctx->dst_nents, gfp); -+ if (ret) -+ return ret; -+ -+ sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); -+ -+ sg = qce_sgtable_add(&rctx->dst_tbl, req->dst); -+ if (IS_ERR(sg)) { -+ ret = PTR_ERR(sg); -+ goto error_free; -+ } -+ -+ sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg); -+ if (IS_ERR(sg)) { -+ ret = PTR_ERR(sg); -+ goto error_free; -+ } -+ -+ sg_mark_end(sg); -+ rctx->dst_sg = rctx->dst_tbl.sgl; -+ -+ ret = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); -+ if (ret < 0) -+ goto error_free; -+ -+ if (diff_dst) { -+ ret = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src); -+ if (ret < 0) -+ goto error_unmap_dst; -+ rctx->src_sg = req->src; -+ } else { -+ rctx->src_sg = rctx->dst_sg; -+ } -+ -+ ret = qce_dma_prep_sgs(&qce->dma, rctx->src_sg, rctx->src_nents, -+ rctx->dst_sg, rctx->dst_nents, -+ qce_skcipher_done, async_req); -+ if (ret) -+ goto error_unmap_src; -+ -+ qce_dma_issue_pending(&qce->dma); -+ -+ ret = qce_start(async_req, tmpl->crypto_alg_type, req->cryptlen, 0); -+ if (ret) -+ goto error_terminate; -+ -+ return 0; -+ -+error_terminate: -+ qce_dma_terminate_all(&qce->dma); -+error_unmap_src: -+ if (diff_dst) -+ dma_unmap_sg(qce->dev, req->src, rctx->src_nents, dir_src); -+error_unmap_dst: -+ dma_unmap_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); -+error_free: -+ sg_free_table(&rctx->dst_tbl); -+ return ret; -+} -+ -+static int qce_skcipher_setkey(struct crypto_skcipher *ablk, const u8 *key, -+ unsigned int keylen) -+{ -+ struct crypto_tfm *tfm = crypto_skcipher_tfm(ablk); -+ struct qce_cipher_ctx *ctx = crypto_tfm_ctx(tfm); -+ int ret; -+ -+ if (!key || !keylen) -+ return -EINVAL; -+ -+ switch (keylen) { -+ case AES_KEYSIZE_128: -+ case AES_KEYSIZE_256: -+ break; -+ default: -+ goto fallback; -+ } -+ -+ ctx->enc_keylen = keylen; -+ memcpy(ctx->enc_key, key, keylen); -+ return 0; -+fallback: -+ ret = crypto_sync_skcipher_setkey(ctx->fallback, key, keylen); -+ if (!ret) -+ ctx->enc_keylen = keylen; -+ return ret; -+} -+ -+static int qce_des_setkey(struct crypto_skcipher *ablk, const u8 *key, -+ unsigned int keylen) -+{ -+ struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(ablk); -+ int err; -+ -+ err = verify_skcipher_des_key(ablk, key); -+ if (err) -+ return err; -+ -+ ctx->enc_keylen = keylen; -+ memcpy(ctx->enc_key, key, keylen); -+ return 0; -+} -+ -+static int qce_des3_setkey(struct crypto_skcipher *ablk, const u8 *key, -+ unsigned int keylen) -+{ -+ struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(ablk); -+ int err; -+ -+ err = verify_skcipher_des3_key(ablk, key); -+ if (err) -+ return err; -+ -+ ctx->enc_keylen = keylen; -+ memcpy(ctx->enc_key, key, keylen); -+ return 0; -+} -+ -+static int qce_skcipher_crypt(struct skcipher_request *req, int encrypt) -+{ -+ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); -+ struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); -+ struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); -+ struct qce_alg_template *tmpl = to_cipher_tmpl(tfm); -+ int ret; -+ -+ rctx->flags = tmpl->alg_flags; -+ rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; -+ -+ if (IS_AES(rctx->flags) && ctx->enc_keylen != AES_KEYSIZE_128 && -+ ctx->enc_keylen != AES_KEYSIZE_256) { -+ SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); -+ -+ skcipher_request_set_sync_tfm(subreq, ctx->fallback); -+ skcipher_request_set_callback(subreq, req->base.flags, -+ NULL, NULL); -+ skcipher_request_set_crypt(subreq, req->src, req->dst, -+ req->cryptlen, req->iv); -+ ret = encrypt ? crypto_skcipher_encrypt(subreq) : -+ crypto_skcipher_decrypt(subreq); -+ skcipher_request_zero(subreq); -+ return ret; -+ } -+ -+ return tmpl->qce->async_req_enqueue(tmpl->qce, &req->base); -+} -+ -+static int qce_skcipher_encrypt(struct skcipher_request *req) -+{ -+ return qce_skcipher_crypt(req, 1); -+} -+ -+static int qce_skcipher_decrypt(struct skcipher_request *req) -+{ -+ return qce_skcipher_crypt(req, 0); -+} -+ -+static int qce_skcipher_init(struct crypto_skcipher *tfm) -+{ -+ struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); -+ -+ memset(ctx, 0, sizeof(*ctx)); -+ crypto_skcipher_set_reqsize(tfm, sizeof(struct qce_cipher_reqctx)); -+ -+ ctx->fallback = crypto_alloc_sync_skcipher(crypto_tfm_alg_name(&tfm->base), -+ 0, CRYPTO_ALG_NEED_FALLBACK); -+ return PTR_ERR_OR_ZERO(ctx->fallback); -+} -+ -+static void qce_skcipher_exit(struct crypto_skcipher *tfm) -+{ -+ struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); -+ -+ crypto_free_sync_skcipher(ctx->fallback); -+} -+ -+struct qce_skcipher_def { -+ unsigned long flags; -+ const char *name; -+ const char *drv_name; -+ unsigned int blocksize; -+ unsigned int ivsize; -+ unsigned int min_keysize; -+ unsigned int max_keysize; -+}; -+ -+static const struct qce_skcipher_def skcipher_def[] = { -+ { -+ .flags = QCE_ALG_AES | QCE_MODE_ECB, -+ .name = "ecb(aes)", -+ .drv_name = "ecb-aes-qce", -+ .blocksize = AES_BLOCK_SIZE, -+ .ivsize = AES_BLOCK_SIZE, -+ .min_keysize = AES_MIN_KEY_SIZE, -+ .max_keysize = AES_MAX_KEY_SIZE, -+ }, -+ { -+ .flags = QCE_ALG_AES | QCE_MODE_CBC, -+ .name = "cbc(aes)", -+ .drv_name = "cbc-aes-qce", -+ .blocksize = AES_BLOCK_SIZE, -+ .ivsize = AES_BLOCK_SIZE, -+ .min_keysize = AES_MIN_KEY_SIZE, -+ .max_keysize = AES_MAX_KEY_SIZE, -+ }, -+ { -+ .flags = QCE_ALG_AES | QCE_MODE_CTR, -+ .name = "ctr(aes)", -+ .drv_name = "ctr-aes-qce", -+ .blocksize = AES_BLOCK_SIZE, -+ .ivsize = AES_BLOCK_SIZE, -+ .min_keysize = AES_MIN_KEY_SIZE, -+ .max_keysize = AES_MAX_KEY_SIZE, -+ }, -+ { -+ .flags = QCE_ALG_AES | QCE_MODE_XTS, -+ .name = "xts(aes)", -+ .drv_name = "xts-aes-qce", -+ .blocksize = AES_BLOCK_SIZE, -+ .ivsize = AES_BLOCK_SIZE, -+ .min_keysize = AES_MIN_KEY_SIZE, -+ .max_keysize = AES_MAX_KEY_SIZE, -+ }, -+ { -+ .flags = QCE_ALG_DES | QCE_MODE_ECB, -+ .name = "ecb(des)", -+ .drv_name = "ecb-des-qce", -+ .blocksize = DES_BLOCK_SIZE, -+ .ivsize = 0, -+ .min_keysize = DES_KEY_SIZE, -+ .max_keysize = DES_KEY_SIZE, -+ }, -+ { -+ .flags = QCE_ALG_DES | QCE_MODE_CBC, -+ .name = "cbc(des)", -+ .drv_name = "cbc-des-qce", -+ .blocksize = DES_BLOCK_SIZE, -+ .ivsize = DES_BLOCK_SIZE, -+ .min_keysize = DES_KEY_SIZE, -+ .max_keysize = DES_KEY_SIZE, -+ }, -+ { -+ .flags = QCE_ALG_3DES | QCE_MODE_ECB, -+ .name = "ecb(des3_ede)", -+ .drv_name = "ecb-3des-qce", -+ .blocksize = DES3_EDE_BLOCK_SIZE, -+ .ivsize = 0, -+ .min_keysize = DES3_EDE_KEY_SIZE, -+ .max_keysize = DES3_EDE_KEY_SIZE, -+ }, -+ { -+ .flags = QCE_ALG_3DES | QCE_MODE_CBC, -+ .name = "cbc(des3_ede)", -+ .drv_name = "cbc-3des-qce", -+ .blocksize = DES3_EDE_BLOCK_SIZE, -+ .ivsize = DES3_EDE_BLOCK_SIZE, -+ .min_keysize = DES3_EDE_KEY_SIZE, -+ .max_keysize = DES3_EDE_KEY_SIZE, -+ }, -+}; -+ -+static int qce_skcipher_register_one(const struct qce_skcipher_def *def, -+ struct qce_device *qce) -+{ -+ struct qce_alg_template *tmpl; -+ struct skcipher_alg *alg; -+ int ret; -+ -+ tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL); -+ if (!tmpl) -+ return -ENOMEM; -+ -+ alg = &tmpl->alg.skcipher; -+ -+ snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name); -+ snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", -+ def->drv_name); -+ -+ alg->base.cra_blocksize = def->blocksize; -+ alg->ivsize = def->ivsize; -+ alg->min_keysize = def->min_keysize; -+ alg->max_keysize = def->max_keysize; -+ alg->setkey = IS_3DES(def->flags) ? qce_des3_setkey : -+ IS_DES(def->flags) ? qce_des_setkey : -+ qce_skcipher_setkey; -+ alg->encrypt = qce_skcipher_encrypt; -+ alg->decrypt = qce_skcipher_decrypt; -+ -+ alg->base.cra_priority = 300; -+ alg->base.cra_flags = CRYPTO_ALG_ASYNC | -+ CRYPTO_ALG_NEED_FALLBACK | -+ CRYPTO_ALG_KERN_DRIVER_ONLY; -+ alg->base.cra_ctxsize = sizeof(struct qce_cipher_ctx); -+ alg->base.cra_alignmask = 0; -+ alg->base.cra_module = THIS_MODULE; -+ -+ alg->init = qce_skcipher_init; -+ alg->exit = qce_skcipher_exit; -+ -+ INIT_LIST_HEAD(&tmpl->entry); -+ tmpl->crypto_alg_type = CRYPTO_ALG_TYPE_SKCIPHER; -+ tmpl->alg_flags = def->flags; -+ tmpl->qce = qce; -+ -+ ret = crypto_register_skcipher(alg); -+ if (ret) { -+ kfree(tmpl); -+ dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name); -+ return ret; -+ } -+ -+ list_add_tail(&tmpl->entry, &skcipher_algs); -+ dev_dbg(qce->dev, "%s is registered\n", alg->base.cra_name); -+ return 0; -+} -+ -+static void qce_skcipher_unregister(struct qce_device *qce) -+{ -+ struct qce_alg_template *tmpl, *n; -+ -+ list_for_each_entry_safe(tmpl, n, &skcipher_algs, entry) { -+ crypto_unregister_skcipher(&tmpl->alg.skcipher); -+ list_del(&tmpl->entry); -+ kfree(tmpl); -+ } -+} -+ -+static int qce_skcipher_register(struct qce_device *qce) -+{ -+ int ret, i; -+ -+ for (i = 0; i < ARRAY_SIZE(skcipher_def); i++) { -+ ret = qce_skcipher_register_one(&skcipher_def[i], qce); -+ if (ret) -+ goto err; -+ } -+ -+ return 0; -+err: -+ qce_skcipher_unregister(qce); -+ return ret; -+} -+ -+const struct qce_algo_ops skcipher_ops = { -+ .type = CRYPTO_ALG_TYPE_SKCIPHER, -+ .register_algs = qce_skcipher_register, -+ .unregister_algs = qce_skcipher_unregister, -+ .async_req_handle = qce_skcipher_async_req_handle, -+}; diff --git a/target/linux/ipq40xx/patches-5.4/0008-v5.6-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch b/target/linux/ipq40xx/patches-5.4/0008-v5.6-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch deleted file mode 100644 index ac4f163f4a..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0008-v5.6-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch +++ /dev/null @@ -1,43 +0,0 @@ -From bb5c863b3d3cbd10e80b2ebf409934a091058f54 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 20 Dec 2019 16:02:13 -0300 -Subject: [PATCH 02/11] crypto: qce - fix ctr-aes-qce block, chunk sizes - -Set blocksize of ctr-aes-qce to 1, so it can operate as a stream cipher, -adding the definition for chucksize instead, where the underlying block -size belongs. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - drivers/crypto/qce/skcipher.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -270,6 +270,7 @@ struct qce_skcipher_def { - const char *name; - const char *drv_name; - unsigned int blocksize; -+ unsigned int chunksize; - unsigned int ivsize; - unsigned int min_keysize; - unsigned int max_keysize; -@@ -298,7 +299,8 @@ static const struct qce_skcipher_def skc - .flags = QCE_ALG_AES | QCE_MODE_CTR, - .name = "ctr(aes)", - .drv_name = "ctr-aes-qce", -- .blocksize = AES_BLOCK_SIZE, -+ .blocksize = 1, -+ .chunksize = AES_BLOCK_SIZE, - .ivsize = AES_BLOCK_SIZE, - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, -@@ -368,6 +370,7 @@ static int qce_skcipher_register_one(con - def->drv_name); - - alg->base.cra_blocksize = def->blocksize; -+ alg->chunksize = def->chunksize; - alg->ivsize = def->ivsize; - alg->min_keysize = def->min_keysize; - alg->max_keysize = def->max_keysize; diff --git a/target/linux/ipq40xx/patches-5.4/0009-v5.6-crypto-qce-fix-xts-aes-qce-key-sizes.patch b/target/linux/ipq40xx/patches-5.4/0009-v5.6-crypto-qce-fix-xts-aes-qce-key-sizes.patch deleted file mode 100644 index 4dcf1ac726..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0009-v5.6-crypto-qce-fix-xts-aes-qce-key-sizes.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 7de4c2bd196f111e39cc60f6197654aff23ba2b4 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 20 Dec 2019 16:02:14 -0300 -Subject: [PATCH 03/11] crypto: qce - fix xts-aes-qce key sizes - -XTS-mode uses two keys, so the keysizes should be doubled in -skcipher_def, and halved when checking if it is AES-128/192/256. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - drivers/crypto/qce/skcipher.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -154,12 +154,13 @@ static int qce_skcipher_setkey(struct cr - { - struct crypto_tfm *tfm = crypto_skcipher_tfm(ablk); - struct qce_cipher_ctx *ctx = crypto_tfm_ctx(tfm); -+ unsigned long flags = to_cipher_tmpl(ablk)->alg_flags; - int ret; - - if (!key || !keylen) - return -EINVAL; - -- switch (keylen) { -+ switch (IS_XTS(flags) ? keylen >> 1 : keylen) { - case AES_KEYSIZE_128: - case AES_KEYSIZE_256: - break; -@@ -213,13 +214,15 @@ static int qce_skcipher_crypt(struct skc - struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); - struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); - struct qce_alg_template *tmpl = to_cipher_tmpl(tfm); -+ int keylen; - int ret; - - rctx->flags = tmpl->alg_flags; - rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; -+ keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen; - -- if (IS_AES(rctx->flags) && ctx->enc_keylen != AES_KEYSIZE_128 && -- ctx->enc_keylen != AES_KEYSIZE_256) { -+ if (IS_AES(rctx->flags) && keylen != AES_KEYSIZE_128 && -+ keylen != AES_KEYSIZE_256) { - SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); - - skcipher_request_set_sync_tfm(subreq, ctx->fallback); -@@ -311,8 +314,8 @@ static const struct qce_skcipher_def skc - .drv_name = "xts-aes-qce", - .blocksize = AES_BLOCK_SIZE, - .ivsize = AES_BLOCK_SIZE, -- .min_keysize = AES_MIN_KEY_SIZE, -- .max_keysize = AES_MAX_KEY_SIZE, -+ .min_keysize = AES_MIN_KEY_SIZE * 2, -+ .max_keysize = AES_MAX_KEY_SIZE * 2, - }, - { - .flags = QCE_ALG_DES | QCE_MODE_ECB, diff --git a/target/linux/ipq40xx/patches-5.4/0010-v5.6-crypto-qce-save-a-sg-table-slot-for-result-buf.patch b/target/linux/ipq40xx/patches-5.4/0010-v5.6-crypto-qce-save-a-sg-table-slot-for-result-buf.patch deleted file mode 100644 index 2385d483f2..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0010-v5.6-crypto-qce-save-a-sg-table-slot-for-result-buf.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 3ee50c896d712dc2fc8f34c2cd1918d035e74045 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 20 Dec 2019 16:02:15 -0300 -Subject: [PATCH 04/11] crypto: qce - save a sg table slot for result buf - -When ctr-aes-qce is used for gcm-mode, an extra sg entry for the -authentication tag is present, causing trouble when the qce driver -prepares the dst-results sg table for dma. - -It computes the number of entries needed with sg_nents_for_len, leaving -out the tag entry. Then it creates a sg table with that number plus -one, used to store a result buffer. - -When copying the sg table, there's no limit to the number of entries -copied, so the extra slot is filled with the authentication tag sg. -When the driver tries to add the result sg, the list is full, and it -returns EINVAL. - -By limiting the number of sg entries copied to the dest table, the slot -for the result buffer is guaranteed to be unused. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - drivers/crypto/qce/dma.c | 6 ++++-- - drivers/crypto/qce/dma.h | 3 ++- - drivers/crypto/qce/skcipher.c | 4 ++-- - 3 files changed, 8 insertions(+), 5 deletions(-) - ---- a/drivers/crypto/qce/dma.c -+++ b/drivers/crypto/qce/dma.c -@@ -47,7 +47,8 @@ void qce_dma_release(struct qce_dma_data - } - - struct scatterlist * --qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl) -+qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl, -+ int max_ents) - { - struct scatterlist *sg = sgt->sgl, *sg_last = NULL; - -@@ -60,12 +61,13 @@ qce_sgtable_add(struct sg_table *sgt, st - if (!sg) - return ERR_PTR(-EINVAL); - -- while (new_sgl && sg) { -+ while (new_sgl && sg && max_ents) { - sg_set_page(sg, sg_page(new_sgl), new_sgl->length, - new_sgl->offset); - sg_last = sg; - sg = sg_next(sg); - new_sgl = sg_next(new_sgl); -+ max_ents--; - } - - return sg_last; ---- a/drivers/crypto/qce/dma.h -+++ b/drivers/crypto/qce/dma.h -@@ -42,6 +42,7 @@ int qce_dma_prep_sgs(struct qce_dma_data - void qce_dma_issue_pending(struct qce_dma_data *dma); - int qce_dma_terminate_all(struct qce_dma_data *dma); - struct scatterlist * --qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add); -+qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add, -+ int max_ents); - - #endif /* _DMA_H_ */ ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -95,13 +95,13 @@ qce_skcipher_async_req_handle(struct cry - - sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); - -- sg = qce_sgtable_add(&rctx->dst_tbl, req->dst); -+ sg = qce_sgtable_add(&rctx->dst_tbl, req->dst, rctx->dst_nents - 1); - if (IS_ERR(sg)) { - ret = PTR_ERR(sg); - goto error_free; - } - -- sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg); -+ sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg, 1); - if (IS_ERR(sg)) { - ret = PTR_ERR(sg); - goto error_free; diff --git a/target/linux/ipq40xx/patches-5.4/0011-v5.6-crypto-qce-update-the-skcipher-IV.patch b/target/linux/ipq40xx/patches-5.4/0011-v5.6-crypto-qce-update-the-skcipher-IV.patch deleted file mode 100644 index 5efdb72c44..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0011-v5.6-crypto-qce-update-the-skcipher-IV.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 3e806a12d10af2581aa26c37b58439286eab9782 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 20 Dec 2019 16:02:16 -0300 -Subject: [PATCH 05/11] crypto: qce - update the skcipher IV - -Update the IV after the completion of each cipher operation. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - drivers/crypto/qce/skcipher.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -21,6 +21,7 @@ static void qce_skcipher_done(void *data - struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); - struct qce_alg_template *tmpl = to_cipher_tmpl(crypto_skcipher_reqtfm(req)); - struct qce_device *qce = tmpl->qce; -+ struct qce_result_dump *result_buf = qce->dma.result_buf; - enum dma_data_direction dir_src, dir_dst; - u32 status; - int error; -@@ -45,6 +46,7 @@ static void qce_skcipher_done(void *data - if (error < 0) - dev_dbg(qce->dev, "skcipher operation error (%x)\n", status); - -+ memcpy(rctx->iv, result_buf->encr_cntr_iv, rctx->ivsize); - qce->async_req_done(tmpl->qce, error); - } - diff --git a/target/linux/ipq40xx/patches-5.4/0012-v5.6-crypto-qce-initialize-fallback-only-for-AES.patch b/target/linux/ipq40xx/patches-5.4/0012-v5.6-crypto-qce-initialize-fallback-only-for-AES.patch deleted file mode 100644 index 84aef04ef4..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0012-v5.6-crypto-qce-initialize-fallback-only-for-AES.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 8ceda883205db6dfedb82e39f67feae3b50c95a1 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 20 Dec 2019 16:02:17 -0300 -Subject: [PATCH 06/11] crypto: qce - initialize fallback only for AES - -Adjust cra_flags to add CRYPTO_NEED_FALLBACK only for AES ciphers, where -AES-192 is not handled by the qce hardware, and don't allocate & free -the fallback skcipher for other algorithms. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - drivers/crypto/qce/skcipher.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -257,7 +257,14 @@ static int qce_skcipher_init(struct cryp - - memset(ctx, 0, sizeof(*ctx)); - crypto_skcipher_set_reqsize(tfm, sizeof(struct qce_cipher_reqctx)); -+ return 0; -+} -+ -+static int qce_skcipher_init_fallback(struct crypto_skcipher *tfm) -+{ -+ struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); - -+ qce_skcipher_init(tfm); - ctx->fallback = crypto_alloc_sync_skcipher(crypto_tfm_alg_name(&tfm->base), - 0, CRYPTO_ALG_NEED_FALLBACK); - return PTR_ERR_OR_ZERO(ctx->fallback); -@@ -387,14 +394,18 @@ static int qce_skcipher_register_one(con - - alg->base.cra_priority = 300; - alg->base.cra_flags = CRYPTO_ALG_ASYNC | -- CRYPTO_ALG_NEED_FALLBACK | - CRYPTO_ALG_KERN_DRIVER_ONLY; - alg->base.cra_ctxsize = sizeof(struct qce_cipher_ctx); - alg->base.cra_alignmask = 0; - alg->base.cra_module = THIS_MODULE; - -- alg->init = qce_skcipher_init; -- alg->exit = qce_skcipher_exit; -+ if (IS_AES(def->flags)) { -+ alg->base.cra_flags |= CRYPTO_ALG_NEED_FALLBACK; -+ alg->init = qce_skcipher_init_fallback; -+ alg->exit = qce_skcipher_exit; -+ } else { -+ alg->init = qce_skcipher_init; -+ } - - INIT_LIST_HEAD(&tmpl->entry); - tmpl->crypto_alg_type = CRYPTO_ALG_TYPE_SKCIPHER; diff --git a/target/linux/ipq40xx/patches-5.4/0013-v5.6-crypto-qce-allow-building-only-hashes-ciphers.patch b/target/linux/ipq40xx/patches-5.4/0013-v5.6-crypto-qce-allow-building-only-hashes-ciphers.patch deleted file mode 100644 index 5b1372d08f..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0013-v5.6-crypto-qce-allow-building-only-hashes-ciphers.patch +++ /dev/null @@ -1,419 +0,0 @@ -From 59e056cda4beb5412e3653e6360c2eb0fa770baa Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 20 Dec 2019 16:02:18 -0300 -Subject: [PATCH 07/11] crypto: qce - allow building only hashes/ciphers - -Allow the user to choose whether to build support for all algorithms -(default), hashes-only, or skciphers-only. - -The QCE engine does not appear to scale as well as the CPU to handle -multiple crypto requests. While the ipq40xx chips have 4-core CPUs, the -QCE handles only 2 requests in parallel. - -Ipsec throughput seems to improve when disabling either family of -algorithms, sharing the load with the CPU. Enabling skciphers-only -appears to work best. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - ---- a/drivers/crypto/Kconfig -+++ b/drivers/crypto/Kconfig -@@ -617,6 +617,14 @@ config CRYPTO_DEV_QCE - tristate "Qualcomm crypto engine accelerator" - depends on ARCH_QCOM || COMPILE_TEST - depends on HAS_IOMEM -+ help -+ This driver supports Qualcomm crypto engine accelerator -+ hardware. To compile this driver as a module, choose M here. The -+ module will be called qcrypto. -+ -+config CRYPTO_DEV_QCE_SKCIPHER -+ bool -+ depends on CRYPTO_DEV_QCE - select CRYPTO_AES - select CRYPTO_LIB_DES - select CRYPTO_ECB -@@ -624,10 +632,57 @@ config CRYPTO_DEV_QCE - select CRYPTO_XTS - select CRYPTO_CTR - select CRYPTO_BLKCIPHER -+ -+config CRYPTO_DEV_QCE_SHA -+ bool -+ depends on CRYPTO_DEV_QCE -+ -+choice -+ prompt "Algorithms enabled for QCE acceleration" -+ default CRYPTO_DEV_QCE_ENABLE_ALL -+ depends on CRYPTO_DEV_QCE - help -- This driver supports Qualcomm crypto engine accelerator -- hardware. To compile this driver as a module, choose M here. The -- module will be called qcrypto. -+ This option allows to choose whether to build support for all algorihtms -+ (default), hashes-only, or skciphers-only. -+ -+ The QCE engine does not appear to scale as well as the CPU to handle -+ multiple crypto requests. While the ipq40xx chips have 4-core CPUs, the -+ QCE handles only 2 requests in parallel. -+ -+ Ipsec throughput seems to improve when disabling either family of -+ algorithms, sharing the load with the CPU. Enabling skciphers-only -+ appears to work best. -+ -+ config CRYPTO_DEV_QCE_ENABLE_ALL -+ bool "All supported algorithms" -+ select CRYPTO_DEV_QCE_SKCIPHER -+ select CRYPTO_DEV_QCE_SHA -+ help -+ Enable all supported algorithms: -+ - AES (CBC, CTR, ECB, XTS) -+ - 3DES (CBC, ECB) -+ - DES (CBC, ECB) -+ - SHA1, HMAC-SHA1 -+ - SHA256, HMAC-SHA256 -+ -+ config CRYPTO_DEV_QCE_ENABLE_SKCIPHER -+ bool "Symmetric-key ciphers only" -+ select CRYPTO_DEV_QCE_SKCIPHER -+ help -+ Enable symmetric-key ciphers only: -+ - AES (CBC, CTR, ECB, XTS) -+ - 3DES (ECB, CBC) -+ - DES (ECB, CBC) -+ -+ config CRYPTO_DEV_QCE_ENABLE_SHA -+ bool "Hash/HMAC only" -+ select CRYPTO_DEV_QCE_SHA -+ help -+ Enable hashes/HMAC algorithms only: -+ - SHA1, HMAC-SHA1 -+ - SHA256, HMAC-SHA256 -+ -+endchoice - - config CRYPTO_DEV_QCOM_RNG - tristate "Qualcomm Random Number Generator Driver" ---- a/drivers/crypto/qce/Makefile -+++ b/drivers/crypto/qce/Makefile -@@ -2,6 +2,7 @@ - obj-$(CONFIG_CRYPTO_DEV_QCE) += qcrypto.o - qcrypto-objs := core.o \ - common.o \ -- dma.o \ -- sha.o \ -- skcipher.o -+ dma.o -+ -+qcrypto-$(CONFIG_CRYPTO_DEV_QCE_SHA) += sha.o -+qcrypto-$(CONFIG_CRYPTO_DEV_QCE_SKCIPHER) += skcipher.o ---- a/drivers/crypto/qce/common.c -+++ b/drivers/crypto/qce/common.c -@@ -45,52 +45,56 @@ qce_clear_array(struct qce_device *qce, - qce_write(qce, offset + i * sizeof(u32), 0); - } - --static u32 qce_encr_cfg(unsigned long flags, u32 aes_key_size) -+static u32 qce_config_reg(struct qce_device *qce, int little) - { -- u32 cfg = 0; -+ u32 beats = (qce->burst_size >> 3) - 1; -+ u32 pipe_pair = qce->pipe_pair_id; -+ u32 config; - -- if (IS_AES(flags)) { -- if (aes_key_size == AES_KEYSIZE_128) -- cfg |= ENCR_KEY_SZ_AES128 << ENCR_KEY_SZ_SHIFT; -- else if (aes_key_size == AES_KEYSIZE_256) -- cfg |= ENCR_KEY_SZ_AES256 << ENCR_KEY_SZ_SHIFT; -- } -+ config = (beats << REQ_SIZE_SHIFT) & REQ_SIZE_MASK; -+ config |= BIT(MASK_DOUT_INTR_SHIFT) | BIT(MASK_DIN_INTR_SHIFT) | -+ BIT(MASK_OP_DONE_INTR_SHIFT) | BIT(MASK_ERR_INTR_SHIFT); -+ config |= (pipe_pair << PIPE_SET_SELECT_SHIFT) & PIPE_SET_SELECT_MASK; -+ config &= ~HIGH_SPD_EN_N_SHIFT; - -- if (IS_AES(flags)) -- cfg |= ENCR_ALG_AES << ENCR_ALG_SHIFT; -- else if (IS_DES(flags) || IS_3DES(flags)) -- cfg |= ENCR_ALG_DES << ENCR_ALG_SHIFT; -+ if (little) -+ config |= BIT(LITTLE_ENDIAN_MODE_SHIFT); - -- if (IS_DES(flags)) -- cfg |= ENCR_KEY_SZ_DES << ENCR_KEY_SZ_SHIFT; -+ return config; -+} - -- if (IS_3DES(flags)) -- cfg |= ENCR_KEY_SZ_3DES << ENCR_KEY_SZ_SHIFT; -+void qce_cpu_to_be32p_array(__be32 *dst, const u8 *src, unsigned int len) -+{ -+ __be32 *d = dst; -+ const u8 *s = src; -+ unsigned int n; - -- switch (flags & QCE_MODE_MASK) { -- case QCE_MODE_ECB: -- cfg |= ENCR_MODE_ECB << ENCR_MODE_SHIFT; -- break; -- case QCE_MODE_CBC: -- cfg |= ENCR_MODE_CBC << ENCR_MODE_SHIFT; -- break; -- case QCE_MODE_CTR: -- cfg |= ENCR_MODE_CTR << ENCR_MODE_SHIFT; -- break; -- case QCE_MODE_XTS: -- cfg |= ENCR_MODE_XTS << ENCR_MODE_SHIFT; -- break; -- case QCE_MODE_CCM: -- cfg |= ENCR_MODE_CCM << ENCR_MODE_SHIFT; -- cfg |= LAST_CCM_XFR << LAST_CCM_SHIFT; -- break; -- default: -- return ~0; -+ n = len / sizeof(u32); -+ for (; n > 0; n--) { -+ *d = cpu_to_be32p((const __u32 *) s); -+ s += sizeof(__u32); -+ d++; - } -+} - -- return cfg; -+static void qce_setup_config(struct qce_device *qce) -+{ -+ u32 config; -+ -+ /* get big endianness */ -+ config = qce_config_reg(qce, 0); -+ -+ /* clear status */ -+ qce_write(qce, REG_STATUS, 0); -+ qce_write(qce, REG_CONFIG, config); -+} -+ -+static inline void qce_crypto_go(struct qce_device *qce) -+{ -+ qce_write(qce, REG_GOPROC, BIT(GO_SHIFT) | BIT(RESULTS_DUMP_SHIFT)); - } - -+#ifdef CONFIG_CRYPTO_DEV_QCE_SHA - static u32 qce_auth_cfg(unsigned long flags, u32 key_size) - { - u32 cfg = 0; -@@ -137,88 +141,6 @@ static u32 qce_auth_cfg(unsigned long fl - return cfg; - } - --static u32 qce_config_reg(struct qce_device *qce, int little) --{ -- u32 beats = (qce->burst_size >> 3) - 1; -- u32 pipe_pair = qce->pipe_pair_id; -- u32 config; -- -- config = (beats << REQ_SIZE_SHIFT) & REQ_SIZE_MASK; -- config |= BIT(MASK_DOUT_INTR_SHIFT) | BIT(MASK_DIN_INTR_SHIFT) | -- BIT(MASK_OP_DONE_INTR_SHIFT) | BIT(MASK_ERR_INTR_SHIFT); -- config |= (pipe_pair << PIPE_SET_SELECT_SHIFT) & PIPE_SET_SELECT_MASK; -- config &= ~HIGH_SPD_EN_N_SHIFT; -- -- if (little) -- config |= BIT(LITTLE_ENDIAN_MODE_SHIFT); -- -- return config; --} -- --void qce_cpu_to_be32p_array(__be32 *dst, const u8 *src, unsigned int len) --{ -- __be32 *d = dst; -- const u8 *s = src; -- unsigned int n; -- -- n = len / sizeof(u32); -- for (; n > 0; n--) { -- *d = cpu_to_be32p((const __u32 *) s); -- s += sizeof(__u32); -- d++; -- } --} -- --static void qce_xts_swapiv(__be32 *dst, const u8 *src, unsigned int ivsize) --{ -- u8 swap[QCE_AES_IV_LENGTH]; -- u32 i, j; -- -- if (ivsize > QCE_AES_IV_LENGTH) -- return; -- -- memset(swap, 0, QCE_AES_IV_LENGTH); -- -- for (i = (QCE_AES_IV_LENGTH - ivsize), j = ivsize - 1; -- i < QCE_AES_IV_LENGTH; i++, j--) -- swap[i] = src[j]; -- -- qce_cpu_to_be32p_array(dst, swap, QCE_AES_IV_LENGTH); --} -- --static void qce_xtskey(struct qce_device *qce, const u8 *enckey, -- unsigned int enckeylen, unsigned int cryptlen) --{ -- u32 xtskey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0}; -- unsigned int xtsklen = enckeylen / (2 * sizeof(u32)); -- unsigned int xtsdusize; -- -- qce_cpu_to_be32p_array((__be32 *)xtskey, enckey + enckeylen / 2, -- enckeylen / 2); -- qce_write_array(qce, REG_ENCR_XTS_KEY0, xtskey, xtsklen); -- -- /* xts du size 512B */ -- xtsdusize = min_t(u32, QCE_SECTOR_SIZE, cryptlen); -- qce_write(qce, REG_ENCR_XTS_DU_SIZE, xtsdusize); --} -- --static void qce_setup_config(struct qce_device *qce) --{ -- u32 config; -- -- /* get big endianness */ -- config = qce_config_reg(qce, 0); -- -- /* clear status */ -- qce_write(qce, REG_STATUS, 0); -- qce_write(qce, REG_CONFIG, config); --} -- --static inline void qce_crypto_go(struct qce_device *qce) --{ -- qce_write(qce, REG_GOPROC, BIT(GO_SHIFT) | BIT(RESULTS_DUMP_SHIFT)); --} -- - static int qce_setup_regs_ahash(struct crypto_async_request *async_req, - u32 totallen, u32 offset) - { -@@ -303,6 +225,87 @@ go_proc: - - return 0; - } -+#endif -+ -+#ifdef CONFIG_CRYPTO_DEV_QCE_SKCIPHER -+static u32 qce_encr_cfg(unsigned long flags, u32 aes_key_size) -+{ -+ u32 cfg = 0; -+ -+ if (IS_AES(flags)) { -+ if (aes_key_size == AES_KEYSIZE_128) -+ cfg |= ENCR_KEY_SZ_AES128 << ENCR_KEY_SZ_SHIFT; -+ else if (aes_key_size == AES_KEYSIZE_256) -+ cfg |= ENCR_KEY_SZ_AES256 << ENCR_KEY_SZ_SHIFT; -+ } -+ -+ if (IS_AES(flags)) -+ cfg |= ENCR_ALG_AES << ENCR_ALG_SHIFT; -+ else if (IS_DES(flags) || IS_3DES(flags)) -+ cfg |= ENCR_ALG_DES << ENCR_ALG_SHIFT; -+ -+ if (IS_DES(flags)) -+ cfg |= ENCR_KEY_SZ_DES << ENCR_KEY_SZ_SHIFT; -+ -+ if (IS_3DES(flags)) -+ cfg |= ENCR_KEY_SZ_3DES << ENCR_KEY_SZ_SHIFT; -+ -+ switch (flags & QCE_MODE_MASK) { -+ case QCE_MODE_ECB: -+ cfg |= ENCR_MODE_ECB << ENCR_MODE_SHIFT; -+ break; -+ case QCE_MODE_CBC: -+ cfg |= ENCR_MODE_CBC << ENCR_MODE_SHIFT; -+ break; -+ case QCE_MODE_CTR: -+ cfg |= ENCR_MODE_CTR << ENCR_MODE_SHIFT; -+ break; -+ case QCE_MODE_XTS: -+ cfg |= ENCR_MODE_XTS << ENCR_MODE_SHIFT; -+ break; -+ case QCE_MODE_CCM: -+ cfg |= ENCR_MODE_CCM << ENCR_MODE_SHIFT; -+ cfg |= LAST_CCM_XFR << LAST_CCM_SHIFT; -+ break; -+ default: -+ return ~0; -+ } -+ -+ return cfg; -+} -+ -+static void qce_xts_swapiv(__be32 *dst, const u8 *src, unsigned int ivsize) -+{ -+ u8 swap[QCE_AES_IV_LENGTH]; -+ u32 i, j; -+ -+ if (ivsize > QCE_AES_IV_LENGTH) -+ return; -+ -+ memset(swap, 0, QCE_AES_IV_LENGTH); -+ -+ for (i = (QCE_AES_IV_LENGTH - ivsize), j = ivsize - 1; -+ i < QCE_AES_IV_LENGTH; i++, j--) -+ swap[i] = src[j]; -+ -+ qce_cpu_to_be32p_array(dst, swap, QCE_AES_IV_LENGTH); -+} -+ -+static void qce_xtskey(struct qce_device *qce, const u8 *enckey, -+ unsigned int enckeylen, unsigned int cryptlen) -+{ -+ u32 xtskey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0}; -+ unsigned int xtsklen = enckeylen / (2 * sizeof(u32)); -+ unsigned int xtsdusize; -+ -+ qce_cpu_to_be32p_array((__be32 *)xtskey, enckey + enckeylen / 2, -+ enckeylen / 2); -+ qce_write_array(qce, REG_ENCR_XTS_KEY0, xtskey, xtsklen); -+ -+ /* xts du size 512B */ -+ xtsdusize = min_t(u32, QCE_SECTOR_SIZE, cryptlen); -+ qce_write(qce, REG_ENCR_XTS_DU_SIZE, xtsdusize); -+} - - static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, - u32 totallen, u32 offset) -@@ -384,15 +387,20 @@ static int qce_setup_regs_skcipher(struc - - return 0; - } -+#endif - - int qce_start(struct crypto_async_request *async_req, u32 type, u32 totallen, - u32 offset) - { - switch (type) { -+#ifdef CONFIG_CRYPTO_DEV_QCE_SKCIPHER - case CRYPTO_ALG_TYPE_SKCIPHER: - return qce_setup_regs_skcipher(async_req, totallen, offset); -+#endif -+#ifdef CONFIG_CRYPTO_DEV_QCE_SHA - case CRYPTO_ALG_TYPE_AHASH: - return qce_setup_regs_ahash(async_req, totallen, offset); -+#endif - default: - return -EINVAL; - } ---- a/drivers/crypto/qce/core.c -+++ b/drivers/crypto/qce/core.c -@@ -22,8 +22,12 @@ - #define QCE_QUEUE_LENGTH 1 - - static const struct qce_algo_ops *qce_ops[] = { -+#ifdef CONFIG_CRYPTO_DEV_QCE_SKCIPHER - &skcipher_ops, -+#endif -+#ifdef CONFIG_CRYPTO_DEV_QCE_SHA - &ahash_ops, -+#endif - }; - - static void qce_unregister_algs(struct qce_device *qce) diff --git a/target/linux/ipq40xx/patches-5.4/0014-v5.7-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch b/target/linux/ipq40xx/patches-5.4/0014-v5.7-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch deleted file mode 100644 index 160420b485..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0014-v5.7-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch +++ /dev/null @@ -1,89 +0,0 @@ -From d6364b8128439a8c0e381f80c38667de9f15eef8 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 7 Feb 2020 12:02:25 -0300 -Subject: [PATCH 09/11] crypto: qce - use cryptlen when adding extra sgl - -The qce crypto driver appends an extra entry to the dst sgl, to maintain -private state information. - -When the gcm driver sends requests to the ctr skcipher, it passes the -authentication tag after the actual crypto payload, but it must not be -touched. - -Commit 1336c2221bee ("crypto: qce - save a sg table slot for result -buf") limited the destination sgl to avoid overwriting the -authentication tag but it assumed the tag would be in a separate sgl -entry. - -This is not always the case, so it is better to limit the length of the -destination buffer to req->cryptlen before appending the result buf. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - drivers/crypto/qce/dma.c | 11 ++++++----- - drivers/crypto/qce/dma.h | 2 +- - drivers/crypto/qce/skcipher.c | 5 +++-- - 3 files changed, 10 insertions(+), 8 deletions(-) - ---- a/drivers/crypto/qce/dma.c -+++ b/drivers/crypto/qce/dma.c -@@ -48,9 +48,10 @@ void qce_dma_release(struct qce_dma_data - - struct scatterlist * - qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl, -- int max_ents) -+ unsigned int max_len) - { - struct scatterlist *sg = sgt->sgl, *sg_last = NULL; -+ unsigned int new_len; - - while (sg) { - if (!sg_page(sg)) -@@ -61,13 +62,13 @@ qce_sgtable_add(struct sg_table *sgt, st - if (!sg) - return ERR_PTR(-EINVAL); - -- while (new_sgl && sg && max_ents) { -- sg_set_page(sg, sg_page(new_sgl), new_sgl->length, -- new_sgl->offset); -+ while (new_sgl && sg && max_len) { -+ new_len = new_sgl->length > max_len ? max_len : new_sgl->length; -+ sg_set_page(sg, sg_page(new_sgl), new_len, new_sgl->offset); - sg_last = sg; - sg = sg_next(sg); - new_sgl = sg_next(new_sgl); -- max_ents--; -+ max_len -= new_len; - } - - return sg_last; ---- a/drivers/crypto/qce/dma.h -+++ b/drivers/crypto/qce/dma.h -@@ -43,6 +43,6 @@ void qce_dma_issue_pending(struct qce_dm - int qce_dma_terminate_all(struct qce_dma_data *dma); - struct scatterlist * - qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add, -- int max_ents); -+ unsigned int max_len); - - #endif /* _DMA_H_ */ ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -97,13 +97,14 @@ qce_skcipher_async_req_handle(struct cry - - sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); - -- sg = qce_sgtable_add(&rctx->dst_tbl, req->dst, rctx->dst_nents - 1); -+ sg = qce_sgtable_add(&rctx->dst_tbl, req->dst, req->cryptlen); - if (IS_ERR(sg)) { - ret = PTR_ERR(sg); - goto error_free; - } - -- sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg, 1); -+ sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg, -+ QCE_RESULT_BUF_SZ); - if (IS_ERR(sg)) { - ret = PTR_ERR(sg); - goto error_free; diff --git a/target/linux/ipq40xx/patches-5.4/0015-v5.7-crypto-qce-use-AES-fallback-for-small-requests.patch b/target/linux/ipq40xx/patches-5.4/0015-v5.7-crypto-qce-use-AES-fallback-for-small-requests.patch deleted file mode 100644 index 0b5c8c6d66..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0015-v5.7-crypto-qce-use-AES-fallback-for-small-requests.patch +++ /dev/null @@ -1,113 +0,0 @@ -From ce163ba0bf298f1707321ac025ef639f88e62801 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 7 Feb 2020 12:02:26 -0300 -Subject: [PATCH 10/11] crypto: qce - use AES fallback for small requests - -Process small blocks using the fallback cipher, as a workaround for an -observed failure (DMA-related, apparently) when computing the GCM ghash -key. This brings a speed gain as well, since it avoids the latency of -using the hardware engine to process small blocks. - -Using software for all 16-byte requests would be enough to make GCM -work, but to increase performance, a larger threshold would be better. -Measuring the performance of supported ciphers with openssl speed, -software matches hardware at around 768-1024 bytes. - -Considering the 256-bit ciphers, software is 2-3 times faster than qce -at 256-bytes, 30% faster at 512, and about even at 768-bytes. With -128-bit keys, the break-even point would be around 1024-bytes. - -This adds the 'aes_sw_max_len' parameter, to set the largest request -length processed by the software fallback. Its default is being set to -512 bytes, a little lower than the break-even point, to balance the cost -in CPU usage. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - ---- a/drivers/crypto/Kconfig -+++ b/drivers/crypto/Kconfig -@@ -684,6 +684,29 @@ choice - - endchoice - -+config CRYPTO_DEV_QCE_SW_MAX_LEN -+ int "Default maximum request size to use software for AES" -+ depends on CRYPTO_DEV_QCE && CRYPTO_DEV_QCE_SKCIPHER -+ default 512 -+ help -+ This sets the default maximum request size to perform AES requests -+ using software instead of the crypto engine. It can be changed by -+ setting the aes_sw_max_len parameter. -+ -+ Small blocks are processed faster in software than hardware. -+ Considering the 256-bit ciphers, software is 2-3 times faster than -+ qce at 256-bytes, 30% faster at 512, and about even at 768-bytes. -+ With 128-bit keys, the break-even point would be around 1024-bytes. -+ -+ The default is set a little lower, to 512 bytes, to balance the -+ cost in CPU usage. The minimum recommended setting is 16-bytes -+ (1 AES block), since AES-GCM will fail if you set it lower. -+ Setting this to zero will send all requests to the hardware. -+ -+ Note that 192-bit keys are not supported by the hardware and are -+ always processed by the software fallback, and all DES requests -+ are done by the hardware. -+ - config CRYPTO_DEV_QCOM_RNG - tristate "Qualcomm Random Number Generator Driver" - depends on ARCH_QCOM || COMPILE_TEST ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -5,6 +5,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -12,6 +13,13 @@ - - #include "cipher.h" - -+static unsigned int aes_sw_max_len = CONFIG_CRYPTO_DEV_QCE_SW_MAX_LEN; -+module_param(aes_sw_max_len, uint, 0644); -+MODULE_PARM_DESC(aes_sw_max_len, -+ "Only use hardware for AES requests larger than this " -+ "[0=always use hardware; anything <16 breaks AES-GCM; default=" -+ __stringify(CONFIG_CRYPTO_DEV_QCE_SOFT_THRESHOLD)"]"); -+ - static LIST_HEAD(skcipher_algs); - - static void qce_skcipher_done(void *data) -@@ -166,15 +174,10 @@ static int qce_skcipher_setkey(struct cr - switch (IS_XTS(flags) ? keylen >> 1 : keylen) { - case AES_KEYSIZE_128: - case AES_KEYSIZE_256: -+ memcpy(ctx->enc_key, key, keylen); - break; -- default: -- goto fallback; - } - -- ctx->enc_keylen = keylen; -- memcpy(ctx->enc_key, key, keylen); -- return 0; --fallback: - ret = crypto_sync_skcipher_setkey(ctx->fallback, key, keylen); - if (!ret) - ctx->enc_keylen = keylen; -@@ -224,8 +227,9 @@ static int qce_skcipher_crypt(struct skc - rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; - keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen; - -- if (IS_AES(rctx->flags) && keylen != AES_KEYSIZE_128 && -- keylen != AES_KEYSIZE_256) { -+ if (IS_AES(rctx->flags) && -+ ((keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_256) || -+ req->cryptlen <= aes_sw_max_len)) { - SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); - - skcipher_request_set_sync_tfm(subreq, ctx->fallback); diff --git a/target/linux/ipq40xx/patches-5.4/0016-v5.7-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch b/target/linux/ipq40xx/patches-5.4/0016-v5.7-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch deleted file mode 100644 index 18beda6296..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0016-v5.7-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 7f19380b2cfd412dcef2facefb3f6c62788864d7 Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -Date: Fri, 7 Feb 2020 12:02:27 -0300 -Subject: [PATCH 11/11] crypto: qce - handle AES-XTS cases that qce fails - -QCE hangs when presented with an AES-XTS request whose length is larger -than QCE_SECTOR_SIZE (512-bytes), and is not a multiple of it. Let the -fallback cipher handle them. - -Signed-off-by: Eneas U de Queiroz -Signed-off-by: Herbert Xu ---- - drivers/crypto/qce/common.c | 2 -- - drivers/crypto/qce/common.h | 3 +++ - drivers/crypto/qce/skcipher.c | 9 +++++++-- - 3 files changed, 10 insertions(+), 4 deletions(-) - ---- a/drivers/crypto/qce/common.c -+++ b/drivers/crypto/qce/common.c -@@ -15,8 +15,6 @@ - #include "regs-v5.h" - #include "sha.h" - --#define QCE_SECTOR_SIZE 512 -- - static inline u32 qce_read(struct qce_device *qce, u32 offset) - { - return readl(qce->base + offset); ---- a/drivers/crypto/qce/common.h -+++ b/drivers/crypto/qce/common.h -@@ -12,6 +12,9 @@ - #include - #include - -+/* xts du size */ -+#define QCE_SECTOR_SIZE 512 -+ - /* key size in bytes */ - #define QCE_SHA_HMAC_KEY_SIZE 64 - #define QCE_MAX_CIPHER_KEY_SIZE AES_KEYSIZE_256 ---- a/drivers/crypto/qce/skcipher.c -+++ b/drivers/crypto/qce/skcipher.c -@@ -227,9 +227,14 @@ static int qce_skcipher_crypt(struct skc - rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; - keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen; - -+ /* qce is hanging when AES-XTS request len > QCE_SECTOR_SIZE and -+ * is not a multiple of it; pass such requests to the fallback -+ */ - if (IS_AES(rctx->flags) && -- ((keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_256) || -- req->cryptlen <= aes_sw_max_len)) { -+ (((keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_256) || -+ req->cryptlen <= aes_sw_max_len) || -+ (IS_XTS(rctx->flags) && req->cryptlen > QCE_SECTOR_SIZE && -+ req->cryptlen % QCE_SECTOR_SIZE))) { - SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); - - skcipher_request_set_sync_tfm(subreq, ctx->fallback); diff --git a/target/linux/ipq40xx/patches-5.4/0017-v5.8-phy-add-driver-for-Qualcomm-IPQ40xx-USB-PHY.patch b/target/linux/ipq40xx/patches-5.4/0017-v5.8-phy-add-driver-for-Qualcomm-IPQ40xx-USB-PHY.patch deleted file mode 100644 index ad09a9f250..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0017-v5.8-phy-add-driver-for-Qualcomm-IPQ40xx-USB-PHY.patch +++ /dev/null @@ -1,197 +0,0 @@ -From 3c9d8f6c03a2cda1849ec3c84f82ec030d1f49ef Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Sun, 3 May 2020 22:18:22 +0200 -Subject: [PATCH] phy: add driver for Qualcomm IPQ40xx USB PHY - -Add a driver to setup the USB PHY-s on Qualcom m IPQ40xx series SoCs. -The driver sets up HS and SS phys. - -Signed-off-by: John Crispin -Signed-off-by: Robert Marko -Cc: Luka Perkov -Link: https://lore.kernel.org/r/20200503201823.531757-1-robert.marko@sartura.hr -Signed-off-by: Vinod Koul ---- - drivers/phy/qualcomm/Kconfig | 7 + - drivers/phy/qualcomm/Makefile | 1 + - drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 148 ++++++++++++++++++++ - 3 files changed, 156 insertions(+) - create mode 100644 drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c - ---- a/drivers/phy/qualcomm/Kconfig -+++ b/drivers/phy/qualcomm/Kconfig -@@ -18,6 +18,13 @@ config PHY_QCOM_APQ8064_SATA - depends on OF - select GENERIC_PHY - -+config PHY_QCOM_IPQ4019_USB -+ tristate "Qualcomm IPQ4019 USB PHY driver" -+ depends on OF && (ARCH_QCOM || COMPILE_TEST) -+ select GENERIC_PHY -+ help -+ Support for the USB PHY-s on Qualcomm IPQ40xx SoC-s. -+ - config PHY_QCOM_IPQ806X_SATA - tristate "Qualcomm IPQ806x SATA SerDes/PHY driver" - depends on ARCH_QCOM ---- a/drivers/phy/qualcomm/Makefile -+++ b/drivers/phy/qualcomm/Makefile -@@ -1,6 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - obj-$(CONFIG_PHY_ATH79_USB) += phy-ath79-usb.o - obj-$(CONFIG_PHY_QCOM_APQ8064_SATA) += phy-qcom-apq8064-sata.o -+obj-$(CONFIG_PHY_QCOM_IPQ4019_USB) += phy-qcom-ipq4019-usb.o - obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o - obj-$(CONFIG_PHY_QCOM_PCIE2) += phy-qcom-pcie2.o - obj-$(CONFIG_PHY_QCOM_QMP) += phy-qcom-qmp.o ---- /dev/null -+++ b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c -@@ -0,0 +1,148 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later -+/* -+ * Copyright (C) 2018 John Crispin -+ * -+ * Based on code from -+ * Allwinner Technology Co., Ltd. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct ipq4019_usb_phy { -+ struct device *dev; -+ struct phy *phy; -+ void __iomem *base; -+ struct reset_control *por_rst; -+ struct reset_control *srif_rst; -+}; -+ -+static int ipq4019_ss_phy_power_off(struct phy *_phy) -+{ -+ struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); -+ -+ reset_control_assert(phy->por_rst); -+ msleep(10); -+ -+ return 0; -+} -+ -+static int ipq4019_ss_phy_power_on(struct phy *_phy) -+{ -+ struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); -+ -+ ipq4019_ss_phy_power_off(_phy); -+ -+ reset_control_deassert(phy->por_rst); -+ -+ return 0; -+} -+ -+static struct phy_ops ipq4019_usb_ss_phy_ops = { -+ .power_on = ipq4019_ss_phy_power_on, -+ .power_off = ipq4019_ss_phy_power_off, -+}; -+ -+static int ipq4019_hs_phy_power_off(struct phy *_phy) -+{ -+ struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); -+ -+ reset_control_assert(phy->por_rst); -+ msleep(10); -+ -+ reset_control_assert(phy->srif_rst); -+ msleep(10); -+ -+ return 0; -+} -+ -+static int ipq4019_hs_phy_power_on(struct phy *_phy) -+{ -+ struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); -+ -+ ipq4019_hs_phy_power_off(_phy); -+ -+ reset_control_deassert(phy->srif_rst); -+ msleep(10); -+ -+ reset_control_deassert(phy->por_rst); -+ -+ return 0; -+} -+ -+static struct phy_ops ipq4019_usb_hs_phy_ops = { -+ .power_on = ipq4019_hs_phy_power_on, -+ .power_off = ipq4019_hs_phy_power_off, -+}; -+ -+static const struct of_device_id ipq4019_usb_phy_of_match[] = { -+ { .compatible = "qcom,usb-hs-ipq4019-phy", .data = &ipq4019_usb_hs_phy_ops}, -+ { .compatible = "qcom,usb-ss-ipq4019-phy", .data = &ipq4019_usb_ss_phy_ops}, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, ipq4019_usb_phy_of_match); -+ -+static int ipq4019_usb_phy_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct resource *res; -+ struct phy_provider *phy_provider; -+ struct ipq4019_usb_phy *phy; -+ -+ phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); -+ if (!phy) -+ return -ENOMEM; -+ -+ phy->dev = &pdev->dev; -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ phy->base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(phy->base)) { -+ dev_err(dev, "failed to remap register memory\n"); -+ return PTR_ERR(phy->base); -+ } -+ -+ phy->por_rst = devm_reset_control_get(phy->dev, "por_rst"); -+ if (IS_ERR(phy->por_rst)) { -+ if (PTR_ERR(phy->por_rst) != -EPROBE_DEFER) -+ dev_err(dev, "POR reset is missing\n"); -+ return PTR_ERR(phy->por_rst); -+ } -+ -+ phy->srif_rst = devm_reset_control_get_optional(phy->dev, "srif_rst"); -+ if (IS_ERR(phy->srif_rst)) -+ return PTR_ERR(phy->srif_rst); -+ -+ phy->phy = devm_phy_create(dev, NULL, of_device_get_match_data(dev)); -+ if (IS_ERR(phy->phy)) { -+ dev_err(dev, "failed to create PHY\n"); -+ return PTR_ERR(phy->phy); -+ } -+ phy_set_drvdata(phy->phy, phy); -+ -+ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); -+ -+ return PTR_ERR_OR_ZERO(phy_provider); -+} -+ -+static struct platform_driver ipq4019_usb_phy_driver = { -+ .probe = ipq4019_usb_phy_probe, -+ .driver = { -+ .of_match_table = ipq4019_usb_phy_of_match, -+ .name = "ipq4019-usb-phy", -+ } -+}; -+module_platform_driver(ipq4019_usb_phy_driver); -+ -+MODULE_DESCRIPTION("QCOM/IPQ4019 USB phy driver"); -+MODULE_AUTHOR("John Crispin "); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ipq40xx/patches-5.4/0018-v5.9-pinctrl-msm-open-drain.patch b/target/linux/ipq40xx/patches-5.4/0018-v5.9-pinctrl-msm-open-drain.patch deleted file mode 100644 index 5cd4ccc30f..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0018-v5.9-pinctrl-msm-open-drain.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 5b08c1d567ee8e6af94696b3e549997cbdb2bb80 Mon Sep 17 00:00:00 2001 -From: Jaiganesh Narayanan -Date: Thu, 1 Sep 2016 10:40:38 +0530 -Subject: [PATCH] pinctrl: qcom: ipq4019: add open drain support - -Signed-off-by: Jaiganesh Narayanan -[ Brian: adapted from from the Chromium OS kernel used on IPQ4019-based - WiFi APs. ] -Signed-off-by: Brian Norris ---- -https://lore.kernel.org/linux-gpio/20200703080646.23233-1-computersforpeace@gmail.com/ - - drivers/pinctrl/qcom/pinctrl-ipq4019.c | 1 + - drivers/pinctrl/qcom/pinctrl-msm.c | 13 +++++++++++++ - drivers/pinctrl/qcom/pinctrl-msm.h | 2 ++ - 3 files changed, 16 insertions(+) - ---- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c -+++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c -@@ -254,6 +254,7 @@ DECLARE_QCA_GPIO_PINS(99); - .mux_bit = 2, \ - .pull_bit = 0, \ - .drv_bit = 6, \ -+ .od_bit = 12, \ - .oe_bit = 9, \ - .in_bit = 0, \ - .out_bit = 1, \ ---- a/drivers/pinctrl/qcom/pinctrl-msm.c -+++ b/drivers/pinctrl/qcom/pinctrl-msm.c -@@ -225,6 +225,10 @@ static int msm_config_reg(struct msm_pin - *bit = g->pull_bit; - *mask = 3; - break; -+ case PIN_CONFIG_DRIVE_OPEN_DRAIN: -+ *bit = g->od_bit; -+ *mask = 1; -+ break; - case PIN_CONFIG_DRIVE_STRENGTH: - *bit = g->drv_bit; - *mask = 7; -@@ -302,6 +306,12 @@ static int msm_config_group_get(struct p - if (!arg) - return -EINVAL; - break; -+ case PIN_CONFIG_DRIVE_OPEN_DRAIN: -+ /* Pin is not open-drain */ -+ if (!arg) -+ return -EINVAL; -+ arg = 1; -+ break; - case PIN_CONFIG_DRIVE_STRENGTH: - arg = msm_regval_to_drive(arg); - break; -@@ -374,6 +384,9 @@ static int msm_config_group_set(struct p - else - arg = MSM_PULL_UP; - break; -+ case PIN_CONFIG_DRIVE_OPEN_DRAIN: -+ arg = 1; -+ break; - case PIN_CONFIG_DRIVE_STRENGTH: - /* Check for invalid values */ - if (arg > 16 || arg < 2 || (arg % 2) != 0) ---- a/drivers/pinctrl/qcom/pinctrl-msm.h -+++ b/drivers/pinctrl/qcom/pinctrl-msm.h -@@ -38,6 +38,7 @@ struct msm_function { - * @mux_bit: Offset in @ctl_reg for the pinmux function selection. - * @pull_bit: Offset in @ctl_reg for the bias configuration. - * @drv_bit: Offset in @ctl_reg for the drive strength configuration. -+ * @od_bit: Offset in @ctl_reg for controlling open drain. - * @oe_bit: Offset in @ctl_reg for controlling output enable. - * @in_bit: Offset in @io_reg for the input bit value. - * @out_bit: Offset in @io_reg for the output bit value. -@@ -75,6 +76,7 @@ struct msm_pingroup { - unsigned pull_bit:5; - unsigned drv_bit:5; - -+ unsigned od_bit:5; - unsigned oe_bit:5; - unsigned in_bit:5; - unsigned out_bit:5; diff --git a/target/linux/ipq40xx/patches-5.4/0019-v5.6-mtd-spi-nor-Add-support-for-mx25r3235f.patch b/target/linux/ipq40xx/patches-5.4/0019-v5.6-mtd-spi-nor-Add-support-for-mx25r3235f.patch deleted file mode 100644 index 7202478610..0000000000 --- a/target/linux/ipq40xx/patches-5.4/0019-v5.6-mtd-spi-nor-Add-support-for-mx25r3235f.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 707745e8d4e75b638b990d67950ab292b3b8ea2a Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Mon, 16 Dec 2019 01:36:46 +0100 -Subject: [PATCH] mtd: spi-nor: Add support for mx25r3235f - -Add MTD support for the Macronix MX25R3235F SPI NOR chip from Macronix. -The chip has 4MB of total capacity, divided into a total of 64 sectors, -each 64KB sized. The chip also supports 4KB large sectors. -Additionally, it supports dual and quad read modes. - -Functionality was verified on an HPE/Aruba AP-303 board. - -Signed-off-by: David Bauer -Signed-off-by: Tudor Ambarus ---- - drivers/mtd/spi-nor/spi-nor.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -2354,6 +2354,8 @@ static const struct flash_info spi_nor_i - { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, -+ { "mx25r3235f", INFO(0xc22816, 0, 64 * 1024, 64, -+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "mx25u12835f", INFO(0xc22538, 0, 64 * 1024, 256, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, diff --git a/target/linux/ipq40xx/patches-5.4/100-GPIO-add-named-gpio-exports.patch b/target/linux/ipq40xx/patches-5.4/100-GPIO-add-named-gpio-exports.patch deleted file mode 100644 index 805836fcca..0000000000 --- a/target/linux/ipq40xx/patches-5.4/100-GPIO-add-named-gpio-exports.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 4267880319bc1a2270d352e0ded6d6386242a7ef Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 12 Aug 2014 20:49:27 +0200 -Subject: [PATCH 24/53] GPIO: add named gpio exports - -Signed-off-by: John Crispin ---- - drivers/gpio/gpiolib-of.c | 68 +++++++++++++++++++++++++++++++++++++++++ - drivers/gpio/gpiolib-sysfs.c | 10 +++++- - include/asm-generic/gpio.h | 6 ++++ - include/linux/gpio/consumer.h | 8 +++++ - 4 files changed, 91 insertions(+), 1 deletion(-) - ---- a/drivers/gpio/gpiolib-of.c -+++ b/drivers/gpio/gpiolib-of.c -@@ -19,6 +19,8 @@ - #include - #include - #include -+#include -+#include - - #include "gpiolib.h" - #include "gpiolib-of.h" -@@ -915,3 +917,68 @@ void of_gpiochip_remove(struct gpio_chip - { - of_node_put(chip->of_node); - } -+ -+static struct of_device_id gpio_export_ids[] = { -+ { .compatible = "gpio-export" }, -+ { /* sentinel */ } -+}; -+ -+static int of_gpio_export_probe(struct platform_device *pdev) -+{ -+ struct device_node *np = pdev->dev.of_node; -+ struct device_node *cnp; -+ u32 val; -+ int nb = 0; -+ -+ for_each_child_of_node(np, cnp) { -+ const char *name = NULL; -+ int gpio; -+ bool dmc; -+ int max_gpio = 1; -+ int i; -+ -+ of_property_read_string(cnp, "gpio-export,name", &name); -+ -+ if (!name) -+ max_gpio = of_gpio_count(cnp); -+ -+ for (i = 0; i < max_gpio; i++) { -+ unsigned flags = 0; -+ enum of_gpio_flags of_flags; -+ -+ gpio = of_get_gpio_flags(cnp, i, &of_flags); -+ if (!gpio_is_valid(gpio)) -+ return gpio; -+ -+ if (of_flags == OF_GPIO_ACTIVE_LOW) -+ flags |= GPIOF_ACTIVE_LOW; -+ -+ if (!of_property_read_u32(cnp, "gpio-export,output", &val)) -+ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; -+ else -+ flags |= GPIOF_IN; -+ -+ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np))) -+ continue; -+ -+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change"); -+ gpio_export_with_name(gpio, dmc, name); -+ nb++; -+ } -+ } -+ -+ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb); -+ -+ return 0; -+} -+ -+static struct platform_driver gpio_export_driver = { -+ .driver = { -+ .name = "gpio-export", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(gpio_export_ids), -+ }, -+ .probe = of_gpio_export_probe, -+}; -+ -+module_platform_driver(gpio_export_driver); ---- a/drivers/gpio/gpiolib-sysfs.c -+++ b/drivers/gpio/gpiolib-sysfs.c -@@ -571,7 +571,7 @@ static struct class gpio_class = { - * - * Returns zero on success, else an error. - */ --int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name) - { - struct gpio_chip *chip; - struct gpio_device *gdev; -@@ -633,6 +633,8 @@ int gpiod_export(struct gpio_desc *desc, - offset = gpio_chip_hwgpio(desc); - if (chip->names && chip->names[offset]) - ioname = chip->names[offset]; -+ if (name) -+ ioname = name; - - dev = device_create_with_groups(&gpio_class, &gdev->dev, - MKDEV(0, 0), data, gpio_groups, -@@ -654,6 +656,12 @@ err_unlock: - gpiod_dbg(desc, "%s: status %d\n", __func__, status); - return status; - } -+EXPORT_SYMBOL_GPL(__gpiod_export); -+ -+int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+{ -+ return __gpiod_export(desc, direction_may_change, NULL); -+} - EXPORT_SYMBOL_GPL(gpiod_export); - - static int match_export(struct device *dev, const void *desc) ---- a/include/asm-generic/gpio.h -+++ b/include/asm-generic/gpio.h -@@ -127,6 +127,12 @@ static inline int gpio_export(unsigned g - return gpiod_export(gpio_to_desc(gpio), direction_may_change); - } - -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); -+static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name) -+{ -+ return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name); -+} -+ - static inline int gpio_export_link(struct device *dev, const char *name, - unsigned gpio) - { ---- a/include/linux/gpio/consumer.h -+++ b/include/linux/gpio/consumer.h -@@ -668,6 +668,7 @@ static inline void devm_acpi_dev_remove_ - - #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) - -+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); - int gpiod_export(struct gpio_desc *desc, bool direction_may_change); - int gpiod_export_link(struct device *dev, const char *name, - struct gpio_desc *desc); -@@ -675,6 +676,13 @@ void gpiod_unexport(struct gpio_desc *de - - #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ - -+static inline int _gpiod_export(struct gpio_desc *desc, -+ bool direction_may_change, -+ const char *name) -+{ -+ return -ENOSYS; -+} -+ - static inline int gpiod_export(struct gpio_desc *desc, - bool direction_may_change) - { diff --git a/target/linux/ipq40xx/patches-5.4/101-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch b/target/linux/ipq40xx/patches-5.4/101-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch deleted file mode 100644 index 14affc28c1..0000000000 --- a/target/linux/ipq40xx/patches-5.4/101-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 77d9b11ae7269dcf376c3b9493209f712524e986 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 22 Jan 2020 12:56:35 +0100 -Subject: [PATCH] arm: dts: IPQ4019: add SDHCI VQMMC LDO node - -Since we now have driver for the SDHCI VQMMC LDO needed -for I/0 voltage levels lets introduce the necessary node for it. - -Signed-off-by: Robert Marko ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -209,6 +209,16 @@ - interrupts = ; - }; - -+ vqmmc: regulator@1948000 { -+ compatible = "qcom,vqmmc-ipq4019-regulator"; -+ reg = <0x01948000 0x4>; -+ regulator-name = "vqmmc"; -+ regulator-min-microvolt = <1500000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-always-on; -+ status = "disabled"; -+ }; -+ - sdhci: sdhci@7824900 { - compatible = "qcom,sdhci-msm-v4"; - reg = <0x7824900 0x11c>, <0x7824000 0x800>; diff --git a/target/linux/ipq40xx/patches-5.4/102-ARM-dts-qcom-ipq4019-add-USB-devicetree-nodes.patch b/target/linux/ipq40xx/patches-5.4/102-ARM-dts-qcom-ipq4019-add-USB-devicetree-nodes.patch deleted file mode 100644 index b033a1baee..0000000000 --- a/target/linux/ipq40xx/patches-5.4/102-ARM-dts-qcom-ipq4019-add-USB-devicetree-nodes.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 193856b5fe11c50a0b6ff22457dd674c1a45fec6 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Wed, 9 Sep 2020 18:31:03 +0200 -Subject: [PATCH] ARM: dts: qcom: ipq4019: add USB devicetree nodes - -Since we now have driver for the USB PHY, and USB controller is already supported by the DWC3 driver lets add the necessary nodes to DTSI. - -Signed-off-by: John Crispin -Signed-off-by: Robert Marko -Cc: Luka Perkov -Reviewed-by: Vinod Koul ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 74 +++++++++++++++++++++++++++++ - 1 file changed, 74 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -615,5 +615,79 @@ - reg = <4>; - }; - }; -+ -+ usb3_ss_phy: ssphy@9a000 { -+ compatible = "qcom,usb-ss-ipq4019-phy"; -+ #phy-cells = <0>; -+ reg = <0x9a000 0x800>; -+ reg-names = "phy_base"; -+ resets = <&gcc USB3_UNIPHY_PHY_ARES>; -+ reset-names = "por_rst"; -+ status = "disabled"; -+ }; -+ -+ usb3_hs_phy: hsphy@a6000 { -+ compatible = "qcom,usb-hs-ipq4019-phy"; -+ #phy-cells = <0>; -+ reg = <0xa6000 0x40>; -+ reg-names = "phy_base"; -+ resets = <&gcc USB3_HSPHY_POR_ARES>, <&gcc USB3_HSPHY_S_ARES>; -+ reset-names = "por_rst", "srif_rst"; -+ status = "disabled"; -+ }; -+ -+ usb3: usb3@8af8800 { -+ compatible = "qcom,dwc3"; -+ reg = <0x8af8800 0x100>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ clocks = <&gcc GCC_USB3_MASTER_CLK>, -+ <&gcc GCC_USB3_SLEEP_CLK>, -+ <&gcc GCC_USB3_MOCK_UTMI_CLK>; -+ clock-names = "master", "sleep", "mock_utmi"; -+ ranges; -+ status = "disabled"; -+ -+ dwc3@8a00000 { -+ compatible = "snps,dwc3"; -+ reg = <0x8a00000 0xf8000>; -+ interrupts = ; -+ phys = <&usb3_hs_phy>, <&usb3_ss_phy>; -+ phy-names = "usb2-phy", "usb3-phy"; -+ dr_mode = "host"; -+ }; -+ }; -+ -+ usb2_hs_phy: hsphy@a8000 { -+ compatible = "qcom,usb-hs-ipq4019-phy"; -+ #phy-cells = <0>; -+ reg = <0xa8000 0x40>; -+ reg-names = "phy_base"; -+ resets = <&gcc USB2_HSPHY_POR_ARES>, <&gcc USB2_HSPHY_S_ARES>; -+ reset-names = "por_rst", "srif_rst"; -+ status = "disabled"; -+ }; -+ -+ usb2: usb2@60f8800 { -+ compatible = "qcom,dwc3"; -+ reg = <0x60f8800 0x100>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ clocks = <&gcc GCC_USB2_MASTER_CLK>, -+ <&gcc GCC_USB2_SLEEP_CLK>, -+ <&gcc GCC_USB2_MOCK_UTMI_CLK>; -+ clock-names = "master", "sleep", "mock_utmi"; -+ ranges; -+ status = "disabled"; -+ -+ dwc3@6000000 { -+ compatible = "snps,dwc3"; -+ reg = <0x6000000 0xf8000>; -+ interrupts = ; -+ phys = <&usb2_hs_phy>; -+ phy-names = "usb2-phy"; -+ dr_mode = "host"; -+ }; -+ }; - }; - }; diff --git a/target/linux/ipq40xx/patches-5.4/103-arm-dts-qcom-ipq4019-add-more-labels.patch b/target/linux/ipq40xx/patches-5.4/103-arm-dts-qcom-ipq4019-add-more-labels.patch deleted file mode 100644 index 0e215ee7cf..0000000000 --- a/target/linux/ipq40xx/patches-5.4/103-arm-dts-qcom-ipq4019-add-more-labels.patch +++ /dev/null @@ -1,42 +0,0 @@ -From caa3ee6b094ee18021943504c938919fcac325ec Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 9 Sep 2020 20:40:33 +0200 -Subject: [PATCH] arm: dts: qcom: ipq4019: add more labels - -Lets add labels to more commonly used nodes for easier modification in board DTS files. - -Signed-off-by: Robert Marko -Cc: Luka Perkov ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -190,7 +190,7 @@ - reg = <0x1800000 0x60000>; - }; - -- rng@22000 { -+ prng: rng@22000 { - compatible = "qcom,prng"; - reg = <0x22000 0x140>; - clocks = <&gcc GCC_PRNG_AHB_CLK>; -@@ -310,7 +310,7 @@ - status = "disabled"; - }; - -- crypto@8e3a000 { -+ crypto: crypto@8e3a000 { - compatible = "qcom,crypto-v5.1"; - reg = <0x08e3a000 0x6000>; - clocks = <&gcc GCC_CRYPTO_AHB_CLK>, -@@ -396,7 +396,7 @@ - dma-names = "rx", "tx"; - }; - -- watchdog@b017000 { -+ watchdog: watchdog@b017000 { - compatible = "qcom,kpss-wdt", "qcom,kpss-wdt-ipq4019"; - reg = <0xb017000 0x40>; - clocks = <&sleep_clk>; diff --git a/target/linux/ipq40xx/patches-5.4/104-clk-fix-apss-cpu-overclocking.patch b/target/linux/ipq40xx/patches-5.4/104-clk-fix-apss-cpu-overclocking.patch deleted file mode 100644 index 25a2020bd2..0000000000 --- a/target/linux/ipq40xx/patches-5.4/104-clk-fix-apss-cpu-overclocking.patch +++ /dev/null @@ -1,115 +0,0 @@ -From f2b87dc1028b710ec8ce25808b9d21f92b376184 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Sun, 11 Mar 2018 14:41:31 +0100 -Subject: [PATCH 2/2] clk: fix apss cpu overclocking - -There's an interaction issue between the clk changes:" -clk: qcom: ipq4019: Add the apss cpu pll divider clock node -clk: qcom: ipq4019: remove fixed clocks and add pll clocks -" and the cpufreq-dt. - -cpufreq-dt is now spamming the kernel-log with the following: - -[ 1099.190658] cpu cpu0: dev_pm_opp_set_rate: failed to find current OPP -for freq 761142857 (-34) - -This only happens on certain devices like the Compex WPJ428 -and AVM FritzBox!4040. However, other devices like the Asus -RT-AC58U and Meraki MR33 work just fine. - -The issue stem from the fact that all higher CPU-Clocks -are achieved by switching the clock-parent to the P_DDRPLLAPSS -(ddrpllapss). Which is set by Qualcomm's proprietary bootcode -as part of the DDR calibration. - -For example, the FB4040 uses 256 MiB Nanya NT5CC128M16IP clocked -at round 533 MHz (ddrpllsdcc = 190285714 Hz). - -whereas the 128 MiB Nanya NT5CC64M16GP-DI in the ASUS RT-AC58U is -clocked at a slightly higher 537 MHz ( ddrpllsdcc = 192000000 Hz). - -This patch attempts to fix the issue by modifying -clk_cpu_div_round_rate(), clk_cpu_div_set_rate(), clk_cpu_div_recalc_rate() -to use a new qcom_find_freq_close() function, which returns the closest -matching frequency, instead of the next higher. This way, the SoC in -the FB4040 (with its max clock speed of 710.4 MHz) will no longer -try to overclock to 761 MHz. - -Fixes: d83dcacea18 ("clk: qcom: ipq4019: Add the apss cpu pll divider clock node") -Signed-off-by: Christian Lamparter -Signed-off-by: John Crispin ---- - drivers/clk/qcom/gcc-ipq4019.c | 34 +++++++++++++++++++++++++++++++--- - 1 file changed, 31 insertions(+), 3 deletions(-) - ---- a/drivers/clk/qcom/gcc-ipq4019.c -+++ b/drivers/clk/qcom/gcc-ipq4019.c -@@ -1243,6 +1243,29 @@ static const struct clk_fepll_vco gcc_fe - .reg = 0x2f020, - }; - -+ -+const struct freq_tbl *qcom_find_freq_close(const struct freq_tbl *f, -+ unsigned long rate) -+{ -+ const struct freq_tbl *last = NULL; -+ -+ for ( ; f->freq; f++) { -+ if (rate == f->freq) -+ return f; -+ -+ if (f->freq > rate) { -+ if (!last || -+ (f->freq - rate) < (rate - last->freq)) -+ return f; -+ else -+ return last; -+ } -+ last = f; -+ } -+ -+ return last; -+} -+ - /* - * Round rate function for APSS CPU PLL Clock divider. - * It looks up the frequency table and returns the next higher frequency -@@ -1255,7 +1278,7 @@ static long clk_cpu_div_round_rate(struc - struct clk_hw *p_hw; - const struct freq_tbl *f; - -- f = qcom_find_freq(pll->freq_tbl, rate); -+ f = qcom_find_freq_close(pll->freq_tbl, rate); - if (!f) - return -EINVAL; - -@@ -1278,7 +1301,7 @@ static int clk_cpu_div_set_rate(struct c - u32 mask; - int ret; - -- f = qcom_find_freq(pll->freq_tbl, rate); -+ f = qcom_find_freq_close(pll->freq_tbl, rate); - if (!f) - return -EINVAL; - -@@ -1305,6 +1328,7 @@ static unsigned long - clk_cpu_div_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) - { -+ const struct freq_tbl *f; - struct clk_fepll *pll = to_clk_fepll(hw); - u32 cdiv, pre_div; - u64 rate; -@@ -1325,7 +1349,11 @@ clk_cpu_div_recalc_rate(struct clk_hw *h - rate = clk_fepll_vco_calc_rate(pll, parent_rate) * 2; - do_div(rate, pre_div); - -- return rate; -+ f = qcom_find_freq_close(pll->freq_tbl, rate); -+ if (!f) -+ return rate; -+ -+ return f->freq; - }; - - static const struct clk_ops clk_regmap_cpu_div_ops = { diff --git a/target/linux/ipq40xx/patches-5.4/105-ipq40xx-fix-sleep-clock.patch b/target/linux/ipq40xx/patches-5.4/105-ipq40xx-fix-sleep-clock.patch deleted file mode 100644 index 8afcbdcf98..0000000000 --- a/target/linux/ipq40xx/patches-5.4/105-ipq40xx-fix-sleep-clock.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4d44bb1031a68d7d5b604d3b340c059f41ca62af Mon Sep 17 00:00:00 2001 -From: dissent1 -Date: Mon, 6 May 2019 20:55:16 +0300 -Subject: [PATCH] ipq40xx: fix sleep clock - -It seems like sleep_clk was copied from ipq806x. -Fix ipq40xx sleep_clk to the value QSDK defines. - -Also rename the sleep clock node like the GCC driver names it. - -Signed-off-by: Pavel Kubelun ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -140,9 +140,9 @@ - }; - - clocks { -- sleep_clk: sleep_clk { -+ sleep_clk: gcc_sleep_clk_src { - compatible = "fixed-clock"; -- clock-frequency = <32768>; -+ clock-frequency = <32000>; - #clock-cells = <0>; - }; - diff --git a/target/linux/ipq40xx/patches-5.4/300-clk-qcom-ipq4019-add-ess-reset.patch b/target/linux/ipq40xx/patches-5.4/300-clk-qcom-ipq4019-add-ess-reset.patch deleted file mode 100644 index 4297f32e05..0000000000 --- a/target/linux/ipq40xx/patches-5.4/300-clk-qcom-ipq4019-add-ess-reset.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 480c1f7648fc586db12d6003c717c23667a4fcf0 Mon Sep 17 00:00:00 2001 -From: Ram Chandra Jangir -Date: Tue, 28 Mar 2017 22:35:33 +0530 -Subject: [PATCH] clk: qcom: ipq4019: add ess reset - -Added the ESS reset in IPQ4019 GCC. - -Signed-off-by: Ram Chandra Jangir ---- - drivers/clk/qcom/gcc-ipq4019.c | 11 +++++++++++ - include/dt-bindings/clock/qcom,gcc-ipq4019.h | 11 +++++++++++ - 2 files changed, 22 insertions(+) - ---- a/drivers/clk/qcom/gcc-ipq4019.c -+++ b/drivers/clk/qcom/gcc-ipq4019.c -@@ -1736,6 +1736,17 @@ static const struct qcom_reset_map gcc_i - [GCC_TCSR_BCR] = {0x22000, 0}, - [GCC_MPM_BCR] = {0x24000, 0}, - [GCC_SPDM_BCR] = {0x25000, 0}, -+ [ESS_MAC1_ARES] = {0x1200C, 0}, -+ [ESS_MAC2_ARES] = {0x1200C, 1}, -+ [ESS_MAC3_ARES] = {0x1200C, 2}, -+ [ESS_MAC4_ARES] = {0x1200C, 3}, -+ [ESS_MAC5_ARES] = {0x1200C, 4}, -+ [ESS_PSGMII_ARES] = {0x1200C, 5}, -+ [ESS_MAC1_CLK_DIS] = {0x1200C, 8}, -+ [ESS_MAC2_CLK_DIS] = {0x1200C, 9}, -+ [ESS_MAC3_CLK_DIS] = {0x1200C, 10}, -+ [ESS_MAC4_CLK_DIS] = {0x1200C, 11}, -+ [ESS_MAC5_CLK_DIS] = {0x1200C, 12}, - }; - - static const struct regmap_config gcc_ipq4019_regmap_config = { ---- a/include/dt-bindings/clock/qcom,gcc-ipq4019.h -+++ b/include/dt-bindings/clock/qcom,gcc-ipq4019.h -@@ -165,5 +165,16 @@ - #define GCC_QDSS_BCR 69 - #define GCC_MPM_BCR 70 - #define GCC_SPDM_BCR 71 -+#define ESS_MAC1_ARES 72 -+#define ESS_MAC2_ARES 73 -+#define ESS_MAC3_ARES 74 -+#define ESS_MAC4_ARES 75 -+#define ESS_MAC5_ARES 76 -+#define ESS_PSGMII_ARES 77 -+#define ESS_MAC1_CLK_DIS 78 -+#define ESS_MAC2_CLK_DIS 79 -+#define ESS_MAC3_CLK_DIS 80 -+#define ESS_MAC4_CLK_DIS 81 -+#define ESS_MAC5_CLK_DIS 82 - - #endif diff --git a/target/linux/ipq40xx/patches-5.4/301-arm-compressed-add-appended-DTB-section.patch b/target/linux/ipq40xx/patches-5.4/301-arm-compressed-add-appended-DTB-section.patch deleted file mode 100644 index 7e6184fc73..0000000000 --- a/target/linux/ipq40xx/patches-5.4/301-arm-compressed-add-appended-DTB-section.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0843a61d6913bdac8889eb048ed89f7903059787 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 30 Oct 2020 13:36:31 +0100 -Subject: [PATCH] arm: compressed: add appended DTB section - -This adds a appended_dtb section to the ARM decompressor -linker script. - -This allows using the existing ARM zImage appended DTB support for -appending a DTB to the raw ELF kernel. - -Its size is set to 1MB max to match the zImage appended DTB size limit. - -To use it to pass the DTB to the kernel, objcopy is used: - -objcopy --set-section-flags=.appended_dtb=alloc,contents \ - --update-section=.appended_dtb=.dtb vmlinux - -This is based off the following patch: -https://github.com/openwrt/openwrt/commit/c063e27e02a9dcac0e7f5877fb154e58fa3e1a69 - -Signed-off-by: Robert Marko ---- - arch/arm/boot/compressed/vmlinux.lds.S | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/arch/arm/boot/compressed/vmlinux.lds.S -+++ b/arch/arm/boot/compressed/vmlinux.lds.S -@@ -93,6 +93,13 @@ SECTIONS - - _edata = .; - -+ .appended_dtb : { -+ /* leave space for appended DTB */ -+ . += 0x100000; -+ } -+ -+ _edata_dtb = .; -+ - /* - * The image_end section appears after any additional loadable sections - * that the linker may decide to insert in the binary image. Having -@@ -132,4 +139,4 @@ SECTIONS - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - } --ASSERT(_edata_real == _edata, "error: zImage file size is incorrect"); -+ASSERT(_edata_real == _edata_dtb, "error: zImage file size is incorrect"); diff --git a/target/linux/ipq40xx/patches-5.4/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch b/target/linux/ipq40xx/patches-5.4/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch deleted file mode 100644 index 71618a40f2..0000000000 --- a/target/linux/ipq40xx/patches-5.4/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 11d6a6128a5a07c429941afc202b6e62a19771be Mon Sep 17 00:00:00 2001 -From: John Thomson -Date: Fri, 23 Oct 2020 19:42:36 +1000 -Subject: [PATCH 2/2] arm: compressed: set ipq40xx watchdog to allow boot - -For IPQ40XX systems where the SoC watchdog is activated before linux, -the watchdog timer may be too small for linux to finish uncompress, -boot, and watchdog management start. -If the watchdog is enabled, set the timeout for it to 30 seconds. -The functionality and offsets were copied from: -drivers/watchdog/qcom-wdt.c qcom_wdt_set_timeout & qcom_wdt_start -The watchdog memory address was taken from: -arch/arm/boot/dts/qcom-ipq4019.dtsi - -This was required on Mikrotik IPQ40XX consumer hardware using Mikrotik's -RouterBoot bootloader. - -Signed-off-by: John Thomson ---- - arch/arm/boot/compressed/head.S | 35 +++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - ---- a/arch/arm/boot/compressed/head.S -+++ b/arch/arm/boot/compressed/head.S -@@ -599,6 +599,41 @@ not_relocated: mov r0, #0 - bic r4, r4, #1 - blne cache_on - -+/* Set the Qualcom IPQ40xx watchdog timeout to 30 seconds -+ * if it is enabled, so that there is time for kernel -+ * to decompress, boot, and take over the watchdog. -+ * data and functionality from drivers/watchdog/qcom-wdt.c -+ * address from arch/arm/boot/dts/qcom-ipq4019.dtsi -+ */ -+#ifdef CONFIG_ARCH_IPQ40XX -+watchdog_set: -+ /* offsets: -+ * 0x04 reset (=1 resets countdown) -+ * 0x08 enable (=0 disables) -+ * 0x0c status (=1 when SoC was reset by watchdog) -+ * 0x10 bark (=timeout warning in ticks) -+ * 0x14 bite (=timeout reset in ticks) -+ * clock rate is 1<<15 hertz -+ */ -+ .equ watchdog, 0x0b017000 @Store watchdog base address -+ movw r0, #:lower16:watchdog -+ movt r0, #:upper16:watchdog -+ ldr r1, [r0, #0x08] @Get enabled? -+ cmp r1, #1 @If not enabled, do not change -+ bne watchdog_finished -+ mov r1, #0 -+ str r1, [r0, #0x08] @Disable the watchdog -+ mov r1, #1 -+ str r1, [r0, #0x04] @Pet the watchdog -+ mov r1, #30 @30 seconds timeout -+ lsl r1, r1, #15 @converted to ticks -+ str r1, [r0, #0x10] @Set the bark timeout -+ str r1, [r0, #0x14] @Set the bite timeout -+ mov r1, #1 -+ str r1, [r0, #0x08] @Enable the watchdog -+watchdog_finished: -+#endif /* CONFIG_ARCH_IPQ40XX */ -+ - /* - * The C runtime environment should now be setup sufficiently. - * Set up some pointers, and start decompressing. diff --git a/target/linux/ipq40xx/patches-5.4/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch b/target/linux/ipq40xx/patches-5.4/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch deleted file mode 100644 index eaf7ae30bc..0000000000 --- a/target/linux/ipq40xx/patches-5.4/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0e28623a11f3916c1fe5b7e789c7ab8ca932a929 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 22 Jan 2020 13:02:13 +0100 -Subject: [PATCH] mmc: sdhci: sdhci-msm: use sdhci_set_clock instead of - sdhci_msm_set_clock - -When using sdhci_msm_set_clock clock setting will fail, so lets -use the generic sdhci_set_clock. - -Signed-off-by: Robert Marko ---- - drivers/mmc/host/sdhci-msm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mmc/host/sdhci-msm.c -+++ b/drivers/mmc/host/sdhci-msm.c -@@ -1763,7 +1763,7 @@ MODULE_DEVICE_TABLE(of, sdhci_msm_dt_mat - - static const struct sdhci_ops sdhci_msm_ops = { - .reset = sdhci_reset, -- .set_clock = sdhci_msm_set_clock, -+ .set_clock = sdhci_set_clock, - .get_min_clock = sdhci_msm_get_min_clock, - .get_max_clock = sdhci_msm_get_max_clock, - .set_bus_width = sdhci_set_bus_width, diff --git a/target/linux/ipq40xx/patches-5.4/702-dts-ipq4019-add-PHY-switch-nodes.patch b/target/linux/ipq40xx/patches-5.4/702-dts-ipq4019-add-PHY-switch-nodes.patch deleted file mode 100644 index cfbf7bd41f..0000000000 --- a/target/linux/ipq40xx/patches-5.4/702-dts-ipq4019-add-PHY-switch-nodes.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 9deeec35dd3b628b95624e41d4e04acf728991ba Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Sun, 20 Nov 2016 02:20:54 +0100 -Subject: [PATCH] dts: ipq4019: add PHY/switch nodes - -This patch adds both the "qcom,ess-switch" and "qcom,ess-psgmii" -nodes which are needed for the ar40xx.c driver to initialize the -switch. - -Signed-off-by: Christian Lamparter ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -616,6 +616,29 @@ - }; - }; - -+ ess-switch@c000000 { -+ compatible = "qcom,ess-switch"; -+ reg = <0xc000000 0x80000>; -+ switch_access_mode = "local bus"; -+ resets = <&gcc ESS_RESET>; -+ reset-names = "ess_rst"; -+ clocks = <&gcc GCC_ESS_CLK>; -+ clock-names = "ess_clk"; -+ switch_cpu_bmp = <0x1>; -+ switch_lan_bmp = <0x1e>; -+ switch_wan_bmp = <0x20>; -+ switch_mac_mode = <0>; /* PORT_WRAPPER_PSGMII */ -+ switch_initvlas = <0x7c 0x54>; -+ status = "disabled"; -+ }; -+ -+ ess-psgmii@98000 { -+ compatible = "qcom,ess-psgmii"; -+ reg = <0x98000 0x800>; -+ psgmii_access_mode = "local bus"; -+ status = "disabled"; -+ }; -+ - usb3_ss_phy: ssphy@9a000 { - compatible = "qcom,usb-ss-ipq4019-phy"; - #phy-cells = <0>; diff --git a/target/linux/ipq40xx/patches-5.4/703-net-IPQ4019-needs-rfs-vlan_tag-callbacks-in.patch b/target/linux/ipq40xx/patches-5.4/703-net-IPQ4019-needs-rfs-vlan_tag-callbacks-in.patch deleted file mode 100644 index 1e22abdf51..0000000000 --- a/target/linux/ipq40xx/patches-5.4/703-net-IPQ4019-needs-rfs-vlan_tag-callbacks-in.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 7c129254adb1093d10a62ed7bf7b956fcc6ffe34 Mon Sep 17 00:00:00 2001 -From: Rakesh Nair -Date: Wed, 20 Jul 2016 15:02:01 +0530 -Subject: [PATCH] net: IPQ4019 needs rfs/vlan_tag callbacks in - netdev_ops - -Add callback support to get default vlan tag and register -receive flow steering filter. - -Used by IPQ4019 ess-edma driver. - -BUG=chrome-os-partner:33096 -TEST=none - -Change-Id: I266070e4a0fbe4a0d9966fe79a71e50ec4f26c75 -Signed-off-by: Rakesh Nair -Reviewed-on: https://chromium-review.googlesource.com/362203 -Commit-Ready: Grant Grundler -Tested-by: Grant Grundler -Reviewed-by: Grant Grundler ---- - include/linux/netdevice.h | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -767,6 +767,16 @@ struct xps_map { - #define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \ - - sizeof(struct xps_map)) / sizeof(u16)) - -+#ifdef CONFIG_RFS_ACCEL -+typedef int (*set_rfs_filter_callback_t)(struct net_device *dev, -+ __be32 src, -+ __be32 dst, -+ __be16 sport, -+ __be16 dport, -+ u8 proto, -+ u16 rxq_index, -+ u32 action); -+#endif - /* - * This structure holds all XPS maps for device. Maps are indexed by CPU. - */ -@@ -1370,6 +1380,9 @@ struct net_device_ops { - const struct sk_buff *skb, - u16 rxq_index, - u32 flow_id); -+ int (*ndo_register_rfs_filter)(struct net_device *dev, -+ set_rfs_filter_callback_t set_filter); -+ int (*ndo_get_default_vlan_tag)(struct net_device *net); - #endif - int (*ndo_add_slave)(struct net_device *dev, - struct net_device *slave_dev, diff --git a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch deleted file mode 100644 index 6315a81527..0000000000 --- a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -580,6 +580,13 @@ config XILINX_GMII2RGMII - the Reduced Gigabit Media Independent Interface(RGMII) between - Ethernet physical media devices and the Gigabit Ethernet controller. - -+config AR40XX_PHY -+ tristate "Driver for Qualcomm Atheros IPQ40XX switches" -+ depends on HAS_IOMEM && OF && OF_MDIO -+ select SWCONFIG -+ help -+ This is the driver for Qualcomm Atheros IPQ40XX ESS switches. -+ - endif # PHYLIB - - config MICREL_KS8995MA ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -68,6 +68,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 diff --git a/target/linux/ipq40xx/patches-5.4/706-dt-bindings-net-add-QCA807x-PHY.patch b/target/linux/ipq40xx/patches-5.4/706-dt-bindings-net-add-QCA807x-PHY.patch deleted file mode 100644 index dfb8d692ab..0000000000 --- a/target/linux/ipq40xx/patches-5.4/706-dt-bindings-net-add-QCA807x-PHY.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c66863c1ba8995b61e6d727d78a241c734f5bb57 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 1 Oct 2020 15:05:35 +0200 -Subject: [PATCH] dt-bindings: net: add QCA807x PHY - -Add DT bindings for Qualcomm QCA807x PHY series. - -Signed-off-by: Robert Marko ---- - include/dt-bindings/net/qcom-qca807x.h | 45 ++++++++++++++++++++++++++ - 1 file changed, 45 insertions(+) - create mode 100644 include/dt-bindings/net/qcom-qca807x.h - ---- /dev/null -+++ b/include/dt-bindings/net/qcom-qca807x.h -@@ -0,0 +1,45 @@ -+/* SPDX-License-Identifier: GPL-2.0-or-later */ -+/* -+ * Device Tree constants for the Qualcomm QCA807X PHYs -+ */ -+ -+#ifndef _DT_BINDINGS_QCOM_QCA807X_H -+#define _DT_BINDINGS_QCOM_QCA807X_H -+ -+#define PSGMII_QSGMII_TX_DRIVER_140MV 0 -+#define PSGMII_QSGMII_TX_DRIVER_160MV 1 -+#define PSGMII_QSGMII_TX_DRIVER_180MV 2 -+#define PSGMII_QSGMII_TX_DRIVER_200MV 3 -+#define PSGMII_QSGMII_TX_DRIVER_220MV 4 -+#define PSGMII_QSGMII_TX_DRIVER_240MV 5 -+#define PSGMII_QSGMII_TX_DRIVER_260MV 6 -+#define PSGMII_QSGMII_TX_DRIVER_280MV 7 -+#define PSGMII_QSGMII_TX_DRIVER_300MV 8 -+#define PSGMII_QSGMII_TX_DRIVER_320MV 9 -+#define PSGMII_QSGMII_TX_DRIVER_400MV 10 -+#define PSGMII_QSGMII_TX_DRIVER_500MV 11 -+/* Default value */ -+#define PSGMII_QSGMII_TX_DRIVER_600MV 12 -+ -+/* Full amplitude, full bias current */ -+#define QCA807X_CONTROL_DAC_FULL_VOLT_BIAS 0 -+/* Amplitude follow DSP (amplitude is adjusted based on cable length), half bias current */ -+#define QCA807X_CONTROL_DAC_DSP_VOLT_HALF_BIAS 1 -+/* Full amplitude, bias current follow DSP (bias current is adjusted based on cable length) */ -+#define QCA807X_CONTROL_DAC_FULL_VOLT_DSP_BIAS 2 -+/* Both amplitude and bias current follow DSP */ -+#define QCA807X_CONTROL_DAC_DSP_VOLT_BIAS 3 -+/* Full amplitude, half bias current */ -+#define QCA807X_CONTROL_DAC_FULL_VOLT_HALF_BIAS 4 -+/* Amplitude follow DSP setting; 1/4 bias current when cable<10m, -+ * otherwise half bias current -+ */ -+#define QCA807X_CONTROL_DAC_DSP_VOLT_QUARTER_BIAS 5 -+/* Full amplitude; same bias current setting with “010” and “011”, -+ * but half more bias is reduced when cable <10m -+ */ -+#define QCA807X_CONTROL_DAC_FULL_VOLT_HALF_BIAS_SHORT 6 -+/* Amplitude follow DSP; same bias current setting with “110”, default value */ -+#define QCA807X_CONTROL_DAC_DSP_VOLT_HALF_BIAS_SHORT 7 -+ -+#endif diff --git a/target/linux/ipq40xx/patches-5.4/707-net-phy-Add-Qualcom-QCA807x-driver.patch b/target/linux/ipq40xx/patches-5.4/707-net-phy-Add-Qualcom-QCA807x-driver.patch deleted file mode 100644 index 3bd88d1505..0000000000 --- a/target/linux/ipq40xx/patches-5.4/707-net-phy-Add-Qualcom-QCA807x-driver.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f825cdc8bfde7616a14e2163f16303a8973031d2 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 7 Oct 2020 17:38:48 +0200 -Subject: [PATCH] net: phy: Add Qualcom QCA807x driver - -This adds driver for the Qualcomm QCA8072 and QCA8075 PHY-s. - -They are 2 or 5 port IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and 1000BASE-T PHY-s. - -They feature 2 SerDes, one for PSGMII or QSGMII connection with MAC, while second one is SGMII for connection to MAC or fiber. - -Both models have a combo port that supports 1000BASE-X and 100BASE-FX fiber. - -Each PHY inside of QCA807x series has 4 digitally controlled output only pins that natively drive LED-s. -But some vendors used these to driver generic LED-s controlled by userspace, -so lets enable registering each PHY as GPIO controller and add driver for it. - -These are commonly used in Qualcomm IPQ40xx, IPQ60xx and IPQ807x boards. - -Signed-off-by: Robert Marko ---- - drivers/net/phy/Kconfig | 6 ++++++ - drivers/net/phy/Makefile | 1 + - 2 files changed, 7 insertions(+) - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -533,6 +533,12 @@ config NXP_TJA11XX_PHY - ---help--- - Currently supports the NXP TJA1100 and TJA1101 PHY. - -+config QCA807X_PHY -+ tristate "Qualcomm QCA807X PHYs" -+ depends on OF_MDIO -+ help -+ Currently supports the QCA8072 and QCA8075 models. -+ - config QSEMI_PHY - tristate "Quality Semiconductor PHYs" - ---help--- ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -102,6 +102,7 @@ obj-$(CONFIG_MICROSEMI_PHY) += mscc.o - obj-$(CONFIG_NATIONAL_PHY) += national.o - obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o - obj-$(CONFIG_QSEMI_PHY) += qsemi.o -+obj-$(CONFIG_QCA807X_PHY) += qca807x.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_RENESAS_PHY) += uPD60620.o - obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o diff --git a/target/linux/ipq40xx/patches-5.4/708-arm-dts-ipq4019-QCA807x-properties.patch b/target/linux/ipq40xx/patches-5.4/708-arm-dts-ipq4019-QCA807x-properties.patch deleted file mode 100644 index 4b04a3ce9a..0000000000 --- a/target/linux/ipq40xx/patches-5.4/708-arm-dts-ipq4019-QCA807x-properties.patch +++ /dev/null @@ -1,62 +0,0 @@ -From e0fa88eaa3c176b71e563da68949ac2ab45aaa61 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 2 Oct 2020 10:43:26 +0200 -Subject: [PATCH] arm: dts: ipq4019: QCA807x properties - -This adds necessary DT properties for QCA807x PHY-s to IPQ4019 DTSI. - -Signed-off-by: Robert Marko ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -8,6 +8,7 @@ - #include - #include - #include -+#include - - / { - #address-cells = <1>; -@@ -597,22 +598,39 @@ - - ethphy0: ethernet-phy@0 { - reg = <0>; -+ -+ qcom,control-dac = ; - }; - - ethphy1: ethernet-phy@1 { - reg = <1>; -+ -+ qcom,control-dac = ; - }; - - ethphy2: ethernet-phy@2 { - reg = <2>; -+ -+ qcom,control-dac = ; - }; - - ethphy3: ethernet-phy@3 { - reg = <3>; -+ -+ qcom,control-dac = ; - }; - - ethphy4: ethernet-phy@4 { - reg = <4>; -+ -+ qcom,control-dac = ; -+ }; -+ -+ psgmiiphy: psgmii-phy@5 { -+ reg = <5>; -+ -+ qcom,tx-driver-strength = ; -+ qcom,psgmii-az; - }; - }; - diff --git a/target/linux/ipq40xx/patches-5.4/710-net-add-qualcomm-essedma-ethernet-driver.patch b/target/linux/ipq40xx/patches-5.4/710-net-add-qualcomm-essedma-ethernet-driver.patch deleted file mode 100644 index 793ce72142..0000000000 --- a/target/linux/ipq40xx/patches-5.4/710-net-add-qualcomm-essedma-ethernet-driver.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 12e9319da1adacac92930c899c99f0e1970cac11 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Thu, 19 Jan 2017 02:01:31 +0100 -Subject: [PATCH 33/38] NET: add qualcomm essedma ethernet driver - -Signed-off-by: Christian Lamparter ---- - drivers/net/ethernet/qualcomm/Kconfig | 9 +++++++++ - drivers/net/ethernet/qualcomm/Makefile | 1 + - 2 files changed, 10 insertions(+) - ---- a/drivers/net/ethernet/qualcomm/Kconfig -+++ b/drivers/net/ethernet/qualcomm/Kconfig -@@ -62,4 +62,14 @@ config QCOM_EMAC - - source "drivers/net/ethernet/qualcomm/rmnet/Kconfig" - -+config ESSEDMA -+ tristate "Qualcomm Atheros ESS Edma support" -+ depends on OF_MDIO -+ help -+ This driver supports ethernet edma adapter. -+ Say Y to build this driver. -+ -+ To compile this driver as a module, choose M here. The module -+ will be called essedma.ko. -+ - endif # NET_VENDOR_QUALCOMM ---- a/drivers/net/ethernet/qualcomm/Makefile -+++ b/drivers/net/ethernet/qualcomm/Makefile -@@ -10,5 +10,6 @@ obj-$(CONFIG_QCA7000_UART) += qcauart.o - qcauart-objs := qca_uart.o - - obj-y += emac/ -+obj-$(CONFIG_ESSEDMA) += essedma/ - - obj-$(CONFIG_RMNET) += rmnet/ diff --git a/target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch b/target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch deleted file mode 100644 index 7b2ddfe00d..0000000000 --- a/target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch +++ /dev/null @@ -1,92 +0,0 @@ -From c611d3780fa101662a822d10acf8feb04ca97409 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Sun, 20 Nov 2016 01:01:10 +0100 -Subject: [PATCH] dts: ipq4019: add ethernet essedma node - -This patch adds the device-tree node for the ethernet -interfaces. - -Note: The driver isn't anywhere close to be upstream, -so the info might change. - -Signed-off-by: Christian Lamparter ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 60 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 60 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -39,6 +39,8 @@ - spi1 = &blsp1_spi2; - i2c0 = &blsp1_i2c3; - i2c1 = &blsp1_i2c4; -+ ethernet0 = &gmac0; -+ ethernet1 = &gmac1; - }; - - cpus { -@@ -657,6 +659,64 @@ - status = "disabled"; - }; - -+ edma@c080000 { -+ compatible = "qcom,ess-edma"; -+ reg = <0xc080000 0x8000>; -+ qcom,page-mode = <0>; -+ qcom,rx_head_buf_size = <1540>; -+ qcom,mdio_supported; -+ qcom,poll_required = <1>; -+ qcom,num_gmac = <2>; -+ interrupts = <0 65 IRQ_TYPE_EDGE_RISING -+ 0 66 IRQ_TYPE_EDGE_RISING -+ 0 67 IRQ_TYPE_EDGE_RISING -+ 0 68 IRQ_TYPE_EDGE_RISING -+ 0 69 IRQ_TYPE_EDGE_RISING -+ 0 70 IRQ_TYPE_EDGE_RISING -+ 0 71 IRQ_TYPE_EDGE_RISING -+ 0 72 IRQ_TYPE_EDGE_RISING -+ 0 73 IRQ_TYPE_EDGE_RISING -+ 0 74 IRQ_TYPE_EDGE_RISING -+ 0 75 IRQ_TYPE_EDGE_RISING -+ 0 76 IRQ_TYPE_EDGE_RISING -+ 0 77 IRQ_TYPE_EDGE_RISING -+ 0 78 IRQ_TYPE_EDGE_RISING -+ 0 79 IRQ_TYPE_EDGE_RISING -+ 0 80 IRQ_TYPE_EDGE_RISING -+ 0 240 IRQ_TYPE_EDGE_RISING -+ 0 241 IRQ_TYPE_EDGE_RISING -+ 0 242 IRQ_TYPE_EDGE_RISING -+ 0 243 IRQ_TYPE_EDGE_RISING -+ 0 244 IRQ_TYPE_EDGE_RISING -+ 0 245 IRQ_TYPE_EDGE_RISING -+ 0 246 IRQ_TYPE_EDGE_RISING -+ 0 247 IRQ_TYPE_EDGE_RISING -+ 0 248 IRQ_TYPE_EDGE_RISING -+ 0 249 IRQ_TYPE_EDGE_RISING -+ 0 250 IRQ_TYPE_EDGE_RISING -+ 0 251 IRQ_TYPE_EDGE_RISING -+ 0 252 IRQ_TYPE_EDGE_RISING -+ 0 253 IRQ_TYPE_EDGE_RISING -+ 0 254 IRQ_TYPE_EDGE_RISING -+ 0 255 IRQ_TYPE_EDGE_RISING>; -+ -+ status = "disabled"; -+ -+ gmac0: gmac0 { -+ local-mac-address = [00 00 00 00 00 00]; -+ vlan_tag = <1 0x1f>; -+ }; -+ -+ gmac1: gmac1 { -+ local-mac-address = [00 00 00 00 00 00]; -+ qcom,phy_mdio_addr = <4>; -+ qcom,poll_required = <1>; -+ qcom,forced_speed = <1000>; -+ qcom,forced_duplex = <1>; -+ vlan_tag = <2 0x20>; -+ }; -+ }; -+ - usb3_ss_phy: ssphy@9a000 { - compatible = "qcom,usb-ss-ipq4019-phy"; - #phy-cells = <0>; diff --git a/target/linux/ipq40xx/patches-5.4/850-soc-add-qualcomm-syscon.patch b/target/linux/ipq40xx/patches-5.4/850-soc-add-qualcomm-syscon.patch deleted file mode 100644 index 17e9047dfb..0000000000 --- a/target/linux/ipq40xx/patches-5.4/850-soc-add-qualcomm-syscon.patch +++ /dev/null @@ -1,180 +0,0 @@ -From: Christian Lamparter -Subject: SoC: add qualcomm syscon ---- a/drivers/soc/qcom/Makefile -+++ b/drivers/soc/qcom/Makefile -@@ -20,6 +20,7 @@ obj-$(CONFIG_QCOM_SMP2P) += smp2p.o - obj-$(CONFIG_QCOM_SMSM) += smsm.o - obj-$(CONFIG_QCOM_SOCINFO) += socinfo.o - obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o -+obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o - obj-$(CONFIG_QCOM_APR) += apr.o - obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o - obj-$(CONFIG_QCOM_SDM845_LLCC) += llcc-sdm845.o ---- a/drivers/soc/qcom/Kconfig -+++ b/drivers/soc/qcom/Kconfig -@@ -183,6 +183,13 @@ config QCOM_SOCINFO - Say yes here to support the Qualcomm socinfo driver, providing - information about the SoC to user space. - -+config QCOM_TCSR -+ tristate "QCOM Top Control and Status Registers" -+ depends on ARCH_QCOM -+ help -+ Say y here to enable TCSR support. The TCSR provides control -+ functions for various peripherals. -+ - config QCOM_WCNSS_CTRL - tristate "Qualcomm WCNSS control driver" - depends on ARCH_QCOM || COMPILE_TEST ---- /dev/null -+++ b/drivers/soc/qcom/qcom_tcsr.c -@@ -0,0 +1,98 @@ -+/* -+ * Copyright (c) 2014, The Linux foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License rev 2 and -+ * only rev 2 as published by the free Software foundation. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or fITNESS fOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define TCSR_USB_PORT_SEL 0xb0 -+#define TCSR_USB_HSPHY_CONFIG 0xC -+ -+#define TCSR_ESS_INTERFACE_SEL_OFFSET 0x0 -+#define TCSR_ESS_INTERFACE_SEL_MASK 0xf -+ -+#define TCSR_WIFI0_GLB_CFG_OFFSET 0x0 -+#define TCSR_WIFI1_GLB_CFG_OFFSET 0x4 -+#define TCSR_PNOC_SNOC_MEMTYPE_M0_M2 0x4 -+ -+static int tcsr_probe(struct platform_device *pdev) -+{ -+ struct resource *res; -+ const struct device_node *node = pdev->dev.of_node; -+ void __iomem *base; -+ u32 val; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(base)) -+ return PTR_ERR(base); -+ -+ if (!of_property_read_u32(node, "qcom,usb-ctrl-select", &val)) { -+ dev_err(&pdev->dev, "setting usb port select = %d\n", val); -+ writel(val, base + TCSR_USB_PORT_SEL); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,usb-hsphy-mode-select", &val)) { -+ dev_info(&pdev->dev, "setting usb hs phy mode select = %x\n", val); -+ writel(val, base + TCSR_USB_HSPHY_CONFIG); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,ess-interface-select", &val)) { -+ u32 tmp = 0; -+ dev_info(&pdev->dev, "setting ess interface select = %x\n", val); -+ tmp = readl(base + TCSR_ESS_INTERFACE_SEL_OFFSET); -+ tmp = tmp & (~TCSR_ESS_INTERFACE_SEL_MASK); -+ tmp = tmp | (val&TCSR_ESS_INTERFACE_SEL_MASK); -+ writel(tmp, base + TCSR_ESS_INTERFACE_SEL_OFFSET); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,wifi_glb_cfg", &val)) { -+ dev_info(&pdev->dev, "setting wifi_glb_cfg = %x\n", val); -+ writel(val, base + TCSR_WIFI0_GLB_CFG_OFFSET); -+ writel(val, base + TCSR_WIFI1_GLB_CFG_OFFSET); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,wifi_noc_memtype_m0_m2", &val)) { -+ dev_info(&pdev->dev, -+ "setting wifi_noc_memtype_m0_m2 = %x\n", val); -+ writel(val, base + TCSR_PNOC_SNOC_MEMTYPE_M0_M2); -+ } -+ -+ return 0; -+} -+ -+static const struct of_device_id tcsr_dt_match[] = { -+ { .compatible = "qcom,tcsr", }, -+ { }, -+}; -+ -+MODULE_DEVICE_TABLE(of, tcsr_dt_match); -+ -+static struct platform_driver tcsr_driver = { -+ .driver = { -+ .name = "tcsr", -+ .owner = THIS_MODULE, -+ .of_match_table = tcsr_dt_match, -+ }, -+ .probe = tcsr_probe, -+}; -+ -+module_platform_driver(tcsr_driver); -+ -+MODULE_AUTHOR("Andy Gross "); -+MODULE_DESCRIPTION("QCOM TCSR driver"); -+MODULE_LICENSE("GPL v2"); ---- /dev/null -+++ b/include/dt-bindings/soc/qcom,tcsr.h -@@ -0,0 +1,48 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+#ifndef __DT_BINDINGS_QCOM_TCSR_H -+#define __DT_BINDINGS_QCOM_TCSR_H -+ -+#define TCSR_USB_SELECT_USB3_P0 0x1 -+#define TCSR_USB_SELECT_USB3_P1 0x2 -+#define TCSR_USB_SELECT_USB3_DUAL 0x3 -+ -+/* IPQ40xx HS PHY Mode Select */ -+#define TCSR_USB_HSPHY_HOST_MODE 0x00E700E7 -+#define TCSR_USB_HSPHY_DEVICE_MODE 0x00C700E7 -+ -+/* IPQ40xx ess interface mode select */ -+#define TCSR_ESS_PSGMII 0 -+#define TCSR_ESS_PSGMII_RGMII5 1 -+#define TCSR_ESS_PSGMII_RMII0 2 -+#define TCSR_ESS_PSGMII_RMII1 4 -+#define TCSR_ESS_PSGMII_RMII0_RMII1 6 -+#define TCSR_ESS_PSGMII_RGMII4 9 -+ -+/* -+ * IPQ40xx WiFi Global Config -+ * Bit 30:AXID_EN -+ * Enable AXI master bus Axid translating to confirm all txn submitted by order -+ * Bit 24: Use locally generated socslv_wxi_bvalid -+ * 1: use locally generate socslv_wxi_bvalid for performance. -+ * 0: use SNOC socslv_wxi_bvalid. -+ */ -+#define TCSR_WIFI_GLB_CFG 0x41000000 -+ -+/* IPQ40xx MEM_TYPE_SEL_M0_M2 Select Bit 26:24 - 2 NORMAL */ -+#define TCSR_WIFI_NOC_MEMTYPE_M0_M2 0x02222222 -+ -+/* TCSR A/B REG */ -+#define IPQ806X_TCSR_REG_A_ADM_CRCI_MUX_SEL 0 -+#define IPQ806X_TCSR_REG_B_ADM_CRCI_MUX_SEL 1 -+ -+#endif diff --git a/target/linux/ipq40xx/patches-5.4/900-dts-ipq4019-ap-dk01.1.patch b/target/linux/ipq40xx/patches-5.4/900-dts-ipq4019-ap-dk01.1.patch deleted file mode 100644 index 5a245eb431..0000000000 --- a/target/linux/ipq40xx/patches-5.4/900-dts-ipq4019-ap-dk01.1.patch +++ /dev/null @@ -1,176 +0,0 @@ ---- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi -@@ -15,6 +15,7 @@ - */ - - #include "qcom-ipq4019.dtsi" -+#include - - / { - model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1"; -@@ -29,6 +30,32 @@ - }; - - soc { -+ tcsr@194b000 { -+ /* select hostmode */ -+ compatible = "qcom,tcsr"; -+ reg = <0x194b000 0x100>; -+ qcom,usb-hsphy-mode-select = ; -+ status = "okay"; -+ }; -+ -+ ess_tcsr@1953000 { -+ compatible = "qcom,tcsr"; -+ reg = <0x1953000 0x1000>; -+ qcom,ess-interface-select = ; -+ }; -+ -+ tcsr@1949000 { -+ compatible = "qcom,tcsr"; -+ reg = <0x1949000 0x100>; -+ qcom,wifi_glb_cfg = ; -+ }; -+ -+ tcsr@1957000 { -+ compatible = "qcom,tcsr"; -+ reg = <0x1957000 0x100>; -+ qcom,wifi_noc_memtype_m0_m2 = ; -+ }; -+ - rng@22000 { - status = "ok"; - }; -@@ -74,14 +101,6 @@ - pinctrl-names = "default"; - status = "ok"; - cs-gpios = <&tlmm 54 0>; -- -- mx25l25635e@0 { -- #address-cells = <1>; -- #size-cells = <1>; -- reg = <0>; -- compatible = "mx25l25635e"; -- spi-max-frequency = <24000000>; -- }; - }; - - serial@78af000 { -@@ -109,5 +128,41 @@ - wifi@a800000 { - status = "ok"; - }; -+ -+ mdio@90000 { -+ status = "okay"; -+ }; -+ -+ ess-switch@c000000 { -+ status = "okay"; -+ }; -+ -+ ess-psgmii@98000 { -+ status = "okay"; -+ }; -+ -+ edma@c080000 { -+ status = "okay"; -+ }; -+ -+ usb3_ss_phy: ssphy@9a000 { -+ status = "okay"; -+ }; -+ -+ usb3_hs_phy: hsphy@a6000 { -+ status = "okay"; -+ }; -+ -+ usb3: usb3@8af8800 { -+ status = "okay"; -+ }; -+ -+ usb2_hs_phy: hsphy@a8000 { -+ status = "okay"; -+ }; -+ -+ usb2: usb2@60f8800 { -+ status = "okay"; -+ }; - }; - }; ---- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1-c1.dts -+++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1-c1.dts -@@ -18,5 +18,73 @@ - - / { - model = "Qualcomm Technologies, Inc. IPQ40xx/AP-DK01.1-C1"; -+ compatible = "qcom,ap-dk01.1-c1", "qcom,ap-dk01.2-c1"; - -+ memory { -+ device_type = "memory"; -+ reg = <0x80000000 0x10000000>; -+ }; -+}; -+ -+&blsp1_spi1 { -+ mx25l25635f@0 { -+ compatible = "mx25l25635f", "jedec,spi-nor"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ reg = <0>; -+ spi-max-frequency = <24000000>; -+ -+ SBL1@0 { -+ label = "SBL1"; -+ reg = <0x0 0x40000>; -+ read-only; -+ }; -+ MIBIB@40000 { -+ label = "MIBIB"; -+ reg = <0x40000 0x20000>; -+ read-only; -+ }; -+ QSEE@60000 { -+ label = "QSEE"; -+ reg = <0x60000 0x60000>; -+ read-only; -+ }; -+ CDT@c0000 { -+ label = "CDT"; -+ reg = <0xc0000 0x10000>; -+ read-only; -+ }; -+ DDRPARAMS@d0000 { -+ label = "DDRPARAMS"; -+ reg = <0xd0000 0x10000>; -+ read-only; -+ }; -+ APPSBLENV@e0000 { -+ label = "APPSBLENV"; -+ reg = <0xe0000 0x10000>; -+ read-only; -+ }; -+ APPSBL@f0000 { -+ label = "APPSBL"; -+ reg = <0xf0000 0x80000>; -+ read-only; -+ }; -+ ART@170000 { -+ label = "ART"; -+ reg = <0x170000 0x10000>; -+ read-only; -+ }; -+ kernel@180000 { -+ label = "kernel"; -+ reg = <0x180000 0x400000>; -+ }; -+ rootfs@580000 { -+ label = "rootfs"; -+ reg = <0x580000 0x1600000>; -+ }; -+ firmware@180000 { -+ label = "firmware"; -+ reg = <0x180000 0x1a00000>; -+ }; -+ }; - }; diff --git a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch deleted file mode 100644 index 4270418d6c..0000000000 --- a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ /dev/null @@ -1,82 +0,0 @@ -From a10fab12a927e60b7141a602e740d70cb4d09e4a Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 11:03:18 +0100 -Subject: [PATCH] arm: boot: add dts files - -Signed-off-by: John Crispin ---- - arch/arm/boot/dts/Makefile | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -837,11 +837,69 @@ dtb-$(CONFIG_ARCH_QCOM) += \ - qcom-apq8074-dragonboard.dtb \ - qcom-apq8084-ifc6540.dtb \ - qcom-apq8084-mtp.dtb \ -+ qcom-ipq4018-a42.dtb \ -+ qcom-ipq4018-ap120c-ac.dtb \ -+ qcom-ipq4018-dap-2610.dtb \ -+ qcom-ipq4018-cs-w3-wd1200g-eup.dtb \ -+ qcom-ipq4018-magic-2-wifi-next.dtb \ -+ qcom-ipq4018-ea6350v3.dtb \ -+ qcom-ipq4018-eap1300.dtb \ -+ qcom-ipq4018-ecw5211.dtb \ -+ qcom-ipq4018-emd1.dtb \ -+ qcom-ipq4018-emr3500.dtb \ -+ qcom-ipq4018-ens620ext.dtb \ -+ qcom-ipq4018-ex6100v2.dtb \ -+ qcom-ipq4018-ex6150v2.dtb \ -+ qcom-ipq4018-fritzbox-4040.dtb \ -+ qcom-ipq4018-gl-ap1300.dtb \ -+ qcom-ipq4018-jalapeno.dtb \ -+ qcom-ipq4018-meshpoint-one.dtb \ -+ qcom-ipq4018-hap-ac2.dtb \ -+ qcom-ipq4018-sxtsq-5-ac.dtb \ -+ qcom-ipq4018-nbg6617.dtb \ -+ qcom-ipq4019-oap100.dtb \ -+ qcom-ipq4018-pa1200.dtb \ -+ qcom-ipq4018-rt-ac58u.dtb \ -+ qcom-ipq4018-rutx10.dtb \ -+ qcom-ipq4018-wac510.dtb \ -+ qcom-ipq4018-wre6606.dtb \ -+ qcom-ipq4018-wrtq-329acn.dtb \ - qcom-ipq4019-ap.dk01.1-c1.dtb \ - qcom-ipq4019-ap.dk04.1-c1.dtb \ - qcom-ipq4019-ap.dk04.1-c3.dtb \ - qcom-ipq4019-ap.dk07.1-c1.dtb \ - qcom-ipq4019-ap.dk07.1-c2.dtb \ -+ qcom-ipq4019-a62.dtb \ -+ qcom-ipq4019-cm520-79f.dtb \ -+ qcom-ipq4019-ea8300.dtb \ -+ qcom-ipq4019-eap2200.dtb \ -+ qcom-ipq4019-fritzbox-7530.dtb \ -+ qcom-ipq4019-fritzrepeater-1200.dtb \ -+ qcom-ipq4019-fritzrepeater-3000.dtb \ -+ qcom-ipq4019-hap-ac3.dtb \ -+ qcom-ipq4019-map-ac2200.dtb \ -+ qcom-ipq4019-lhgg-60ad.dtb \ -+ qcom-ipq4019-mr8300.dtb \ -+ qcom-ipq4019-e2600ac-c1.dtb \ -+ qcom-ipq4019-e2600ac-c2.dtb \ -+ qcom-ipq4019-habanero-dvk.dtb \ -+ qcom-ipq4019-pa2200.dtb \ -+ qcom-ipq4019-rbr50.dtb \ -+ qcom-ipq4019-rbs50.dtb \ -+ qcom-ipq4019-rtl30vw.dtb \ -+ qcom-ipq4019-srr60.dtb \ -+ qcom-ipq4019-srs60.dtb \ -+ qcom-ipq4019-u4019-32m.dtb \ -+ qcom-ipq4019-wpj419.dtb \ -+ qcom-ipq4019-wtr-m2133hp.dtb \ -+ qcom-ipq4028-wpj428.dtb \ -+ qcom-ipq4029-ap-303.dtb \ -+ qcom-ipq4029-ap-303h.dtb \ -+ qcom-ipq4029-ap-365.dtb \ -+ qcom-ipq4029-gl-b1300.dtb \ -+ qcom-ipq4019-gl-b2200.dtb \ -+ qcom-ipq4029-gl-s1300.dtb \ -+ qcom-ipq4029-mr33.dtb \ - qcom-ipq8064-ap148.dtb \ - qcom-msm8660-surf.dtb \ - qcom-msm8960-cdp.dtb \ diff --git a/target/linux/ipq40xx/patches-5.4/902-dts-ipq4019-ap-dk04.1.patch b/target/linux/ipq40xx/patches-5.4/902-dts-ipq4019-ap-dk04.1.patch deleted file mode 100644 index ca32144846..0000000000 --- a/target/linux/ipq40xx/patches-5.4/902-dts-ipq4019-ap-dk04.1.patch +++ /dev/null @@ -1,167 +0,0 @@ ---- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk04.1.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk04.1.dtsi -@@ -17,53 +17,79 @@ - stdout-path = "serial0:115200n8"; - }; - -- memory { -- device_type = "memory"; -- reg = <0x80000000 0x10000000>; /* 256MB */ -- }; -- - soc { -+ rng@22000 { -+ status = "okay"; -+ }; -+ - pinctrl@1000000 { - serial_0_pins: serial0-pinmux { -- pins = "gpio16", "gpio17"; -- function = "blsp_uart0"; -- bias-disable; -+ mux { -+ pins = "gpio16", "gpio17"; -+ function = "blsp_uart0"; -+ bias-disable; -+ }; - }; - - serial_1_pins: serial1-pinmux { -- pins = "gpio8", "gpio9", -- "gpio10", "gpio11"; -- function = "blsp_uart1"; -- bias-disable; -+ mux { -+ pins = "gpio8", "gpio9"; -+ function = "blsp_uart1"; -+ bias-disable; -+ }; - }; - - spi_0_pins: spi-0-pinmux { - pinmux { - function = "blsp_spi0"; - pins = "gpio13", "gpio14", "gpio15"; -- bias-disable; - }; - pinmux_cs { - function = "gpio"; - pins = "gpio12"; -+ }; -+ pinconf { -+ pins = "gpio13", "gpio14", "gpio15"; -+ drive-strength = <12>; -+ bias-disable; -+ }; -+ pinconf_cs { -+ pins = "gpio12"; -+ drive-strength = <2>; - bias-disable; - output-high; - }; - }; - - i2c_0_pins: i2c-0-pinmux { -- pins = "gpio20", "gpio21"; -- function = "blsp_i2c0"; -- bias-disable; -+ pinmux { -+ function = "blsp_i2c0"; -+ pins = "gpio10", "gpio11"; -+ }; -+ pinconf { -+ pins = "gpio10", "gpio11"; -+ drive-strength = <16>; -+ bias-disable; -+ }; - }; - - nand_pins: nand-pins { -- pins = "gpio53", "gpio55", "gpio56", -- "gpio57", "gpio58", "gpio59", -- "gpio60", "gpio62", "gpio63", -- "gpio64", "gpio65", "gpio66", -- "gpio67", "gpio68", "gpio69"; -- function = "qpic"; -+ pullups { -+ pins = "gpio52", "gpio53", "gpio58", -+ "gpio59"; -+ function = "qpic"; -+ bias-pull-up; -+ }; -+ -+ pulldowns { -+ pins = "gpio54", "gpio55", "gpio56", -+ "gpio57", "gpio60", "gpio61", -+ "gpio62", "gpio63", "gpio64", -+ "gpio65", "gpio66", "gpio67", -+ "gpio68", "gpio69"; -+ function = "qpic"; -+ bias-pull-down; -+ }; - }; - }; - -@@ -89,11 +115,11 @@ - status = "ok"; - cs-gpios = <&tlmm 12 0>; - -- m25p80@0 { -+ mx25l25635e@0 { - #address-cells = <1>; - #size-cells = <1>; - reg = <0>; -- compatible = "n25q128a11"; -+ compatible = "mx25l25635e"; - spi-max-frequency = <24000000>; - }; - }; -@@ -103,9 +129,48 @@ - perst-gpio = <&tlmm 38 0x1>; - }; - -+ i2c0: i2c@78b7000 { /* BLSP1 QUP2 */ -+ pinctrl-0 = <&i2c_0_pins>; -+ pinctrl-names = "default"; -+ -+ status = "okay"; -+ }; -+ - qpic-nand@79b0000 { - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - }; -+ -+ usb3_ss_phy: ssphy@9a000 { -+ status = "okay"; -+ }; -+ -+ usb3_hs_phy: hsphy@a6000 { -+ status = "okay"; -+ }; -+ -+ usb3: usb3@8af8800 { -+ status = "okay"; -+ }; -+ -+ usb2_hs_phy: hsphy@a8000 { -+ status = "okay"; -+ }; -+ -+ usb2: usb2@60f8800 { -+ status = "okay"; -+ }; -+ -+ cryptobam: dma@8e04000 { -+ status = "okay"; -+ }; -+ -+ crypto@8e3a000 { -+ status = "okay"; -+ }; -+ -+ watchdog@b017000 { -+ status = "okay"; -+ }; - }; - }; diff --git a/target/linux/ipq40xx/patches-5.4/997-device_tree_cmdline.patch b/target/linux/ipq40xx/patches-5.4/997-device_tree_cmdline.patch deleted file mode 100644 index 3cc032fdd2..0000000000 --- a/target/linux/ipq40xx/patches-5.4/997-device_tree_cmdline.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/drivers/of/fdt.c -+++ b/drivers/of/fdt.c -@@ -1059,6 +1059,9 @@ int __init early_init_dt_scan_chosen(uns - p = of_get_flat_dt_prop(node, "bootargs", &l); - if (p != NULL && l > 0) - strlcpy(data, p, min(l, COMMAND_LINE_SIZE)); -+ p = of_get_flat_dt_prop(node, "bootargs-append", &l); -+ if (p != NULL && l > 0) -+ strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); - - /* - * CONFIG_CMDLINE is meant to be a default in case nothing else From f8bc8fa3778648c31e46ff3d8c277b473f663fae Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Jan 2022 11:22:31 +0100 Subject: [PATCH 002/144] build: change PYTHON to python3 On recent macOS, /usr/bin/python3 is a wrapper that finds the right python executable It checks argv[0] to determine if python2 or python3 should be called. Always execute it as python3 to ensure it calls the right version Signed-off-by: Felix Fietkau --- rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules.mk b/rules.mk index 57c3bca7d9..8d4f619211 100644 --- a/rules.mk +++ b/rules.mk @@ -274,7 +274,7 @@ BASH:=bash TAR:=tar FIND:=find PATCH:=patch -PYTHON:=python +PYTHON:=python3 INSTALL_BIN:=install -m0755 INSTALL_SUID:=install -m4755 From 1404b3c3e6ac602887d4ba4854902d1db99871d3 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Jan 2022 11:23:57 +0100 Subject: [PATCH 003/144] build: increase scan depth for finding targets This allows targets to be put into target/linux/feeds Signed-off-by: Felix Fietkau --- include/toplevel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/toplevel.mk b/include/toplevel.mk index f5a2593a10..1e543ebcb9 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -77,7 +77,7 @@ prepare-tmpinfo: FORCE @+$(MAKE) -r -s staging_dir/host/.prereq-build $(PREP_MK) mkdir -p tmp/info $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA="" - $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1" + $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=3 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1" for type in package target; do \ f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ [ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ From 0bdf8d12063b9be1cd73798f54a53279d21c9c95 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Jan 2022 13:16:00 +0100 Subject: [PATCH 004/144] scripts/feeds: fix installing targets without explicitly specifying the feed Add similar code to what is done on packages Signed-off-by: Felix Fietkau --- scripts/feeds | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/feeds b/scripts/feeds index f63b4f0951..7392ddf944 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -499,6 +499,8 @@ sub install_target { my $feed = shift; my $name = shift; + $feed = lookup_target($feed, $name); + $installed_targets{$name} and return 0; $feed = $feed_cache{$feed->[1]}->[2]; From ebc36ebb2349ef5d492dd2bd5be962bac26bb19a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Jan 2022 13:28:36 +0100 Subject: [PATCH 005/144] scripts/feeds: install targets to target/linux/feeds and support overriding Signed-off-by: Felix Fietkau --- scripts/feeds | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/scripts/feeds b/scripts/feeds index 7392ddf944..d8bbd48663 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -434,14 +434,16 @@ sub do_install_target($) { $path =~ s/\/Makefile$//; my $name = $path; $name =~ s/.*\///; - my $dest = "./target/linux/$name"; + my $dest = "./target/linux/feeds/$name"; + + -d "./target/linux/feeds" or mkdir "./target/linux/feeds"; -e $dest and do { warn "Path $dest already exists"; return 1; }; - system("ln -sf ../../$path ./target/linux/"); + system("ln -sf ../../../$path ./target/linux/feeds/"); } else { warn "Target is not valid\n"; return 1; @@ -498,18 +500,34 @@ sub is_core_src($) { sub install_target { my $feed = shift; my $name = shift; + my $force = shift; $feed = lookup_target($feed, $name); + my $feed_name = $feed->[1]; - $installed_targets{$name} and return 0; + -e "target/linux/feeds/$name" and return 0; - $feed = $feed_cache{$feed->[1]}->[2]; + # enable force flag if feed src line was declared with --force + if (exists($feed->[3]{force})) { + $force = 1; + } + + $feed = $feed_cache{$feed_name}->[2]; $feed or return 0; my $target = $feed->{$name}; $target or return 0; - warn "Installing target '$name'\n"; + if (-e "target/linux/$name") { + if ($force) { + warn "Overriding target '$name' with version from '$feed_name'\n"; + } else { + warn "WARNING: Not overriding core target '$name'; use -f to force\n"; + return 0; + } + } else { + warn "Installing target '$name'\n"; + } return do_install_target($target); } @@ -620,7 +638,7 @@ sub install_target_or_package { my $force = shift; lookup_target($feed, $name) and do { - return install_target($feed, $name); + return install_target($feed, $name, $force); }; lookup_src($feed, $name) and do { @@ -736,7 +754,7 @@ sub uninstall { } get_installed(); while ($name = shift @ARGV) { - my $target = "target/linux/$name"; + my $target = "target/linux/feeds/$name"; -l "$target" and do { uninstall_target($target); $uninstall = 1; @@ -903,7 +921,7 @@ my %commands = ( 'uninstall' => \&uninstall, 'feed_config' => \&feed_config, 'clean' => sub { - system("rm -rf ./feeds ./package/feeds"); + system("rm -rf ./feeds ./package/feeds ./target/linux/feeds"); } ); From f5865452ac806f43e34a29f89f5b8ab8070e7813 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 25 Jan 2022 00:05:43 +0000 Subject: [PATCH 006/144] mediatek: mt7623: include regular AHCI PCI driver The legacy image for the UniElec U7623-02 until now included kmod-ata-ahci-mtk. The MT7623 chip doesn't have that IP and that board uses a PCIe-connected AHCI controller for the SATA port and mSATA-pins of the mPCIe socket. Hence include kmod-ata-ahci instead. Signed-off-by: Daniel Golle --- target/linux/mediatek/image/mt7623.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 89c771e5a0..16f59790b0 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -170,7 +170,7 @@ define Device/unielec_u7623-02-emmc-512m-legacy KERNEL := kernel-bin | append-dtb | uImage none KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \ - mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \ + mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci \ partx-utils IMAGES := sysupgrade.bin.gz IMAGE/sysupgrade.bin.gz := append-kernel |\ From d8c5406a93d7d99c5abbec6d3a042922b6b4f8e2 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Tue, 25 Jan 2022 10:53:20 +0100 Subject: [PATCH 007/144] meta: create FUNDING.yml By adding this file a badge should appear in the GitHub web interface to motivate people donate money to the OpenWrt project. Signed-off-by: Paul Spooren --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..4d7a726269 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: [ 'https://openwrt.org/donate' ] From 2b583ab8a74a6bd41f1c9629b3b66ba561d6fceb Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 25 Jan 2022 21:46:54 +0100 Subject: [PATCH 008/144] rockchip: disable UHS modes for NanoPi R4S The NanoPi R4S leaves the SD card in 1.8V signalling when rebooting while U-Boot requires the card to be in 3.3V mode. Remove UHS support from the SD controller so the card remains in 3.3V mode. This reduces transfer speeds but ensures a reboot whether from userspace or following a kernel panic is always working. Signed-off-by: David Bauer --- .../105-nanopi-r4s-sd-signalling.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 target/linux/rockchip/patches-5.10/105-nanopi-r4s-sd-signalling.patch diff --git a/target/linux/rockchip/patches-5.10/105-nanopi-r4s-sd-signalling.patch b/target/linux/rockchip/patches-5.10/105-nanopi-r4s-sd-signalling.patch new file mode 100644 index 0000000000..a04c14b70a --- /dev/null +++ b/target/linux/rockchip/patches-5.10/105-nanopi-r4s-sd-signalling.patch @@ -0,0 +1,26 @@ +From: David Bauer +Subject: arm64: dts: rockchip: disable UHS modes for NanoPi R4S + +The NanoPi R4S leaves the SD card in 1.8V signalling when rebooting +while U-Boot requires the card to be in 3.3V mode. + +Remove UHS support from the SD controller so the card remains in 3.3V +mode. This reduces transfer speeds but ensures a reboot whether from +userspace or following a kernel panic is always working. + +Signed-off-by: David Bauer + +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +@@ -121,6 +121,11 @@ + status = "disabled"; + }; + ++&sdmmc { ++ /delete-property/ sd-uhs-sdr104; ++ cap-sd-highspeed; ++}; ++ + &u2phy0_host { + phy-supply = <&vdd_5v>; + }; From ef4c97576b5a61b12190f54c52906bac2433932c Mon Sep 17 00:00:00 2001 From: Tiago Gaspar Date: Sun, 23 Jan 2022 00:44:01 +0000 Subject: [PATCH 009/144] netfilter: correct some dependencies nf-nathelper-extra and nf-conntrack-netlink had iptables related dependencies, yet, when looking for the respective kernel symbols and checking it's dependencies it was confirmed that iptables wasn't required and that these were either it's own moodule or tool independent (nftables or iptables). Correct these and make sure no unneeded extras are pulled in. Signed-off-by: Tiago Gaspar --- package/kernel/linux/modules/netfilter.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index e2bb1d0681..f204b257d1 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -542,7 +542,7 @@ define KernelPackage/nf-nathelper-extra KCONFIG:=$(KCONFIG_NF_NATHELPER_EXTRA) FILES:=$(foreach mod,$(NF_NATHELPER_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_NATHELPER_EXTRA-m))) - DEPENDS:=+kmod-nf-nat +kmod-lib-textsearch +kmod-ipt-raw +kmod-asn1-decoder + DEPENDS:=+kmod-nf-nat +kmod-lib-textsearch +kmod-asn1-decoder endef define KernelPackage/nf-nathelper-extra/description @@ -1004,7 +1004,7 @@ define KernelPackage/nf-conntrack-netlink FILES:=$(LINUX_DIR)/net/netfilter/nf_conntrack_netlink.ko KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NETFILTER_NETLINK_GLUE_CT=y AUTOLOAD:=$(call AutoProbe,nf_conntrack_netlink) - $(call AddDepends/nfnetlink,+kmod-ipt-conntrack) + $(call AddDepends/nfnetlink,+kmod-nf-conntrack) endef define KernelPackage/nf-conntrack-netlink/description From 0ac0840088d538981a0df573bf58899e3ee9dbf7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 26 Jan 2022 13:52:07 +0100 Subject: [PATCH 010/144] sdk: ship llvm toolchain This allows ebpf packages like qosify to be built with it Signed-off-by: Felix Fietkau --- target/sdk/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/sdk/Makefile b/target/sdk/Makefile index 7d7f09b514..0606621192 100644 --- a/target/sdk/Makefile +++ b/target/sdk/Makefile @@ -34,8 +34,7 @@ EXCLUDE_DIRS:= \ *.install.flags \ *.install \ */doc \ - */share/locale \ - */llvm-bpf* + */share/locale SDK_DIRS = \ $(STAGING_SUBDIR_HOST) \ From 53ebacacf93278c6e71052eb5b3708c599129e55 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 27 Jan 2022 13:20:15 +0100 Subject: [PATCH 011/144] tools/fakeroot: fix unresolved symbols on arm64 macOS The $INODE64 symbol variants are not present, since the base system always uses 64-bit file offsets Signed-off-by: Felix Fietkau --- .../patches/500-macos_arm64_compile_fix.patch | 53 +++++++++++++++---- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/tools/fakeroot/patches/500-macos_arm64_compile_fix.patch b/tools/fakeroot/patches/500-macos_arm64_compile_fix.patch index a3731b9e99..271dceef91 100644 --- a/tools/fakeroot/patches/500-macos_arm64_compile_fix.patch +++ b/tools/fakeroot/patches/500-macos_arm64_compile_fix.patch @@ -1,5 +1,3 @@ -diff --git a/communicate.c b/communicate.c -index e2699a2..21e5366 100644 --- a/communicate.c +++ b/communicate.c @@ -24,7 +24,12 @@ @@ -16,8 +14,6 @@ index e2699a2..21e5366 100644 #endif #include "communicate.h" -diff --git a/communicate.h b/communicate.h -index 3f9ca39..a586108 100644 --- a/communicate.h +++ b/communicate.h @@ -91,6 +91,10 @@ @@ -31,8 +27,6 @@ index 3f9ca39..a586108 100644 #ifndef FAKEROOT_FAKENET # define FAKEROOTKEY_ENV "FAKEROOTKEY" #endif /* ! FAKEROOT_FAKENET */ -diff --git a/faked.c b/faked.c -index a970184..ea51a23 100644 --- a/faked.c +++ b/faked.c @@ -84,7 +84,12 @@ @@ -49,8 +43,6 @@ index a970184..ea51a23 100644 #endif #include "config.h" -diff --git a/libfakeroot.c b/libfakeroot.c -index c967d5d..836337d 100644 --- a/libfakeroot.c +++ b/libfakeroot.c @@ -38,7 +38,12 @@ @@ -67,8 +59,6 @@ index c967d5d..836337d 100644 /* The helper _unix2003 version of this file calls a few functions in this file that are marked with static_nonapple so that needs to become private instead -diff --git a/libfakeroot_unix2003.c b/libfakeroot_unix2003.c -index e1e19b6..f32bfec 100644 --- a/libfakeroot_unix2003.c +++ b/libfakeroot_unix2003.c @@ -18,7 +18,11 @@ @@ -84,3 +74,46 @@ index e1e19b6..f32bfec 100644 /* This file is for 32-bit symbols which have the "$UNIX2003" version, i.e. +--- a/libfakeroot_inode64.c ++++ b/libfakeroot_inode64.c +@@ -25,7 +25,7 @@ + #include "config.h" + #include "communicate.h" + +-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && !__DARWIN_ONLY_64_BIT_INO_T + + #include + #include +--- a/wrapfunc.inp ++++ b/wrapfunc.inp +@@ -48,9 +48,11 @@ getattrlist$UNIX2003;int;(const char *pa + #endif + #endif + #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ++#if !__DARWIN_ONLY_64_BIT_INO_T + lstat$INODE64;int;(const char *file_name, struct stat *buf);(file_name, buf) + stat$INODE64;int;(const char *file_name, struct stat *buf);(file_name, buf) + fstat$INODE64;int;(int fd, struct stat *buf);(fd, buf) ++#endif + posix_spawn;int;(pid_t * __restrict pid, const char * __restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t * __restrict attrp, char *const argv[ __restrict], char *const envp[ __restrict]);(pid, path, file_actions, attrp, argv, envp) + posix_spawnp;int;(pid_t * __restrict pid, const char * __restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t * __restrict attrp, char *const argv[ __restrict], char *const envp[ __restrict]);(pid, path, file_actions, attrp, argv, envp) + #endif +@@ -232,7 +234,7 @@ facl;int;(int fd, int cmd, int cnt, void + #ifdef HAVE_FTS_READ + fts_read;FTSENT *;(FTS *ftsp);(ftsp) + #ifdef __APPLE__ +-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && !__DARWIN_ONLY_64_BIT_INO_T + fts_read$INODE64;FTSENT *;(FTS *ftsp);(ftsp) + #endif + #endif /* ifdef __APPLE__ */ +@@ -240,7 +242,7 @@ fts_read$INODE64;FTSENT *;(FTS *ftsp);(f + #ifdef HAVE_FTS_CHILDREN + fts_children;FTSENT *;(FTS *ftsp, int options);(ftsp, options) + #ifdef __APPLE__ +-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && !__DARWIN_ONLY_64_BIT_INO_T + fts_children$INODE64;FTSENT *;(FTS *ftsp, int options);(ftsp, options) + #endif + #endif /* ifdef __APPLE__ */ From 1d4750fd50eeadad640fb62e1b11bf4cdde39dd1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 27 Jan 2022 13:21:04 +0100 Subject: [PATCH 012/144] tools/coreutils: build chown On ARM macOS, injecting extra shared libraries does not work for system binaries. This causes fakeroot to fail for chown calls Signed-off-by: Felix Fietkau --- tools/coreutils/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile index 537ece57cc..fc5c259d8f 100644 --- a/tools/coreutils/Makefile +++ b/tools/coreutils/Makefile @@ -16,7 +16,7 @@ PKG_HASH:=4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa HOST_BUILD_PARALLEL := 1 -BUILD_PROGRAMS = date readlink touch ln +BUILD_PROGRAMS = date readlink touch ln chown include $(INCLUDE_DIR)/host-build.mk From 3869ccbcc891a7185550a2a422e2db01fd994b7d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 27 Jan 2022 13:25:39 +0100 Subject: [PATCH 013/144] tools: build bash on macOS and use it for ipkg-build On macOS, system binaries silently drop the environment variables for injecting extra shared libraries (used by fakeroot). This is done for security reasons. Work around this by building bash from source, so that it gets an ad-hoc signature and does not have these restrictions Signed-off-by: Felix Fietkau --- include/package-ipkg.mk | 2 +- tools/Makefile | 3 +++ tools/bash/Makefile | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tools/bash/Makefile diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 362a0e2a8b..3063a86a28 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -264,7 +264,7 @@ $(_endef) endif $(INSTALL_DIR) $$(PDIR_$(1)) - $(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1)) + $(FAKEROOT) $(STAGING_DIR_HOST)/bin/bash $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1)) @[ -f $$(IPKG_$(1)) ] $(1)-clean: diff --git a/tools/Makefile b/tools/Makefile index 686d5294d3..681344a014 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -80,6 +80,9 @@ ifneq ($(HOST_OS),Linux) $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile tools-y += coreutils endif +ifeq ($(HOST_OS),Darwin) + tools-y += bash +endif ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) $(foreach tool, $(filter-out xz zstd pkgconf patch ninja meson libressl cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) diff --git a/tools/bash/Makefile b/tools/bash/Makefile new file mode 100644 index 0000000000..7c25b83327 --- /dev/null +++ b/tools/bash/Makefile @@ -0,0 +1,21 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=bash +PKG_CPE_ID:=cpe:/a:gnu:bash +PKG_VERSION:=5.1.16 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@GNU/bash +PKG_HASH:=5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558 + +HOST_BUILD_PARALLEL := 1 + +include $(INCLUDE_DIR)/host-build.mk + +$(eval $(call HostBuild)) From 17135ae0917b54f8ba30a834b2cf8bbcfc0778e6 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sat, 8 Jan 2022 08:45:29 -0800 Subject: [PATCH 014/144] perf: Depend on libbfd and libopcodes when enabled bpftool will enabled libbfd and libopcodes which gets picked up by perf as libraries to link against. Add those missing dependencies when either of these packages are enabled. Signed-off-by: Florian Fainelli --- package/devel/perf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index bbf3aaf9ce..eacdd0e2e5 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -27,7 +27,8 @@ include $(INCLUDE_DIR)/nls.mk define Package/perf SECTION:=devel CATEGORY:=Development - DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +libpthread +librt +objdump @!IN_SDK @!TARGET_arc770 @KERNEL_PERF_EVENTS + DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +libpthread +librt +objdump @!IN_SDK @!TARGET_arc770 @KERNEL_PERF_EVENTS \ + +PACKAGE_libbfd:libbfd +PACKAGE_libopcodes:libopcodes TITLE:=Linux performance monitoring tool VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE) URL:=http://www.kernel.org From ebeb003470952ca08c25e650a35926fad25ebd91 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 28 Jan 2022 12:58:45 +0000 Subject: [PATCH 015/144] firmware-utils: update to git HEAD of 2022-01-28 6c95945 ptgen: add Chromium OS kernel partition support 8e7274e cros-vbutil: add Chrome OS vboot kernel-signing utility Signed-off-by: Daniel Golle --- tools/firmware-utils/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index f6c699bd28..f71e1b545f 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2022-01-16 -PKG_SOURCE_VERSION:=d885b49436b18cb423b4612465e10ea2b3f5db79 -PKG_MIRROR_HASH:=a35791aa76d2da1c66a57c0189804cad65e63e58910233cc8bd87496e3cc01df +PKG_SOURCE_DATE:=2022-01-28 +PKG_SOURCE_VERSION:=8e7274e02fdc6f2cb61b415d6e5b2e1c7e977aa1 +PKG_MIRROR_HASH:=bf3e3f9e37b156107d7bc2ce666112db2b3ef6580b1f47bce96311da312fe169 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From c06482489d79e9250efbee5e9238c8883a0e6bea Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Fri, 28 Jan 2022 19:46:51 +0800 Subject: [PATCH 016/144] kernel: 5.10: drop broken-flash-reset patch Flash accessing instruction templates are determined during probe since v5.6 for spimem-dirmap support in spi-nor driver in upstream commit: df5c21002cf4 ("mtd: spi-nor: use spi-mem dirmap API") As a result, changing bus_width on the fly doesn't work anymore and this patch will cause executing spi-mem ops with 3-byte address on 16-32M flash area. We can't easily revert that behavioral change upstream so drop the patch to prevent u-boot and eeprom from being erased. Fixes: b10d604459("kernel: add linux 5.10 support") Reported-by: Frank Di Matteo Signed-off-by: Chuanhong Guo --- ...or-rework-broken-flash-reset-support.patch | 180 ------------------ ...or-Add-support-for-BoHong-bh25q128as.patch | 2 +- 2 files changed, 1 insertion(+), 181 deletions(-) delete mode 100644 target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch diff --git a/target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch b/target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch deleted file mode 100644 index d0e9963b93..0000000000 --- a/target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch +++ /dev/null @@ -1,180 +0,0 @@ -From ea92cbb50a78404e29de2cc3999a240615ffb1c8 Mon Sep 17 00:00:00 2001 -From: Chuanhong Guo -Date: Mon, 6 Apr 2020 17:58:48 +0800 -Subject: [PATCH] mtd: spi-nor: rework broken-flash-reset support - -Instead of resetting flash to 3B address on remove hook, this -implementation only enters 4B mode when needed, which prevents -more unexpected reboot stuck. This implementation makes it only -break when a kernel panic happens during flash operation on 16M+ -areas. -*OpenWrt only*: silent broken-flash-reset warning. We are not dealing -with vendors and it's unpleasant for users to se that unnecessary -and long WARN_ON print. - -Signed-off-by: Chuanhong Guo ---- - drivers/mtd/spi-nor/spi-nor.c | 52 +++++++++++++++++++++++++++++++++-- - 1 file changed, 49 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/spi-nor/core.c -+++ b/drivers/mtd/spi-nor/core.c -@@ -1449,6 +1449,23 @@ destroy_erase_cmd_list: - return ret; - } - -+int spi_nor_check_set_addr_width(struct spi_nor *nor, loff_t addr) -+{ -+ u8 addr_width; -+ -+ if ((nor->flags & (SNOR_F_4B_OPCODES | SNOR_F_BROKEN_RESET)) != -+ SNOR_F_BROKEN_RESET) -+ return 0; -+ -+ addr_width = addr & 0xff000000 ? 4 : 3; -+ if (nor->addr_width == addr_width) -+ return 0; -+ -+ nor->addr_width = addr_width; -+ -+ return nor->params->set_4byte_addr_mode(nor, addr_width == 4); -+} -+ - /* - * Erase an address range on the nor chip. The address range may extend - * one or more erase sectors. Return an error is there is a problem erasing. -@@ -1476,6 +1493,10 @@ static int spi_nor_erase(struct mtd_info - if (ret) - return ret; - -+ ret = spi_nor_check_set_addr_width(nor, instr->addr + instr->len); -+ if (ret < 0) -+ return ret; -+ - /* whole-chip erase? */ - if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) { - unsigned long timeout; -@@ -1535,6 +1556,7 @@ static int spi_nor_erase(struct mtd_info - ret = spi_nor_write_disable(nor); - - erase_err: -+ spi_nor_check_set_addr_width(nor, 0); - spi_nor_unlock_and_unprep(nor); - - return ret; -@@ -1874,7 +1896,9 @@ static int spi_nor_lock(struct mtd_info - if (ret) - return ret; - -+ spi_nor_check_set_addr_width(nor, ofs + len); - ret = nor->params->locking_ops->lock(nor, ofs, len); -+ spi_nor_check_set_addr_width(nor, 0); - - spi_nor_unlock_and_unprep(nor); - return ret; -@@ -1889,7 +1913,9 @@ static int spi_nor_unlock(struct mtd_inf - if (ret) - return ret; - -+ spi_nor_check_set_addr_width(nor, ofs + len); - ret = nor->params->locking_ops->unlock(nor, ofs, len); -+ spi_nor_check_set_addr_width(nor, 0); - - spi_nor_unlock_and_unprep(nor); - return ret; -@@ -1904,7 +1930,9 @@ static int spi_nor_is_locked(struct mtd_ - if (ret) - return ret; - -+ spi_nor_check_set_addr_width(nor, ofs + len); - ret = nor->params->locking_ops->is_locked(nor, ofs, len); -+ spi_nor_check_set_addr_width(nor, 0); - - spi_nor_unlock_and_unprep(nor); - return ret; -@@ -2097,6 +2125,10 @@ static int spi_nor_read(struct mtd_info - if (ret) - return ret; - -+ ret = spi_nor_check_set_addr_width(nor, from + len); -+ if (ret < 0) -+ return ret; -+ - while (len) { - loff_t addr = from; - -@@ -2120,6 +2152,7 @@ static int spi_nor_read(struct mtd_info - ret = 0; - - read_err: -+ spi_nor_check_set_addr_width(nor, 0); - spi_nor_unlock_and_unprep(nor); - return ret; - } -@@ -2142,6 +2175,10 @@ static int spi_nor_write(struct mtd_info - if (ret) - return ret; - -+ ret = spi_nor_check_set_addr_width(nor, to + len); -+ if (ret < 0) -+ return ret; -+ - for (i = 0; i < len; ) { - ssize_t written; - loff_t addr = to + i; -@@ -2184,6 +2221,7 @@ static int spi_nor_write(struct mtd_info - } - - write_err: -+ spi_nor_check_set_addr_width(nor, 0); - spi_nor_unlock_and_unprep(nor); - return ret; - } -@@ -2983,9 +3021,13 @@ static int spi_nor_init(struct spi_nor * - * reboots (e.g., crashes). Warn the user (or hopefully, system - * designer) that this is bad. - */ -- WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, -- "enabling reset hack; may not recover from unexpected reboots\n"); -- nor->params->set_4byte_addr_mode(nor, true); -+ if (nor->flags & SNOR_F_BROKEN_RESET) { -+ dev_warn(nor->dev, -+ "enabling reset hack; may not recover from unexpected reboots\n"); -+ nor->addr_width = 3; -+ } else { -+ nor->params->set_4byte_addr_mode(nor, true); -+ } - } - - return 0; ---- a/drivers/mtd/spi-nor/core.h -+++ b/drivers/mtd/spi-nor/core.h -@@ -400,6 +400,7 @@ extern const struct spi_nor_manufacturer - extern const struct spi_nor_manufacturer spi_nor_xmc; - extern const struct spi_nor_manufacturer spi_nor_xtx; - -+int spi_nor_check_set_addr_width(struct spi_nor *nor, loff_t addr); - int spi_nor_write_enable(struct spi_nor *nor); - int spi_nor_write_disable(struct spi_nor *nor); - int spi_nor_set_4byte_addr_mode(struct spi_nor *nor, bool enable); ---- a/drivers/mtd/spi-nor/sst.c -+++ b/drivers/mtd/spi-nor/sst.c -@@ -55,6 +55,10 @@ static int sst_write(struct mtd_info *mt - if (ret) - return ret; - -+ ret = spi_nor_check_set_addr_width(nor, to + len); -+ if (ret < 0) -+ return ret; -+ - ret = spi_nor_write_enable(nor); - if (ret) - goto out; -@@ -124,6 +128,7 @@ static int sst_write(struct mtd_info *mt - } - out: - *retlen += actual; -+ spi_nor_check_set_addr_width(nor, 0); - spi_nor_unlock_and_unprep(nor); - return ret; - } diff --git a/target/linux/ramips/patches-5.10/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch b/target/linux/ramips/patches-5.10/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch index 4fbfae02af..8a704b52c5 100644 --- a/target/linux/ramips/patches-5.10/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch +++ b/target/linux/ramips/patches-5.10/405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch @@ -55,7 +55,7 @@ Signed-off-by: David Bauer +}; --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -2040,6 +2040,7 @@ int spi_nor_sr2_bit7_quad_enable(struct +@@ -2012,6 +2012,7 @@ int spi_nor_sr2_bit7_quad_enable(struct static const struct spi_nor_manufacturer *manufacturers[] = { &spi_nor_atmel, From a47f15294324462192acd6c2f304f888ff609cb4 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 28 Jan 2022 18:56:34 +0200 Subject: [PATCH 017/144] ramips: enable I2C_CHARDEV in mt7621/config-5.10 I2C_CHARDEV used to be enabled in mt7621/config-5.4. Enable it in the 5.10 config, as it's required for PoE control on Unifi Switch Flex. Fixes: b4aad29a1d7a ("ramips: add support for kernel 5.10") Signed-off-by: Stijn Tintel --- target/linux/ramips/mt7621/config-5.10 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/mt7621/config-5.10 b/target/linux/ramips/mt7621/config-5.10 index f3bf6fbb2b..8a5e778e7e 100644 --- a/target/linux/ramips/mt7621/config-5.10 +++ b/target/linux/ramips/mt7621/config-5.10 @@ -96,6 +96,7 @@ CONFIG_HAS_IOPORT_MAP=y CONFIG_HIGHMEM=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y CONFIG_I2C_MT7621=y CONFIG_INITRAMFS_SOURCE="" From 0a29133b1f1ebae60c6fe65281e52e1ade6d388d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 1 Nov 2021 19:27:00 +0100 Subject: [PATCH 018/144] ucode: update to latest Git HEAD c6dae42 LICENSE: add ISC license file 402f603 lib: introduce struct library dcb6ffd struct: fix PowerPC specific compiler pragma name a0512ea treewide: fix typo in exported function names and types eaaaf88 nl80211: fix wiphy dump reply merge logic e6efadb fs: add utility functions 54ef6c0 nl80211: fix premature netlink reply receive abort 07802f3 syntax: disallow keywords in object property shorthand notation 3489b75 vm: support object property access on resource value types dc8027c types: consider resource prototypes when marking reachable objects 5680fab treewide: fix upvalue reference type name 0d29b25 treewide: fix "resource" misspellings 99fdafd vm: introduce value registry 66f7c00 ubus: add support for async requests 5c77dd5 fs: implement fdopen(), file.fileno() and proc.fileno() b605dbf treewide: rework numeric value handling 599d233 vallist: store double values in a platform neutral manner 5bb9ab7 struct: reuse double packing routines from core 2fd7ab5 vm: optimize string concatenation eafa321 lib: implement uniq() function 6b2e79a types: add initial infrastructure for function serialization 725bb75 compiler, vm: use a program wide constant list 6c2caf9 source: refactor source file handling 371ba45 program: implement support for precompiling source files 3578afe build: support building without compile capabilities 61d0a34 lib: replace usages of vasprintf() with xvasprintf() 03b6a8e syntax: drop legacy syntax support 01132db lib: fix %J string formats with precision specifier 3f44c42 lib: rework format string handling a1b3c5d struct: implement `*` format, fix invalid memory accesses 34a04a2 run_tests.sh: fix exitcode evaluation abe38e7 run_tests.sh: add ability to define environment variables for testcases 04fa2ba tests: reorganize testcase files 6a55d10 lib: fix exists() error return value aa860a3 vm: fix `null` loose equality/inequality checks 3f6d199 vallist: uc_number_parse(): parse empty strings as `0`, not `NaN` ddc5aa7 vm: fix NaN strict equality tests Signed-off-by: Jo-Philipp Wich --- package/utils/ucode/Makefile | 27 +++++++++++++++---- .../100-fix-int-format-on-32bit-system.patch | 11 -------- 2 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 package/utils/ucode/patches/100-fix-int-format-on-32bit-system.patch diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index beafb94bb4..f53a3a3529 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -8,17 +8,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ucode -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2021-10-25 -PKG_SOURCE_VERSION:=a7976c2802a9da737f62bec496c7115211c442a7 -PKG_MIRROR_HASH:=6bc3ddeef41d68fd96894957356472e576c625fcf7277cbb36aa464b8d3c274d +PKG_SOURCE_DATE:=2022-01-26 +PKG_SOURCE_VERSION:=ddc5aa7cd3121300f2ba6e68cb038258a616d4e4 +PKG_MIRROR_HASH:=f9a3c010c54288a2363757b58ef31a827b8314e444bb7bf48926f7d4ea88b9d6 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC -PKG_ABI_VERSION:=20210730 +PKG_ABI_VERSION:=20220120 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -109,6 +109,17 @@ define Package/ucode-mod-rtnl/description endef +define Package/ucode-mod-struct + $(Package/ucode/default) + TITLE+= (struct module) + DEPENDS:=ucode +endef + +define Package/ucode-mod-struct/description + The struct plugin implemnts Python 3 compatible struct.pack/unpack functionality. +endef + + define Package/ucode-mod-ubus $(Package/ucode/default) TITLE+= (ubus module) @@ -174,6 +185,11 @@ define Package/ucode-mod-rtnl/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/rtnl.so $(1)/usr/lib/ucode/ endef +define Package/ucode-mod-struct/install + $(INSTALL_DIR) $(1)/usr/lib/ucode + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/struct.so $(1)/usr/lib/ucode/ +endef + define Package/ucode-mod-ubus/install $(INSTALL_DIR) $(1)/usr/lib/ucode $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/ubus.so $(1)/usr/lib/ucode/ @@ -192,5 +208,6 @@ $(eval $(call BuildPackage,ucode-mod-math)) $(eval $(call BuildPackage,ucode-mod-nl80211)) $(eval $(call BuildPackage,ucode-mod-resolv)) $(eval $(call BuildPackage,ucode-mod-rtnl)) +$(eval $(call BuildPackage,ucode-mod-struct)) $(eval $(call BuildPackage,ucode-mod-ubus)) $(eval $(call BuildPackage,ucode-mod-uci)) diff --git a/package/utils/ucode/patches/100-fix-int-format-on-32bit-system.patch b/package/utils/ucode/patches/100-fix-int-format-on-32bit-system.patch deleted file mode 100644 index c557d0c1bd..0000000000 --- a/package/utils/ucode/patches/100-fix-int-format-on-32bit-system.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/lib.c -+++ b/lib.c -@@ -1438,7 +1438,7 @@ uc_printf_common(uc_vm_t *vm, size_t nar - - switch (t) { - case UC_INTEGER: -- ucv_stringbuf_printf(buf, sfmt, arg.n); -+ ucv_stringbuf_printf(buf, sfmt, (int)arg.n); - break; - - case UC_DOUBLE: From edb41fea66ce3e6b7bec6edac5275706106f5380 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 28 Jan 2022 11:14:01 +0100 Subject: [PATCH 019/144] firewall4: update to latest Git HEAD 16a1070 fw4.uc: handle zone masq6 option 5f61dbf ruleset: fix chain selection for mark and dscp targets 0bc844b ruleset: properly deal with wildcards in zone device selectors 101988d fw4: fix family comparisons 127dbc0 ruleset: emit AF specific rules for DSCP matches d63cb89 fw4: fix parsing inverted numeric DSCP values 8c8a867 fw4: fix wrong `parse_network()` return value on `parse_subnet()` failure f85bb2d ruleset: consolidate zone matches for raw_prerouting and raw_output chains 5669bc7 fw4: consolidate device grouping logic 94f03e0 ruleset: properly render redirect targets without port fff9779 fw4: fix family selection logic for redirect rules ca88fcd tests: update interface dump mock data e60bb4b ruleset: support non-contiguous address masks 8fec51a fw4: fix potential crashes when parsing invalid redirect sections c08eb44 fw4: fix redirect destination zone resolving 0df6ba0 fw4: fix address selection logic for DNAT reflection rules 60a2518 tests: add test coverage for redirect rules e479eff fw4: add RFC-8622 'Least Effort' (LE) DSCP mark ac8a737 ruleset: remove redundant syn check bd5dc4b tests: run testcases in strict mode 3ee6a5c ruleset: fix undeclared variable access uncovered by strict mode Signed-off-by: Jo-Philipp Wich --- package/network/config/firewall4/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index 94aa278774..d35b0e31d2 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2022-01-09 -PKG_SOURCE_VERSION:=07579df54f38d75afea44b2a3b41a6d9af9497a1 -PKG_MIRROR_HASH:=3326e5e9fd53fe9f679b62cdada83aea4951aefe95ed6d2b5eca5a4695add45c +PKG_SOURCE_DATE:=2022-01-28 +PKG_SOURCE_VERSION:=3ee6a5c54d5c32a635870fae402420d8c653476c +PKG_MIRROR_HASH:=73523e6d118733d48dc9e068181caa31fedbcafb8850bd43421b7d5d169bf088 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -26,6 +26,7 @@ define Package/firewall4 +kmod-nft-nat +kmod-nft-nat6 \ +nftables-json \ +ucode +ucode-mod-fs +ucode-mod-ubus +ucode-mod-uci + EXTRA_DEPENDS:=ucode (>= 2022-01-26) PROVIDES:=uci-firewall endef From fcb29171bc9a3a80c2685ef23ba6552abef04bbb Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 22 Jan 2022 19:57:49 +0100 Subject: [PATCH 020/144] arc770: Remove arc770 target The arc700 target is not booting up since some time, see here: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/400 It looks like there is a problem in the toolchain when using glibc. Currently no one is working on fixing this problem, remove the target instead. This target also does not have many users we are aware of. If someone wants to have this target back, feel free to add a fixed version of this target again. Signed-off-by: Hauke Mehrtens Acked-by: Adrian Schmutzler Acked-by: Stijn Tintel --- package/devel/perf/Makefile | 2 +- target/linux/arc770/Makefile | 22 -- .../arc770/base-files/etc/board.d/02_network | 17 -- target/linux/arc770/config-5.4 | 195 ------------------ .../arc770/generic/profiles/00-default.mk | 13 -- target/linux/arc770/generic/target.mk | 8 - target/linux/arc770/image/Config.in | 5 - target/linux/arc770/image/Makefile | 84 -------- .../arc770/image/gen_axs10x_sdcard_img.sh | 29 --- target/linux/arc770/image/uEnv.txt | 7 - ...c-Disable-frame-filtering-completely.patch | 31 --- 11 files changed, 1 insertion(+), 412 deletions(-) delete mode 100644 target/linux/arc770/Makefile delete mode 100644 target/linux/arc770/base-files/etc/board.d/02_network delete mode 100644 target/linux/arc770/config-5.4 delete mode 100644 target/linux/arc770/generic/profiles/00-default.mk delete mode 100644 target/linux/arc770/generic/target.mk delete mode 100644 target/linux/arc770/image/Config.in delete mode 100644 target/linux/arc770/image/Makefile delete mode 100755 target/linux/arc770/image/gen_axs10x_sdcard_img.sh delete mode 100644 target/linux/arc770/image/uEnv.txt delete mode 100644 target/linux/arc770/patches-5.4/700-stmmac-Disable-frame-filtering-completely.patch diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index eacdd0e2e5..d556e2d9f0 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -27,7 +27,7 @@ include $(INCLUDE_DIR)/nls.mk define Package/perf SECTION:=devel CATEGORY:=Development - DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +libpthread +librt +objdump @!IN_SDK @!TARGET_arc770 @KERNEL_PERF_EVENTS \ + DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +libpthread +librt +objdump @!IN_SDK @KERNEL_PERF_EVENTS \ +PACKAGE_libbfd:libbfd +PACKAGE_libopcodes:libopcodes TITLE:=Linux performance monitoring tool VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE) diff --git a/target/linux/arc770/Makefile b/target/linux/arc770/Makefile deleted file mode 100644 index 1320c8283b..0000000000 --- a/target/linux/arc770/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2015 OpenWrt.org - -include $(TOPDIR)/rules.mk - -ARCH:=arc -BOARD:=arc770 -BOARDNAME:=Synopsys DesignWare ARC 770D -SUBTARGETS:=generic - -KERNEL_PATCHVER:=5.4 - -DEVICE_TYPE:=basic - -define Target/Description - Synopsys DesignWare boards -endef - -include $(INCLUDE_DIR)/target.mk - -$(eval $(call BuildTarget)) diff --git a/target/linux/arc770/base-files/etc/board.d/02_network b/target/linux/arc770/base-files/etc/board.d/02_network deleted file mode 100644 index c90f3fb6a6..0000000000 --- a/target/linux/arc770/base-files/etc/board.d/02_network +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (C) 2015 OpenWrt.org -# - -. /lib/functions/uci-defaults.sh - -board_config_update - -case "$(board_name)" in -snps,axs101) - ucidef_set_interface_lan "eth0" "dhcp" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/arc770/config-5.4 b/target/linux/arc770/config-5.4 deleted file mode 100644 index 4cd5f195e6..0000000000 --- a/target/linux/arc770/config-5.4 +++ /dev/null @@ -1,195 +0,0 @@ -# CONFIG_16KSTACKS is not set -CONFIG_ARC=y -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y -CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y -CONFIG_ARCH_HAS_PTE_SPECIAL=y -CONFIG_ARCH_HAS_SETUP_DMA_OPS=y -CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y -CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARC_BUILTIN_DTB_NAME="" -CONFIG_ARC_CACHE=y -CONFIG_ARC_CACHE_LINE_SHIFT=5 -CONFIG_ARC_CACHE_PAGES=y -# CONFIG_ARC_CACHE_VIPT_ALIASING is not set -# CONFIG_ARC_COMPACT_IRQ_LEVELS is not set -# CONFIG_ARC_CPU_750D is not set -CONFIG_ARC_CPU_770=y -CONFIG_ARC_CURR_IN_REG=y -CONFIG_ARC_DBG=y -# CONFIG_ARC_DBG_TLB_PARANOIA is not set -CONFIG_ARC_DW2_UNWIND=y -CONFIG_ARC_EMUL_UNALIGNED=y -# CONFIG_ARC_FPU_SAVE_RESTORE is not set -CONFIG_ARC_HAS_DCACHE=y -# CONFIG_ARC_HAS_DCCM is not set -CONFIG_ARC_HAS_ICACHE=y -# CONFIG_ARC_HAS_ICCM is not set -CONFIG_ARC_HAS_LLSC=y -CONFIG_ARC_HAS_SWAPE=y -CONFIG_ARC_KVADDR_SIZE=256 -# CONFIG_ARC_METAWARE_HLINK is not set -# CONFIG_ARC_MMU_V1 is not set -# CONFIG_ARC_MMU_V2 is not set -CONFIG_ARC_MMU_V3=y -# CONFIG_ARC_PAGE_SIZE_16K is not set -# CONFIG_ARC_PAGE_SIZE_4K is not set -CONFIG_ARC_PAGE_SIZE_8K=y -CONFIG_ARC_PLAT_AXS10X=y -# CONFIG_ARC_PLAT_EZNPS is not set -# CONFIG_ARC_PLAT_TB10X is not set -CONFIG_ARC_TIMERS=y -CONFIG_AXS101=y -CONFIG_CC_HAS_KASAN_GENERIC=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_COMMON_CLK=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CPU_NO_EFFICIENT_FFS=y -CONFIG_CRC16=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG2=y -CONFIG_DMA_DIRECT_REMAP=y -CONFIG_DMA_REMAP=y -CONFIG_DTC=y -CONFIG_DWMAC_ANARION=y -CONFIG_DWMAC_GENERIC=y -CONFIG_DW_APB_ICTL=y -CONFIG_EXT4_FS=y -# CONFIG_EZNPS_GIC is not set -CONFIG_FIXED_PHY=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DWAPB=y -CONFIG_GPIO_GENERIC=y -# CONFIG_GPIO_SNPS_CREG is not set -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_FUTEX_CMPXCHG=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PCI=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_WORK=y -CONFIG_ISA_ARCOMPACT=y -# CONFIG_ISA_ARCV2 is not set -CONFIG_JBD2=y -CONFIG_KALLSYMS=y -CONFIG_KERNEL_GZIP=y -CONFIG_LIBFDT=y -CONFIG_LINUX_LINK_BASE=0x80000000 -CONFIG_LINUX_RAM_BASE=0x80000000 -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MEMFD_CREATE=y -CONFIG_MFD_SYSCON=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_DW=y -# CONFIG_MMC_DW_BLUEFIELD is not set -# CONFIG_MMC_DW_EXYNOS is not set -# CONFIG_MMC_DW_HI3798CV200 is not set -# CONFIG_MMC_DW_K3 is not set -CONFIG_MMC_DW_PLTFM=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_NATIONAL_PHY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NET_VENDOR_ARC is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_NET_VENDOR_QUALCOMM is not set -# CONFIG_NET_VENDOR_ROCKER is not set -# CONFIG_NET_VENDOR_SAMSUNG is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_VIA is not set -# CONFIG_NET_VENDOR_WIZNET is not set -CONFIG_NO_IOPORT_MAP=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_PAGE_POOL=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PHYLINK=y -CONFIG_PPS=y -CONFIG_PREEMPT=y -CONFIG_PREEMPTION=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y -CONFIG_PTP_1588_CLOCK=y -CONFIG_RATIONAL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_RESET_AXS10X=y -CONFIG_RESET_CONTROLLER=y -CONFIG_RESET_SIMPLE=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_DW=y -CONFIG_SERIAL_8250_DWLIB=y -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -CONFIG_SERIAL_ARC=y -CONFIG_SERIAL_ARC_CONSOLE=y -CONFIG_SERIAL_ARC_NR_PORTS=1 -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SRCU=y -CONFIG_STACKTRACE=y -CONFIG_STMMAC_ETH=y -CONFIG_STMMAC_PLATFORM=y -# CONFIG_STMMAC_SELFTESTS is not set -CONFIG_SWPHY=y -CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW=y -CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN=y -CONFIG_TASKS_RCU=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TREE_SRCU=y -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_USB_SUPPORT=y diff --git a/target/linux/arc770/generic/profiles/00-default.mk b/target/linux/arc770/generic/profiles/00-default.mk deleted file mode 100644 index 02404305d4..0000000000 --- a/target/linux/arc770/generic/profiles/00-default.mk +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2015 OpenWrt.org - -define Profile/Default - NAME:=Default Profile (all drivers) - PACKAGES:= kmod-usb-ohci kmod-usb2 kmod-ath9k-htc wpad-basic-wolfssl -endef - -define Profile/Default/Description - Default package set compatible with most boards. -endef -$(eval $(call Profile,Default)) diff --git a/target/linux/arc770/generic/target.mk b/target/linux/arc770/generic/target.mk deleted file mode 100644 index 5a7595d65a..0000000000 --- a/target/linux/arc770/generic/target.mk +++ /dev/null @@ -1,8 +0,0 @@ -BOARDNAME:=Generic -FEATURES += ramdisk usb ext4 - -define Target/Description - Build firmware images for generic ARC 770D based boards. -endef - - diff --git a/target/linux/arc770/image/Config.in b/target/linux/arc770/image/Config.in deleted file mode 100644 index 52f68ba241..0000000000 --- a/target/linux/arc770/image/Config.in +++ /dev/null @@ -1,5 +0,0 @@ -config AXS10X_SD_BOOT_PARTSIZE - int "Boot (SD Card) filesystem partition size (in MB)" - depends on TARGET_arc770 - default 20 - diff --git a/target/linux/arc770/image/Makefile b/target/linux/arc770/image/Makefile deleted file mode 100644 index 4cb9364ef3..0000000000 --- a/target/linux/arc770/image/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2016 OpenWrt.org - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -# On ARC initramfs is put before entry point and so entry point moves -# in memory from build to built. Thus we need to extract EP from vmlinux -# every time before generation of uImage. -kernel_ep = `$(KERNEL_CROSS)readelf -h $(1) | grep "Entry point address" | grep -o 0x.*` - -define Build/patch-dtb - $(STAGING_DIR_HOST)/bin/patch-dtb $@ $(DTS_DIR)/$(DEVICE_DTS).dtb -endef - -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) -# Root FS built-in -define Device/vmlinux - KERNEL_SUFFIX := .elf - KERNEL := kernel-bin | patch-dtb - KERNEL_INITRAMFS_NAME = vmlinux-initramfs.elf -endef - -define Device/nsim - $(call Device/vmlinux) - DEVICE_VENDOR := Synopsys - DEVICE_MODEL := nSIM - DEVICE_PROFILE := nsim - DEVICE_DTS := nsim_700 -endef -TARGET_DEVICES += nsim -endif - -# Root FS on SD-card -KERNEL_LOADADDR := 0x80000000 -DEVICE_DTS_LIST:= axs101 nsim_700 -FAT32_BLOCK_SIZE=1024 -FAT32_BLOCKS=$(shell echo $$(($(CONFIG_AXS10X_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) - -define Image/Prepare - # Build .dtb for all boards we may run on - $(foreach dts,$(DEVICE_DTS_LIST), - $(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb) - ) -endef - -define Image/Build/SDCard - rm -f $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img - mkfs.fat $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img -C $(FAT32_BLOCKS) - mkimage -C none -A arc -T script -d uEnv.txt $(BIN_DIR)/uEnv.scr - mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/uEnv.scr ::boot.scr - mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(DTS_DIR)/*.dtb :: - mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage - - ./gen_axs10x_sdcard_img.sh \ - $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \ - $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img \ - $(KDIR)/root.$(1) \ - $(CONFIG_AXS10X_SD_BOOT_PARTSIZE) \ - $(CONFIG_TARGET_ROOTFS_PARTSIZE) - -ifneq ($(CONFIG_TARGET_IMAGES_GZIP),) - gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img -endif -endef - -define Image/BuildKernel - # Build unified uImage - $(call Image/BuildKernel/MkuImage, \ - none, $(KERNEL_LOADADDR),$(call kernel_ep,$(KDIR)/vmlinux.elf) , \ - $(KDIR)/vmlinux, \ - $(BIN_DIR)/$(IMG_PREFIX)-uImage \ - ) -endef - -define Image/Build - $(call Image/Build/$(1),$(1)) - $(call Image/Build/SDCard,$(1)) - dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync - $(call Image/Gzip,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)) -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/arc770/image/gen_axs10x_sdcard_img.sh b/target/linux/arc770/image/gen_axs10x_sdcard_img.sh deleted file mode 100755 index 12ead10dbe..0000000000 --- a/target/linux/arc770/image/gen_axs10x_sdcard_img.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2016 OpenWrt.org - -set -x -[ $# -eq 5 ] || { - echo "SYNTAX: $0 " - exit 1 -} - -OUTPUT="$1" -BOOTFS="$2" -ROOTFS="$3" -BOOTFSSIZE="$4" -ROOTFSSIZE="$5" - -head=4 -sect=63 - -set $(ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M) - -BOOTOFFSET="$(($1 / 512))" -BOOTSIZE="$(($2 / 512))" -ROOTFSOFFSET="$(($3 / 512))" -ROOTFSSIZE="$(($4 / 512))" - -dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc -dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc diff --git a/target/linux/arc770/image/uEnv.txt b/target/linux/arc770/image/uEnv.txt deleted file mode 100644 index 53632e8bb6..0000000000 --- a/target/linux/arc770/image/uEnv.txt +++ /dev/null @@ -1,7 +0,0 @@ -setenv kernel_addr_r 0x82000000 -setenv fdt_addr_r 0x83000000 -setenv loadkernel fatload mmc 0 \${kernel_addr_r} uImage -setenv loaddtb fatload mmc 0 \${fdt_addr_r} \${dts} -setenv bootargs earlycon=uart8250,mmio32,0xe0022000,115200n8 console=ttyS3,115200n8 root=/dev/mmcblk0p2 rootwait print-fatal-signals=1 -setenv uenvcmd run loadkernel\; run loaddtb\; bootm \${kernel_addr_r} - \${fdt_addr_r} -run uenvcmd diff --git a/target/linux/arc770/patches-5.4/700-stmmac-Disable-frame-filtering-completely.patch b/target/linux/arc770/patches-5.4/700-stmmac-Disable-frame-filtering-completely.patch deleted file mode 100644 index 9adfcb1be2..0000000000 --- a/target/linux/arc770/patches-5.4/700-stmmac-Disable-frame-filtering-completely.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0031b9011cb2b2b1de4dbb4f9620303aec760db4 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Wed, 27 Jul 2016 11:33:14 +0300 -Subject: [PATCH] stmmac: Disable frame filtering completely - -For some [still unknown] reason in ARC SDP boards -DW GMAC doesn't enter promiscuous mode if eth0 gets -added to the br-lan interface before Ethernet PHY finishes -autonegotiation (PHY gets reset on DW GMAC start). - -As a work-around we completely disable frame filtering -in GMAC hardware which gives us working bridge that consists -of eth0 and wlan0 (USB Wi-Fi dongle). I.e. we finally have -working "Dumb AP" setup made of ARC AXS10x boards. - -Signed-off-by: Alexey Brodkin ---- - drivers/net/ethernet/stmicro/stmmac/common.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/stmicro/stmmac/common.h -+++ b/drivers/net/ethernet/stmicro/stmmac/common.h -@@ -42,7 +42,7 @@ - #define STMMAC_GET_ENTRY(x, size) ((x + 1) & (size - 1)) - - #undef FRAME_FILTER_DEBUG --/* #define FRAME_FILTER_DEBUG */ -+#define FRAME_FILTER_DEBUG - - /* Extra statistic and debug information exposed by ethtool */ - struct stmmac_extra_stats { From 764b1ecb69038c10009f82ecfdf5809d391b6226 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 23 Jan 2022 01:48:28 +0100 Subject: [PATCH 021/144] kernel: Fix compile warning This fixes the following compile warning: CC init/do_mounts.o init/do_mounts.c:478:19: warning: 'mount_ubi_rootfs' defined but not used [-Wunused-function] 478 | static int __init mount_ubi_rootfs(void) | ^~~~~~~~~~~~~~~~ Signed-off-by: Hauke Mehrtens --- ...-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch | 6 ++++-- ...-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/target/linux/generic/pending-5.10/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-5.10/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch index af65cbfa59..e3c4dd2ef4 100644 --- a/target/linux/generic/pending-5.10/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch +++ b/target/linux/generic/pending-5.10/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch @@ -8,12 +8,13 @@ Signed-off-by: Daniel Golle --- a/init/do_mounts.c +++ b/init/do_mounts.c -@@ -474,7 +474,28 @@ retry: +@@ -474,7 +474,30 @@ retry: out: put_page(page); } - + ++#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV +static int __init mount_ubi_rootfs(void) +{ + int flags = MS_SILENT; @@ -34,11 +35,12 @@ Signed-off-by: Daniel Golle + + return -EINVAL; +} ++#endif + #ifdef CONFIG_ROOT_NFS #define NFSROOT_TIMEOUT_MIN 5 -@@ -567,6 +588,10 @@ void __init mount_root(void) +@@ -567,6 +590,10 @@ void __init mount_root(void) return; } #endif diff --git a/target/linux/generic/pending-5.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-5.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch index aa61f4ae8d..e207c0d00d 100644 --- a/target/linux/generic/pending-5.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch +++ b/target/linux/generic/pending-5.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch @@ -8,12 +8,13 @@ Signed-off-by: Daniel Golle --- a/init/do_mounts.c +++ b/init/do_mounts.c -@@ -460,7 +460,28 @@ retry: +@@ -460,7 +460,30 @@ retry: out: put_page(page); } - + ++#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV +static int __init mount_ubi_rootfs(void) +{ + int flags = MS_SILENT; @@ -34,11 +35,12 @@ Signed-off-by: Daniel Golle + + return -EINVAL; +} ++#endif + #ifdef CONFIG_ROOT_NFS #define NFSROOT_TIMEOUT_MIN 5 -@@ -554,6 +575,10 @@ void __init mount_root(void) +@@ -554,6 +577,10 @@ void __init mount_root(void) change_floppy("root floppy"); } #endif From c120f7943eee9613b0332f20a5ac95085a299991 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 23 Jan 2022 17:02:04 +0100 Subject: [PATCH 022/144] kernel: Add CONFIG_CRYPTO_DEV_OCTEONTX_CPT kernel config option This new kernel configuration option is available when building the octeontx target. Signed-off-by: Hauke Mehrtens --- target/linux/generic/config-5.10 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index c9e44e11c2..619399a319 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -1100,6 +1100,7 @@ CONFIG_CRYPTO_CTR=y # CONFIG_CRYPTO_DEV_MXC_SCC is not set # CONFIG_CRYPTO_DEV_MXS_DCP is not set # CONFIG_CRYPTO_DEV_NITROX_CNN55XX is not set +# CONFIG_CRYPTO_DEV_OCTEONTX_CPT is not set # CONFIG_CRYPTO_DEV_QAT_C3XXX is not set # CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set # CONFIG_CRYPTO_DEV_QAT_C62X is not set From d2ae4821c225f17e6484a8a7eeed20965901c9df Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 23 Jan 2022 17:04:26 +0100 Subject: [PATCH 023/144] octeontx: Refresh kernel configuration Refresh the kernel configuration. No manual changes done. Signed-off-by: Hauke Mehrtens --- target/linux/octeontx/config-5.10 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/target/linux/octeontx/config-5.10 b/target/linux/octeontx/config-5.10 index 18426a4496..6c87abf5b6 100644 --- a/target/linux/octeontx/config-5.10 +++ b/target/linux/octeontx/config-5.10 @@ -38,8 +38,6 @@ CONFIG_ARM64_VA_BITS=48 CONFIG_ARM64_VA_BITS_48=y CONFIG_ARM64_VHE=y CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y -CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y -CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y CONFIG_ARM_AMBA=y CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y @@ -141,13 +139,11 @@ CONFIG_EDAC_SUPPORT=y CONFIG_EDAC_THUNDERX=y # CONFIG_EDAC_XGENE is not set CONFIG_EEPROM_AT24=y +CONFIG_FAT_FS=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FRAME_POINTER=y CONFIG_FREEZER=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_FS_POSIX_ACL=y CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_GENERIC_ALLOCATOR=y @@ -215,7 +211,6 @@ CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_IRQ_WORK=y # CONFIG_ISDN is not set -CONFIG_JBD2=y CONFIG_JUMP_LABEL=y CONFIG_KEXEC=y CONFIG_KEXEC_CORE=y @@ -388,7 +383,6 @@ CONFIG_TIMER_PROBE=y CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y # CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set -CONFIG_TRANSPARENT_HUGE_PAGECACHE=y CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y CONFIG_UNMAP_KERNEL_AT_EL0=y From 01e58f8bee2f4f33abcb4ab73c1f7b5ebfd10c5d Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Mon, 24 Jan 2022 17:30:43 -0500 Subject: [PATCH 024/144] netfilter.mk: add conntrack support to nft bridge This allows to implement statefull bridge filtering As the uncompressed size is only 7.6k (arm64), just add nf_conntrack_bridge.ko to kmod-nft-bridge package Signed-off-by: Etienne Champetier --- include/netfilter.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/netfilter.mk b/include/netfilter.mk index 803749d931..65e8e3b8f0 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -332,6 +332,7 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT_INET, $(P_XT)nft $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_META, $(P_EBT)nft_meta_bridge),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EBT)nft_reject_bridge),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NF_CONNTRACK_BRIDGE, $(P_EBT)nf_conntrack_bridge),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_chain_nat),)) From 76725938f1aa73330e8abeb8744871996f42422f Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 20 Jan 2022 16:41:22 -0500 Subject: [PATCH 025/144] kernel: bump 5.4 to 5.4.173 All patches automatically rebased. Signed-off-by: John Audia --- include/kernel-5.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-5.4 b/include/kernel-5.4 index 5f9ef17a7d..ba06322b42 100644 --- a/include/kernel-5.4 +++ b/include/kernel-5.4 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.4 = .172 -LINUX_KERNEL_HASH-5.4.172 = b19e890b67e8293008262d3518cab47be58462c63da43f2c9832d63644886ce4 +LINUX_VERSION-5.4 = .173 +LINUX_KERNEL_HASH-5.4.173 = 99e8e275b239c708bdb6a41990c4d12098a61752245dbef921a514d9f996c239 From 30cff7c3b076308fac13610c3c6ab9eb6bb04e6f Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 27 Jan 2022 05:44:38 -0500 Subject: [PATCH 026/144] kernel: bump 5.4 to 5.4.174 Removed upstreamed patches: layerscape/patches-5.4/302-dts-0083-arm64-ls1028a-qds-correct-bus-of-rtc.patch[1] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.4.174&id=65816c1034769e714edb70f59a33bc5472d9e55f Build system: x86_64 Build-tested: ramips/mt7621 Signed-off-by: John Audia --- include/kernel-5.4 | 4 +- ...IPS-BCM63XX-add-support-for-BCM63268.patch | 4 +- ...MIPS-BCM63XX-add-support-for-BCM6318.patch | 6 +-- ...X-add-clkdev-lookups-for-device-tree.patch | 20 ++++----- .../430-MIPS-BCM63XX-add-nand-clocks.patch | 6 +-- ...the-dst-buffer-to-of_get_mac_address.patch | 8 ++-- ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 2 +- ...-support-hardware-flow-table-offload.patch | 2 +- ...ng-with-source-address-failed-policy.patch | 2 +- ...-arm64-dts-ls1028a-add-flexspi-nodes.patch | 2 +- ...-Add-support-DP-nodes-for-LS1028AQDS.patch | 2 +- ...arm64-ls1028a-qds-correct-bus-of-rtc.patch | 42 ------------------- ...8a-define-networking-options-for-QDS.patch | 2 +- ...92-arm64-dts-ls1028a-Add-DP-DT-nodes.patch | 2 +- ...1028a-qds-Add-overlays-for-various-s.patch | 2 +- ...e-print-suggested-message-if-failed-.patch | 2 +- .../patches-5.4/130-itus_shield_support.patch | 2 +- ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 2 +- 18 files changed, 35 insertions(+), 77 deletions(-) delete mode 100644 target/linux/layerscape/patches-5.4/302-dts-0083-arm64-ls1028a-qds-correct-bus-of-rtc.patch diff --git a/include/kernel-5.4 b/include/kernel-5.4 index ba06322b42..4010387f25 100644 --- a/include/kernel-5.4 +++ b/include/kernel-5.4 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.4 = .173 -LINUX_KERNEL_HASH-5.4.173 = 99e8e275b239c708bdb6a41990c4d12098a61752245dbef921a514d9f996c239 +LINUX_VERSION-5.4 = .174 +LINUX_KERNEL_HASH-5.4.174 = e8cd1be5aefaf9b44024b039e31b6cb21135ab67f322e8dff98be5a9998308a9 diff --git a/target/linux/bcm63xx/patches-5.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch b/target/linux/bcm63xx/patches-5.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch index a61a96f569..ed70482bb0 100644 --- a/target/linux/bcm63xx/patches-5.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch +++ b/target/linux/bcm63xx/patches-5.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch @@ -107,7 +107,7 @@ Signed-off-by: Jonas Gorski } static struct clk clk_pcie = { -@@ -542,6 +556,21 @@ static struct clk_lookup bcm6368_clks[] +@@ -548,6 +562,21 @@ static struct clk_lookup bcm6368_clks[] CLKDEV_INIT(NULL, "ipsec", &clk_ipsec), }; @@ -129,7 +129,7 @@ Signed-off-by: Jonas Gorski #define HSSPI_PLL_HZ_6328 133333333 #define HSSPI_PLL_HZ_6362 400000000 -@@ -574,6 +603,10 @@ static int __init bcm63xx_clk_init(void) +@@ -580,6 +609,10 @@ static int __init bcm63xx_clk_init(void) case BCM6368_CPU_ID: clkdev_add_table(bcm6368_clks, ARRAY_SIZE(bcm6368_clks)); break; diff --git a/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch index 48b183ac3b..ac354a4787 100644 --- a/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch +++ b/target/linux/bcm63xx/patches-5.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch @@ -57,7 +57,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 mask = CKCTL_6328_HSSPI_EN; else if (BCMCPU_IS_6362()) mask = CKCTL_6362_HSSPI_EN; -@@ -450,6 +452,19 @@ static struct clk_lookup bcm3368_clks[] +@@ -456,6 +458,19 @@ static struct clk_lookup bcm3368_clks[] CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), }; @@ -77,7 +77,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 static struct clk_lookup bcm6328_clks[] = { /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), -@@ -571,6 +586,7 @@ static struct clk_lookup bcm63268_clks[] +@@ -577,6 +592,7 @@ static struct clk_lookup bcm63268_clks[] CLKDEV_INIT(NULL, "pcie", &clk_pcie), }; @@ -85,7 +85,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 #define HSSPI_PLL_HZ_6328 133333333 #define HSSPI_PLL_HZ_6362 400000000 -@@ -580,6 +596,10 @@ static int __init bcm63xx_clk_init(void) +@@ -586,6 +602,10 @@ static int __init bcm63xx_clk_init(void) case BCM3368_CPU_ID: clkdev_add_table(bcm3368_clks, ARRAY_SIZE(bcm3368_clks)); break; diff --git a/target/linux/bcm63xx/patches-5.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch b/target/linux/bcm63xx/patches-5.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch index 45d4b8487c..d6b1190b9d 100644 --- a/target/linux/bcm63xx/patches-5.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch +++ b/target/linux/bcm63xx/patches-5.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch @@ -9,7 +9,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c -@@ -495,6 +495,8 @@ static struct clk_lookup bcm3368_clks[] +@@ -501,6 +501,8 @@ static struct clk_lookup bcm3368_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -18,7 +18,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -511,7 +513,9 @@ static struct clk_lookup bcm6318_clks[] +@@ -517,7 +519,9 @@ static struct clk_lookup bcm6318_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -28,7 +28,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -525,7 +529,10 @@ static struct clk_lookup bcm6328_clks[] +@@ -531,7 +535,10 @@ static struct clk_lookup bcm6328_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -39,7 +39,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -538,6 +545,7 @@ static struct clk_lookup bcm6338_clks[] +@@ -544,6 +551,7 @@ static struct clk_lookup bcm6338_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -47,7 +47,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -552,6 +560,7 @@ static struct clk_lookup bcm6345_clks[] +@@ -558,6 +566,7 @@ static struct clk_lookup bcm6345_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -55,7 +55,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -566,6 +575,7 @@ static struct clk_lookup bcm6348_clks[] +@@ -572,6 +581,7 @@ static struct clk_lookup bcm6348_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -63,7 +63,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -582,6 +592,8 @@ static struct clk_lookup bcm6358_clks[] +@@ -588,6 +598,8 @@ static struct clk_lookup bcm6358_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -72,7 +72,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -601,7 +613,10 @@ static struct clk_lookup bcm6362_clks[] +@@ -607,7 +619,10 @@ static struct clk_lookup bcm6362_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -83,7 +83,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -617,6 +632,8 @@ static struct clk_lookup bcm6368_clks[] +@@ -623,6 +638,8 @@ static struct clk_lookup bcm6368_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -92,7 +92,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -631,7 +648,10 @@ static struct clk_lookup bcm63268_clks[] +@@ -637,7 +654,10 @@ static struct clk_lookup bcm63268_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), diff --git a/target/linux/bcm63xx/patches-5.4/430-MIPS-BCM63XX-add-nand-clocks.patch b/target/linux/bcm63xx/patches-5.4/430-MIPS-BCM63XX-add-nand-clocks.patch index a8f70e3db3..a29c3b780b 100644 --- a/target/linux/bcm63xx/patches-5.4/430-MIPS-BCM63XX-add-nand-clocks.patch +++ b/target/linux/bcm63xx/patches-5.4/430-MIPS-BCM63XX-add-nand-clocks.patch @@ -24,7 +24,7 @@ * Internal peripheral clock */ static struct clk clk_periph = { -@@ -618,6 +635,7 @@ static struct clk_lookup bcm6362_clks[] +@@ -624,6 +641,7 @@ static struct clk_lookup bcm6362_clks[] CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), /* gated clocks */ @@ -32,7 +32,7 @@ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), CLKDEV_INIT(NULL, "usbd", &clk_usbd), -@@ -635,6 +653,7 @@ static struct clk_lookup bcm6368_clks[] +@@ -641,6 +659,7 @@ static struct clk_lookup bcm6368_clks[] CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), /* gated clocks */ @@ -40,7 +40,7 @@ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), CLKDEV_INIT(NULL, "usbd", &clk_usbd), -@@ -653,6 +672,7 @@ static struct clk_lookup bcm63268_clks[] +@@ -659,6 +678,7 @@ static struct clk_lookup bcm63268_clks[] CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), /* gated clocks */ diff --git a/target/linux/generic/backport-5.4/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.4/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 31e1781ee0..66d379b859 100644 --- a/target/linux/generic/backport-5.4/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.4/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -607,7 +607,7 @@ Signed-off-by: David S. Miller /* --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c -@@ -605,7 +605,6 @@ static int mac_probe(struct platform_dev +@@ -616,7 +616,6 @@ static int mac_probe(struct platform_dev struct platform_device *of_dev; struct resource res; struct mac_priv_s *priv; @@ -615,7 +615,7 @@ Signed-off-by: David S. Miller u32 val; u8 fman_id; int phy_if; -@@ -723,13 +722,12 @@ static int mac_probe(struct platform_dev +@@ -734,13 +733,12 @@ static int mac_probe(struct platform_dev priv->cell_index = (u8)val; /* Get the MAC address */ @@ -1492,7 +1492,7 @@ Signed-off-by: David S. Miller } --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c -@@ -1663,7 +1663,7 @@ static int axienet_probe(struct platform +@@ -1665,7 +1665,7 @@ static int axienet_probe(struct platform struct device_node *np; struct axienet_local *lp; struct net_device *ndev; @@ -1501,7 +1501,7 @@ Signed-off-by: David S. Miller struct resource *ethres; u32 value; -@@ -1835,13 +1835,14 @@ static int axienet_probe(struct platform +@@ -1837,13 +1837,14 @@ static int axienet_probe(struct platform dev_info(&pdev->dev, "Ethernet core IRQ not defined\n"); /* Retrieve the MAC address */ diff --git a/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch index 6acb2dc386..09e8267034 100644 --- a/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ b/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch @@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -6884,7 +6884,7 @@ static void __ref alloc_node_mem_map(str +@@ -6886,7 +6886,7 @@ static void __ref alloc_node_mem_map(str mem_map = NODE_DATA(0)->node_mem_map; #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) if (page_to_pfn(mem_map) != pgdat->node_start_pfn) diff --git a/target/linux/generic/pending-5.4/644-net-pppoe-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-5.4/644-net-pppoe-support-hardware-flow-table-offload.patch index 1eb6a83337..b09b3bc5e8 100644 --- a/target/linux/generic/pending-5.4/644-net-pppoe-support-hardware-flow-table-offload.patch +++ b/target/linux/generic/pending-5.4/644-net-pppoe-support-hardware-flow-table-offload.patch @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau #define PPP_VERSION "2.4.2" /* -@@ -1373,12 +1378,37 @@ static void ppp_dev_priv_destructor(stru +@@ -1378,12 +1383,37 @@ static void ppp_dev_priv_destructor(stru ppp_destroy_interface(ppp); } diff --git a/target/linux/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index d21258e590..82c1e26831 100644 --- a/target/linux/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-5.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -53,7 +53,7 @@ Signed-off-by: Jonas Gorski --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c -@@ -141,6 +141,10 @@ const struct fib_prop fib_props[RTN_MAX +@@ -142,6 +142,10 @@ const struct fib_prop fib_props[RTN_MAX .error = -EINVAL, .scope = RT_SCOPE_NOWHERE, }, diff --git a/target/linux/layerscape/patches-5.4/302-dts-0060-arm64-dts-ls1028a-add-flexspi-nodes.patch b/target/linux/layerscape/patches-5.4/302-dts-0060-arm64-dts-ls1028a-add-flexspi-nodes.patch index 3f7dc5bffc..84aa2390a8 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0060-arm64-dts-ls1028a-add-flexspi-nodes.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0060-arm64-dts-ls1028a-add-flexspi-nodes.patch @@ -18,7 +18,7 @@ Signed-off-by: Xiaowei Bao --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts -@@ -222,6 +222,21 @@ +@@ -226,6 +226,21 @@ phy-connection-type = "rgmii-id"; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0073-arm64-ls1028aqds-Add-support-DP-nodes-for-LS1028AQDS.patch b/target/linux/layerscape/patches-5.4/302-dts-0073-arm64-ls1028aqds-Add-support-DP-nodes-for-LS1028AQDS.patch index e389a950d9..3ccd41f57c 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0073-arm64-ls1028aqds-Add-support-DP-nodes-for-LS1028AQDS.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0073-arm64-ls1028aqds-Add-support-DP-nodes-for-LS1028AQDS.patch @@ -13,7 +13,7 @@ Signed-off-by: Wen He --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts -@@ -244,3 +244,15 @@ +@@ -248,3 +248,15 @@ &sata { status = "okay"; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0083-arm64-ls1028a-qds-correct-bus-of-rtc.patch b/target/linux/layerscape/patches-5.4/302-dts-0083-arm64-ls1028a-qds-correct-bus-of-rtc.patch deleted file mode 100644 index d97837722c..0000000000 --- a/target/linux/layerscape/patches-5.4/302-dts-0083-arm64-ls1028a-qds-correct-bus-of-rtc.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d4c7270a63b1d78b89d91f74d782cce2a2bd9690 Mon Sep 17 00:00:00 2001 -From: Biwen Li -Date: Wed, 4 Sep 2019 11:39:30 +0800 -Subject: [PATCH] arm64: ls1028a-qds: correct bus of rtc - -The rtc is on i2c2 bus(hardware), not on i2c1 channel 3, -so correct it - -Signed-off-by: Biwen Li ---- - arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - ---- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts -+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts -@@ -169,11 +169,6 @@ - vcc-supply = <&sb_3v3>; - }; - -- rtc@51 { -- compatible = "nxp,pcf2129"; -- reg = <0x51>; -- }; -- - eeprom@56 { - compatible = "atmel,24c512"; - reg = <0x56>; -@@ -217,6 +212,14 @@ - - }; - -+&i2c1 { -+ status = "okay"; -+ rtc@51 { -+ compatible = "nxp,pcf2129"; -+ reg = <0x51>; -+ }; -+}; -+ - &enetc_port1 { - phy-handle = <&qds_phy1>; - phy-connection-type = "rgmii-id"; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0084-arm64-dts-ls1028a-define-networking-options-for-QDS.patch b/target/linux/layerscape/patches-5.4/302-dts-0084-arm64-dts-ls1028a-define-networking-options-for-QDS.patch index 68e8098b68..8680f3490b 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0084-arm64-dts-ls1028a-define-networking-options-for-QDS.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0084-arm64-dts-ls1028a-define-networking-options-for-QDS.patch @@ -346,7 +346,7 @@ Signed-off-by: Alex Marginean }; }; -@@ -259,3 +283,6 @@ +@@ -260,3 +284,6 @@ edp_num_lanes = <0x4>; status = "okay"; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch b/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch index a0fd27e350..c3b750ee8a 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0092-arm64-dts-ls1028a-Add-DP-DT-nodes.patch @@ -14,7 +14,7 @@ Signed-off-by: Wen He --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts -@@ -273,14 +273,7 @@ +@@ -274,14 +274,7 @@ }; &hdptx0 { diff --git a/target/linux/layerscape/patches-5.4/302-dts-0113-arm64-dts-fsl-ls1028a-qds-Add-overlays-for-various-s.patch b/target/linux/layerscape/patches-5.4/302-dts-0113-arm64-dts-fsl-ls1028a-qds-Add-overlays-for-various-s.patch index 0d1b23c85b..faa7c58bf1 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0113-arm64-dts-fsl-ls1028a-qds-Add-overlays-for-various-s.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0113-arm64-dts-fsl-ls1028a-qds-Add-overlays-for-various-s.patch @@ -884,7 +884,7 @@ Signed-off-by: Alex Marginean -}; --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts -@@ -276,6 +276,3 @@ +@@ -277,6 +277,3 @@ lane-mapping = <0x4e>; status = "okay"; }; diff --git a/target/linux/layerscape/patches-5.4/820-usb-0019-MLK-9829-usb-core-print-suggested-message-if-failed-.patch b/target/linux/layerscape/patches-5.4/820-usb-0019-MLK-9829-usb-core-print-suggested-message-if-failed-.patch index 6111197263..16e4e7e68c 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0019-MLK-9829-usb-core-print-suggested-message-if-failed-.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0019-MLK-9829-usb-core-print-suggested-message-if-failed-.patch @@ -20,7 +20,7 @@ Signed-off-by: Li Jun --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4777,7 +4777,8 @@ hub_port_init(struct usb_hub *hub, struc +@@ -4780,7 +4780,8 @@ hub_port_init(struct usb_hub *hub, struc } if (r) { if (r != -ENODEV) diff --git a/target/linux/octeon/patches-5.4/130-itus_shield_support.patch b/target/linux/octeon/patches-5.4/130-itus_shield_support.patch index 37c75bbcd1..15f514209d 100644 --- a/target/linux/octeon/patches-5.4/130-itus_shield_support.patch +++ b/target/linux/octeon/patches-5.4/130-itus_shield_support.patch @@ -20,7 +20,7 @@ } --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c -@@ -771,7 +771,7 @@ int __init octeon_prune_device_tree(void +@@ -773,7 +773,7 @@ int __init octeon_prune_device_tree(void if (fdt_check_header(initial_boot_params)) panic("Corrupt Device Tree."); diff --git a/target/linux/octeontx/patches-5.4/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.4/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch index 1206561fda..8b7285abdf 100644 --- a/target/linux/octeontx/patches-5.4/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch +++ b/target/linux/octeontx/patches-5.4/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch @@ -22,7 +22,7 @@ Signed-off-by: Tim Harvey #include #include #include -@@ -5790,3 +5791,34 @@ static void nvidia_ion_ahci_fixup(struct +@@ -5793,3 +5794,34 @@ static void nvidia_ion_ahci_fixup(struct pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); From 5bd926efa99a0638e03e26ed50f1c44b196888da Mon Sep 17 00:00:00 2001 From: Roman Azarenko Date: Tue, 25 Jan 2022 18:16:30 +0100 Subject: [PATCH 027/144] util-linux: add lslocks This change adds the "lslocks" utility from util-linux. Signed-off-by: Roman Azarenko --- package/utils/util-linux/Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index ded653e2c0..bf8a67f074 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -317,6 +317,16 @@ define Package/lscpu/description lscpu displays information about the CPU architecture endef +define Package/lslocks +$(call Package/util-linux/Default) + TITLE:=list local system locks + DEPENDS:= +libmount +libsmartcols +endef + +define Package/lslocks/description + lslocks lists information about all the currently held file locks in a Linux system +endef + define Package/more $(call Package/util-linux/Default) TITLE:=filter for paging through text one screenful at a time @@ -704,6 +714,11 @@ define Package/lscpu/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lscpu $(1)/usr/bin/ endef +define Package/lslocks/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lslocks $(1)/usr/bin/ +endef + define Package/more/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/more $(1)/usr/bin/ @@ -831,6 +846,7 @@ $(eval $(call BuildPackage,look)) $(eval $(call BuildPackage,losetup)) $(eval $(call BuildPackage,lsblk)) $(eval $(call BuildPackage,lscpu)) +$(eval $(call BuildPackage,lslocks)) $(eval $(call BuildPackage,more)) $(eval $(call BuildPackage,mcookie)) $(eval $(call BuildPackage,mount-utils)) From 536a8021c397ff944d235a39fbb1774f8cd08ec7 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 29 Jan 2022 23:49:39 +0900 Subject: [PATCH 028/144] firmware-utils: bump to git HEAD 0c15cad iptime-naspkg: add image header tool for ipTIME NAS series 872c87c iptime-crc32: add image header tool for new ipTIME models Signed-off-by: Sungbo Eo --- tools/firmware-utils/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index f71e1b545f..60e0c74b45 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2022-01-28 -PKG_SOURCE_VERSION:=8e7274e02fdc6f2cb61b415d6e5b2e1c7e977aa1 -PKG_MIRROR_HASH:=bf3e3f9e37b156107d7bc2ce666112db2b3ef6580b1f47bce96311da312fe169 +PKG_SOURCE_DATE:=2022-01-29 +PKG_SOURCE_VERSION:=872c87c6805bea08677de71b744cce7deb24903e +PKG_MIRROR_HASH:=e9bb14bca59485345c9f109f6ee2aec709e4d29cd389e3b05447a91c06806cf8 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From 81a561b4a64d3d0107e82f49e52d4d0ff1a29719 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Wed, 5 Jan 2022 00:36:13 +0900 Subject: [PATCH 029/144] kernel: move bootargs-append patch to generic This moves bootargs-append support patch from ipq40xx and ipq806x to generic. This way we can append additional boot arguments from DTS instead of only being able to overwrite them. This is a preparation for kirkwood support of ipTIME NAS1. Signed-off-by: Sungbo Eo --- .../hack-5.10/920-device_tree_cmdline.patch} | 0 .../hack-5.4/920-device_tree_cmdline.patch} | 6 +++--- .../ipq806x/patches-5.10/900-arm-add-cmdline-override.patch | 4 ++-- .../patches-5.10/102-powerpc-add-cmdline-override.patch | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename target/linux/{ipq40xx/patches-5.10/997-device_tree_cmdline.patch => generic/hack-5.10/920-device_tree_cmdline.patch} (100%) rename target/linux/{ipq806x/patches-5.10/997-device_tree_cmdline.patch => generic/hack-5.4/920-device_tree_cmdline.patch} (62%) diff --git a/target/linux/ipq40xx/patches-5.10/997-device_tree_cmdline.patch b/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch similarity index 100% rename from target/linux/ipq40xx/patches-5.10/997-device_tree_cmdline.patch rename to target/linux/generic/hack-5.10/920-device_tree_cmdline.patch diff --git a/target/linux/ipq806x/patches-5.10/997-device_tree_cmdline.patch b/target/linux/generic/hack-5.4/920-device_tree_cmdline.patch similarity index 62% rename from target/linux/ipq806x/patches-5.10/997-device_tree_cmdline.patch rename to target/linux/generic/hack-5.4/920-device_tree_cmdline.patch index bdcba2a21c..3cc032fdd2 100644 --- a/target/linux/ipq806x/patches-5.10/997-device_tree_cmdline.patch +++ b/target/linux/generic/hack-5.4/920-device_tree_cmdline.patch @@ -1,6 +1,6 @@ --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1055,6 +1055,9 @@ int __init early_init_dt_scan_chosen(uns +@@ -1059,6 +1059,9 @@ int __init early_init_dt_scan_chosen(uns p = of_get_flat_dt_prop(node, "bootargs", &l); if (p != NULL && l > 0) strlcpy(data, p, min(l, COMMAND_LINE_SIZE)); @@ -8,5 +8,5 @@ + if (p != NULL && l > 0) + strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); - /* CONFIG_CMDLINE_OVERRIDE is used to fallback to a different - * device tree option of chosen/bootargs-override. This is + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else diff --git a/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch b/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch index 830a14924c..dba917872c 100644 --- a/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch +++ b/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch @@ -17,9 +17,9 @@ default "" --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1056,6 +1056,17 @@ int __init early_init_dt_scan_chosen(uns +@@ -1059,6 +1059,17 @@ int __init early_init_dt_scan_chosen(uns if (p != NULL && l > 0) - strlcpy(data, p, min(l, COMMAND_LINE_SIZE)); + strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); + /* CONFIG_CMDLINE_OVERRIDE is used to fallback to a different + * device tree option of chosen/bootargs-override. This is diff --git a/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch b/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch index 652e8ee6c3..a2fd800ced 100644 --- a/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch +++ b/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch @@ -17,9 +17,9 @@ help --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1056,6 +1056,17 @@ int __init early_init_dt_scan_chosen(uns +@@ -1059,6 +1059,17 @@ int __init early_init_dt_scan_chosen(uns if (p != NULL && l > 0) - strlcpy(data, p, min(l, COMMAND_LINE_SIZE)); + strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); + /* CONFIG_CMDLINE_OVERRIDE is used to fallback to a different + * device tree option of chosen/bootargs-override. This is From aaebc7aa2eff9a0bb9e843e472cb2eb94022f12e Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 1 Jan 2022 18:46:39 +0900 Subject: [PATCH 030/144] kirkwood: drop kernel 5.4 support It has been 3 months since we switched this target to 5.10, now we can remove the 5.4 files. Signed-off-by: Sungbo Eo --- target/linux/kirkwood/config-5.4 | 282 ---------- ...-kirkwood-Add-Check-Point-L-50-board.patch | 485 ------------------ .../kirkwood/patches-5.4/100-ib62x0.patch | 53 -- .../kirkwood/patches-5.4/101-iconnect.patch | 80 --- .../kirkwood/patches-5.4/102-dockstar.patch | 62 --- .../patches-5.4/103-iomega-ix2-200.patch | 67 --- .../patches-5.4/105-linksys-viper-dts.patch | 59 --- .../kirkwood/patches-5.4/106-goflexnet.patch | 53 -- ...-zyxel-nsa3x0-common-nand-partitions.patch | 48 -- .../kirkwood/patches-5.4/107-03-nsa325.patch | 54 -- .../patches-5.4/109-pogoplug_v4.patch | 87 ---- .../kirkwood/patches-5.4/110-pogo_e02.patch | 68 --- .../linux/kirkwood/patches-5.4/111-l-50.patch | 47 -- .../kirkwood/patches-5.4/112-sheevaplug.patch | 47 -- .../patches-5.4/113-readynas_duo_v2.patch | 76 --- ...able-sata-port-specific-led-triggers.patch | 10 - .../202-linksys-find-active-root.patch | 62 --- .../patches-5.4/203-blackarmor-nas220.patch | 99 ---- ...station-poweroff-prepare-for-new-dev.patch | 101 ---- ...-linkstation-poweroff-add-new-device.patch | 97 ---- 20 files changed, 1937 deletions(-) delete mode 100644 target/linux/kirkwood/config-5.4 delete mode 100644 target/linux/kirkwood/patches-5.4/001-ARM-dts-kirkwood-Add-Check-Point-L-50-board.patch delete mode 100644 target/linux/kirkwood/patches-5.4/100-ib62x0.patch delete mode 100644 target/linux/kirkwood/patches-5.4/101-iconnect.patch delete mode 100644 target/linux/kirkwood/patches-5.4/102-dockstar.patch delete mode 100644 target/linux/kirkwood/patches-5.4/103-iomega-ix2-200.patch delete mode 100644 target/linux/kirkwood/patches-5.4/105-linksys-viper-dts.patch delete mode 100644 target/linux/kirkwood/patches-5.4/106-goflexnet.patch delete mode 100644 target/linux/kirkwood/patches-5.4/107-01-zyxel-nsa3x0-common-nand-partitions.patch delete mode 100644 target/linux/kirkwood/patches-5.4/107-03-nsa325.patch delete mode 100644 target/linux/kirkwood/patches-5.4/109-pogoplug_v4.patch delete mode 100644 target/linux/kirkwood/patches-5.4/110-pogo_e02.patch delete mode 100644 target/linux/kirkwood/patches-5.4/111-l-50.patch delete mode 100644 target/linux/kirkwood/patches-5.4/112-sheevaplug.patch delete mode 100644 target/linux/kirkwood/patches-5.4/113-readynas_duo_v2.patch delete mode 100644 target/linux/kirkwood/patches-5.4/201-enable-sata-port-specific-led-triggers.patch delete mode 100644 target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch delete mode 100644 target/linux/kirkwood/patches-5.4/203-blackarmor-nas220.patch delete mode 100644 target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch delete mode 100644 target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch diff --git a/target/linux/kirkwood/config-5.4 b/target/linux/kirkwood/config-5.4 deleted file mode 100644 index 258ddce5cf..0000000000 --- a/target/linux/kirkwood/config-5.4 +++ /dev/null @@ -1,282 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MULTIPLATFORM=y -CONFIG_ARCH_MULTI_CPU_AUTO=y -# CONFIG_ARCH_MULTI_V4 is not set -# CONFIG_ARCH_MULTI_V4T is not set -CONFIG_ARCH_MULTI_V4_V5=y -CONFIG_ARCH_MULTI_V5=y -CONFIG_ARCH_MVEBU=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y -# CONFIG_ARMADA_37XX_WATCHDOG is not set -# CONFIG_ARMADA_THERMAL is not set -CONFIG_ARM_APPENDED_DTB=y -CONFIG_ARM_ATAG_DTB_COMPAT=y -CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y -CONFIG_ARM_HAS_SG_CHAIN=y -# CONFIG_ARM_KIRKWOOD_CPUIDLE is not set -CONFIG_ARM_L1_CACHE_SHIFT=5 -# CONFIG_ARM_MVEBU_V7_CPUIDLE is not set -CONFIG_ARM_PATCH_PHYS_VIRT=y -# CONFIG_ARM_THUMB is not set -CONFIG_ARM_UNWIND=y -CONFIG_ATA=y -CONFIG_ATAGS=y -CONFIG_ATA_LEDS=y -CONFIG_AUTO_ZRELADDR=y -CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y -CONFIG_BLK_DEV_SD=y -CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_SCSI_REQUEST=y -CONFIG_CACHE_FEROCEON_L2=y -# CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_MMIO=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_COMMON_CLK=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CPU_32v5=y -CONFIG_CPU_ABRT_EV5T=y -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_COPY_FEROCEON=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -CONFIG_CPU_FEROCEON=y -# CONFIG_CPU_FEROCEON_OLD_ID is not set -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_PABRT_LEGACY=y -CONFIG_CPU_PM=y -CONFIG_CPU_THUMB_CAPABLE=y -CONFIG_CPU_TLB_FEROCEON=y -CONFIG_CPU_USE_DOMAINS=y -CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_DES=y -CONFIG_CRYPTO_DEV_MARVELL_CESA=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_LIB_DES=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_RNG2=y -CONFIG_DEBUG_LL=y -CONFIG_DEBUG_LL_INCLUDE="debug/8250.S" -CONFIG_DEBUG_MVEBU_UART0_ALTERNATE=y -# CONFIG_DEBUG_MVEBU_UART1_ALTERNATE is not set -CONFIG_DEBUG_UART_8250=y -# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set -CONFIG_DEBUG_UART_8250_SHIFT=2 -# CONFIG_DEBUG_UART_8250_WORD is not set -CONFIG_DEBUG_UART_PHYS=0xf1012000 -CONFIG_DEBUG_UART_VIRT=0xfed12000 -CONFIG_DEBUG_UNCOMPRESS=y -# CONFIG_DLCI is not set -CONFIG_DMA_REMAP=y -CONFIG_DNOTIFY=y -CONFIG_DTC=y -# CONFIG_EARLY_PRINTK is not set -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FORCE_PCI=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GLOB=y -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_MVEBU=y -CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_OMAP=y -CONFIG_HZ_FIXED=0 -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MV64XXX=y -# CONFIG_I2C_PXA is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_KIRKWOOD_CLK=y -CONFIG_KIRKWOOD_THERMAL=y -CONFIG_LEDS_GPIO=y -CONFIG_LEDS_NETXBIG=y -CONFIG_LEDS_NS2=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MACH_KIRKWOOD=y -CONFIG_MACH_MVEBU_ANY=y -CONFIG_MANGLE_BOOTARGS=y -CONFIG_MARVELL_PHY=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MEMFD_CREATE=y -CONFIG_MIGRATION=y -CONFIG_MODULES_USE_ELF_REL=y -# CONFIG_MTD_CFI is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_NAND_CORE=y -CONFIG_MTD_NAND_ECC_SW_HAMMING=y -# CONFIG_MTD_NAND_MARVELL is not set -CONFIG_MTD_NAND_ORION=y -CONFIG_MTD_RAW_NAND=y -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MV643XX_ETH=y -CONFIG_MVEBU_CLK_COMMON=y -CONFIG_MVEBU_MBUS=y -CONFIG_MVMDIO=y -# CONFIG_MVNETA is not set -# CONFIG_MVPP2 is not set -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_KUSER_HELPERS=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_MV88E6XXX=y -CONFIG_NET_DSA_MV88E6XXX_GLOBAL2=y -CONFIG_NET_DSA_TAG_DSA=y -CONFIG_NET_DSA_TAG_EDSA=y -CONFIG_NET_SWITCHDEV=y -CONFIG_NLS=y -CONFIG_NVMEM=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_ORION_IRQCHIP=y -CONFIG_ORION_TIMER=y -CONFIG_ORION_WATCHDOG=y -CONFIG_OUTER_CACHE=y -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI=y -CONFIG_PCI_BRIDGE_EMUL=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_MVEBU=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PHYLINK=y -# CONFIG_PHY_MVEBU_A3700_UTMI is not set -# CONFIG_PHY_MVEBU_A38X_COMPHY is not set -CONFIG_PHY_MVEBU_SATA=y -CONFIG_PINCTRL=y -CONFIG_PINCTRL_KIRKWOOD=y -CONFIG_PINCTRL_MVEBU=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PINCTRL_SX150X=y -CONFIG_PLAT_ORION=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_GPIO=y -CONFIG_POWER_RESET_LINKSTATION=y -# CONFIG_POWER_RESET_QNAP is not set -CONFIG_POWER_SUPPLY=y -CONFIG_RATIONAL=y -CONFIG_REFCOUNT_FULL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_MV=y -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RTC_MC146818_LIB=y -CONFIG_SATA_PMP=y -CONFIG_SCSI=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_MCTRL_GPIO=y -# CONFIG_SERIAL_MVEBU_UART is not set -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SGL_ALLOC=y -CONFIG_SG_POOL=y -CONFIG_SOC_BUS=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -# CONFIG_SPI_ARMADA_3700 is not set -CONFIG_SPI_MASTER=y -CONFIG_SPI_ORION=y -CONFIG_SPLIT_PTLOCK_CPUS=999999 -CONFIG_SRAM=y -CONFIG_SRAM_EXEC=y -CONFIG_SRCU=y -CONFIG_SWPHY=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_THERMAL=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -CONFIG_THERMAL_GOV_STEP_WISE=y -CONFIG_THERMAL_OF=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TINY_SRCU=y -CONFIG_UBIFS_FS=y -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_UNWINDER_ARM=y -CONFIG_USB=y -CONFIG_USB_COMMON=y -CONFIG_USB_LED_TRIG=y -CONFIG_USB_SUPPORT=y -CONFIG_USE_OF=y -# CONFIG_VFP is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WAN=y -CONFIG_WATCHDOG_CORE=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/kirkwood/patches-5.4/001-ARM-dts-kirkwood-Add-Check-Point-L-50-board.patch b/target/linux/kirkwood/patches-5.4/001-ARM-dts-kirkwood-Add-Check-Point-L-50-board.patch deleted file mode 100644 index 52caee7b40..0000000000 --- a/target/linux/kirkwood/patches-5.4/001-ARM-dts-kirkwood-Add-Check-Point-L-50-board.patch +++ /dev/null @@ -1,485 +0,0 @@ -From efa968c18abab78c5e0c40a853caf286c3629a59 Mon Sep 17 00:00:00 2001 -From: Pawel Dembicki -Date: Tue, 17 Mar 2020 21:28:01 +0100 -Subject: [PATCH v3] ARM: dts: kirkwood: Add Check Point L-50 board - -This patch adds dts for the Check Point L-50 from 600/1100 series -routers. - -Specification: --CPU: Marvell Kirkwood 88F6821 1200MHz --RAM: 512MB --Flash: NAND 512MB --WiFi: mPCIe card based on Atheros AR9287 b/g/n --WAN: 1 Gigabit Port (Marvell 88E1116R PHY) --LAN: 9 Gigabit Ports (2x Marvell 88E6171(5+3)) --USB: 2x USB2.0 --Express card slot --SD card slot --Serial console: RJ-45 115200 8n1 --Unsupported DSL - -Reviewed-by: Andrew Lunn -Signed-off-by: Pawel Dembicki ---- -Changes in v3: -- fix typo and code style issues pointed by OpenWrt guys -Changes in v2: -- none - - arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/kirkwood-l-50.dts | 438 ++++++++++++++++++++++++++++ - 2 files changed, 439 insertions(+) - create mode 100644 arch/arm/boot/dts/kirkwood-l-50.dts - ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -270,6 +270,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \ - kirkwood-iomega_ix2_200.dtb \ - kirkwood-is2.dtb \ - kirkwood-km_kirkwood.dtb \ -+ kirkwood-l-50.dtb \ - kirkwood-laplug.dtb \ - kirkwood-linkstation-lsqvl.dtb \ - kirkwood-linkstation-lsvl.dtb \ ---- /dev/null -+++ b/arch/arm/boot/dts/kirkwood-l-50.dts -@@ -0,0 +1,438 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Check Point L-50 Board Description -+ * Copyright 2020 Pawel Dembicki -+ */ -+ -+/dts-v1/; -+ -+#include "kirkwood.dtsi" -+#include "kirkwood-6281.dtsi" -+ -+/ { -+ model = "Check Point L-50"; -+ compatible = "checkpoint,l-50", "marvell,kirkwood-88f6281", "marvell,kirkwood"; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x20000000>; -+ }; -+ -+ chosen { -+ bootargs = "console=ttyS0,115200n8"; -+ stdout-path = &uart0; -+ }; -+ -+ ocp@f1000000 { -+ pinctrl: pin-controller@10000 { -+ pinctrl-0 = <&pmx_led38 &pmx_sysrst &pmx_button29>; -+ pinctrl-names = "default"; -+ -+ pmx_sysrst: pmx-sysrst { -+ marvell,pins = "mpp6"; -+ marvell,function = "sysrst"; -+ }; -+ -+ pmx_button29: pmx_button29 { -+ marvell,pins = "mpp29"; -+ marvell,function = "gpio"; -+ }; -+ -+ pmx_led38: pmx_led38 { -+ marvell,pins = "mpp38"; -+ marvell,function = "gpio"; -+ }; -+ -+ pmx_sdio_cd: pmx-sdio-cd { -+ marvell,pins = "mpp46"; -+ marvell,function = "gpio"; -+ }; -+ }; -+ -+ serial@12000 { -+ status = "okay"; -+ }; -+ -+ mvsdio@90000 { -+ status = "okay"; -+ cd-gpios = <&gpio1 14 9>; -+ }; -+ -+ i2c@11000 { -+ status = "okay"; -+ clock-frequency = <400000>; -+ -+ gpio2: gpio-expander@20{ -+ #gpio-cells = <2>; -+ #interrupt-cells = <2>; -+ compatible = "semtech,sx1505q"; -+ reg = <0x20>; -+ -+ gpio-controller; -+ }; -+ -+ /* Three GPIOs from 0x21 exp. are undescribed in dts: -+ * 1: DSL module reset (active low) -+ * 5: mPCIE reset (active low) -+ * 6: Express card reset (active low) -+ */ -+ gpio3: gpio-expander@21{ -+ #gpio-cells = <2>; -+ #interrupt-cells = <2>; -+ compatible = "semtech,sx1505q"; -+ reg = <0x21>; -+ -+ gpio-controller; -+ }; -+ -+ rtc@30 { -+ compatible = "s35390a"; -+ reg = <0x30>; -+ }; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ status_green { -+ label = "l-50:green:status"; -+ gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; -+ }; -+ -+ status_red { -+ label = "l-50:red:status"; -+ gpios = <&gpio3 2 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wifi { -+ label = "l-50:green:wifi"; -+ gpios = <&gpio2 7 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "phy0tpt"; -+ }; -+ -+ internet_green { -+ label = "l-50:green:internet"; -+ gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; -+ }; -+ -+ internet_red { -+ label = "l-50:red:internet"; -+ gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; -+ }; -+ -+ usb1_green { -+ label = "l-50:green:usb1"; -+ gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "usbport"; -+ trigger-sources = <&hub_port3>; -+ }; -+ -+ usb1_red { -+ label = "l-50:red:usb1"; -+ gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; -+ }; -+ -+ usb2_green { -+ label = "l-50:green:usb2"; -+ gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "usbport"; -+ trigger-sources = <&hub_port1>; -+ }; -+ -+ usb2_red { -+ label = "l-50:red:usb2"; -+ gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ usb2_pwr { -+ compatible = "regulator-fixed"; -+ regulator-name = "usb2_pwr"; -+ -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ gpio = <&gpio3 3 GPIO_ACTIVE_LOW>; -+ regulator-always-on; -+ }; -+ -+ usb1_pwr { -+ compatible = "regulator-fixed"; -+ regulator-name = "usb1_pwr"; -+ -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ gpio = <&gpio3 4 GPIO_ACTIVE_LOW>; -+ regulator-always-on; -+ }; -+ -+ mpcie_pwr { -+ compatible = "regulator-fixed"; -+ regulator-name = "mpcie_pwr"; -+ -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ gpio = <&gpio3 5 GPIO_ACTIVE_HIGH>; -+ enable-active-high; -+ regulator-always-on; -+ }; -+ -+ express_card_pwr { -+ compatible = "regulator-fixed"; -+ regulator-name = "express_card_pwr"; -+ -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ gpio = <&gpio3 7 GPIO_ACTIVE_HIGH>; -+ enable-active-high; -+ regulator-always-on; -+ }; -+ -+ keys { -+ compatible = "gpio-keys"; -+ -+ factory_defaults { -+ label = "factory_defaults"; -+ gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; -+ linux,code = ; -+ }; -+ }; -+}; -+ -+&mdio { -+ status = "okay"; -+ -+ ethphy8: ethernet-phy@8 { -+ reg = <0x08>; -+ }; -+ -+ switch0: switch@10 { -+ compatible = "marvell,mv88e6085"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0x10>; -+ dsa,member = <0 0>; -+ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ port@0 { -+ reg = <0>; -+ label = "lan5"; -+ }; -+ -+ port@1 { -+ reg = <1>; -+ label = "lan1"; -+ }; -+ -+ port@2 { -+ reg = <2>; -+ label = "lan6"; -+ }; -+ -+ port@3 { -+ reg = <3>; -+ label = "lan2"; -+ }; -+ -+ port@4 { -+ reg = <4>; -+ label = "lan7"; -+ }; -+ -+ switch0port5: port@5 { -+ reg = <5>; -+ phy-mode = "rgmii-txid"; -+ link = <&switch1port5>; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+ }; -+ -+ port@6 { -+ reg = <6>; -+ label = "cpu"; -+ phy-mode = "rgmii-id"; -+ ethernet = <ð1port>; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+ }; -+ }; -+ }; -+ -+ switch@11 { -+ compatible = "marvell,mv88e6085"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0x11>; -+ dsa,member = <0 1>; -+ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ port@0 { -+ reg = <0>; -+ label = "lan3"; -+ }; -+ -+ port@1 { -+ reg = <1>; -+ label = "lan8"; -+ }; -+ -+ port@2 { -+ reg = <2>; -+ label = "lan4"; -+ }; -+ -+ port@3 { -+ reg = <3>; -+ label = "dmz"; -+ }; -+ -+ switch1port5: port@5 { -+ reg = <5>; -+ phy-mode = "rgmii-txid"; -+ link = <&switch0port5>; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+ }; -+ -+ port@6 { -+ reg = <6>; -+ label = "dsl"; -+ fixed-link { -+ speed = <100>; -+ full-duplex; -+ }; -+ }; -+ }; -+ }; -+}; -+ -+ð0 { -+ status = "okay"; -+ ethernet0-port@0 { -+ phy-handle = <ðphy8>; -+ }; -+}; -+ -+ð1 { -+ status = "okay"; -+ ethernet1-port@0 { -+ speed = <1000>; -+ duplex = <1>; -+ }; -+}; -+ -+&nand { -+ status = "okay"; -+ pinctrl-0 = <&pmx_nand>; -+ pinctrl-names = "default"; -+ -+ partition@0 { -+ label = "u-boot"; -+ reg = <0x00000000 0x000c0000>; -+ }; -+ -+ partition@a0000 { -+ label = "bootldr-env"; -+ reg = <0x000c0000 0x00040000>; -+ }; -+ -+ partition@100000 { -+ label = "kernel-1"; -+ reg = <0x00100000 0x00800000>; -+ }; -+ -+ partition@900000 { -+ label = "rootfs-1"; -+ reg = <0x00900000 0x07100000>; -+ }; -+ -+ partition@7a00000 { -+ label = "kernel-2"; -+ reg = <0x07a00000 0x00800000>; -+ }; -+ -+ partition@8200000 { -+ label = "rootfs-2"; -+ reg = <0x08200000 0x07100000>; -+ }; -+ -+ partition@f300000 { -+ label = "default_sw"; -+ reg = <0x0f300000 0x07900000>; -+ }; -+ -+ partition@16c00000 { -+ label = "logs"; -+ reg = <0x16c00000 0x01800000>; -+ }; -+ -+ partition@18400000 { -+ label = "preset_cfg"; -+ reg = <0x18400000 0x00100000>; -+ }; -+ -+ partition@18500000 { -+ label = "adsl"; -+ reg = <0x18500000 0x00100000>; -+ }; -+ -+ partition@18600000 { -+ label = "storage"; -+ reg = <0x18600000 0x07a00000>; -+ }; -+}; -+ -+&rtc { -+ status = "disabled"; -+}; -+ -+&pciec { -+ status = "okay"; -+}; -+ -+&pcie0 { -+ status = "okay"; -+}; -+ -+&sata_phy0 { -+ status = "disabled"; -+}; -+ -+&sata_phy1 { -+ status = "disabled"; -+}; -+ -+&usb0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ port@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ #trigger-source-cells = <0>; -+ -+ hub_port1: port@1 { -+ reg = <1>; -+ #trigger-source-cells = <0>; -+ }; -+ -+ hub_port3: port@3 { -+ reg = <3>; -+ #trigger-source-cells = <0>; -+ }; -+ }; -+}; diff --git a/target/linux/kirkwood/patches-5.4/100-ib62x0.patch b/target/linux/kirkwood/patches-5.4/100-ib62x0.patch deleted file mode 100644 index 0637c24b63..0000000000 --- a/target/linux/kirkwood/patches-5.4/100-ib62x0.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-ib62x0.dts -+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts -@@ -6,7 +6,14 @@ - - / { - model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)"; -- compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "marvell,kirkwood-88f6281", "marvell,kirkwood"; -+ compatible = "raidsonic,ib-nas62x0", "marvell,kirkwood-88f6281", "marvell,kirkwood"; -+ -+ aliases { -+ led-boot = &led_green_os; -+ led-failsafe = &led_red_os; -+ led-running = &led_green_os; -+ led-upgrade = &led_red_os; -+ }; - - memory { - device_type = "memory"; -@@ -81,12 +88,12 @@ - &pmx_led_usb_transfer>; - pinctrl-names = "default"; - -- green-os { -+ led_green_os: green-os { - label = "ib62x0:green:os"; - gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; -- default-state = "keep"; -+ default-state = "on"; - }; -- red-os { -+ led_red_os: red-os { - label = "ib62x0:red:os"; - gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; - }; -@@ -118,13 +125,13 @@ - }; - - partition@100000 { -- label = "uImage"; -- reg = <0x0100000 0x600000>; -+ label = "second stage u-boot"; -+ reg = <0x100000 0x200000>; - }; - -- partition@700000 { -- label = "root"; -- reg = <0x0700000 0xf900000>; -+ partition@200000 { -+ label = "ubi"; -+ reg = <0x200000 0xfe00000>; - }; - - }; diff --git a/target/linux/kirkwood/patches-5.4/101-iconnect.patch b/target/linux/kirkwood/patches-5.4/101-iconnect.patch deleted file mode 100644 index 935e2dfcf5..0000000000 --- a/target/linux/kirkwood/patches-5.4/101-iconnect.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-iconnect.dts -+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts -@@ -8,6 +8,13 @@ - model = "Iomega Iconnect"; - compatible = "iom,iconnect-1.1", "iom,iconnect", "marvell,kirkwood-88f6281", "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_power_blue; -+ led-failsafe = &led_power_red; -+ led-running = &led_power_blue; -+ led-upgrade = &led_power_red; -+ }; -+ - memory { - device_type = "memory"; - reg = <0x00000000 0x10000000>; -@@ -16,8 +23,6 @@ - chosen { - bootargs = "console=ttyS0,115200n8 earlyprintk"; - stdout-path = &uart0; -- linux,initrd-start = <0x4500040>; -- linux,initrd-end = <0x4800000>; - }; - - ocp@f1000000 { -@@ -89,12 +94,12 @@ - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; - default-state = "on"; - }; -- power-blue { -+ led_power_blue: power-blue { - label = "power:blue"; - gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; -- default-state = "keep"; -+ default-state = "on"; - }; -- power-red { -+ led_power_red: power-red { - label = "power:red"; - gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; - }; -@@ -146,28 +151,23 @@ - status = "okay"; - - partition@0 { -- label = "uboot"; -- reg = <0x0000000 0xc0000>; -+ label = "u-boot"; -+ reg = <0x0000000 0xe0000>; - }; - -- partition@a0000 { -- label = "env"; -- reg = <0xa0000 0x20000>; -+ partition@e0000 { -+ label = "u-boot environment"; -+ reg = <0xe0000 0x100000>; - }; - - partition@100000 { -- label = "zImage"; -- reg = <0x100000 0x300000>; -- }; -- -- partition@540000 { -- label = "initrd"; -- reg = <0x540000 0x300000>; -+ label = "second stage u-boot"; -+ reg = <0x100000 0x200000>; - }; - -- partition@980000 { -- label = "boot"; -- reg = <0x980000 0x1f400000>; -+ partition@200000 { -+ label = "ubi"; -+ reg = <0x200000 0x1fe00000>; - }; - }; - diff --git a/target/linux/kirkwood/patches-5.4/102-dockstar.patch b/target/linux/kirkwood/patches-5.4/102-dockstar.patch deleted file mode 100644 index 127f84962c..0000000000 --- a/target/linux/kirkwood/patches-5.4/102-dockstar.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-dockstar.dts -+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts -@@ -8,6 +8,13 @@ - model = "Seagate FreeAgent Dockstar"; - compatible = "seagate,dockstar", "marvell,kirkwood-88f6281", "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_health; -+ led-failsafe = &led_fault; -+ led-running = &led_health; -+ led-upgrade = &led_fault; -+ }; -+ - memory { - device_type = "memory"; - reg = <0x00000000 0x8000000>; -@@ -42,12 +49,12 @@ - pinctrl-0 = <&pmx_led_green &pmx_led_orange>; - pinctrl-names = "default"; - -- health { -+ led_health: health { - label = "status:green:health"; - gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; -- default-state = "keep"; -+ default-state = "on"; - }; -- fault { -+ led_fault: fault { - label = "status:orange:fault"; - gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; - }; -@@ -78,18 +85,22 @@ - - partition@0 { - label = "u-boot"; -- reg = <0x0000000 0x100000>; -- read-only; -+ reg = <0x0000000 0xe0000>; -+ }; -+ -+ partition@e0000 { -+ label = "u-boot environment"; -+ reg = <0xe0000 0x100000>; - }; - - partition@100000 { -- label = "uImage"; -- reg = <0x0100000 0x400000>; -+ label = "second stage u-boot"; -+ reg = <0x100000 0x200000>; - }; - -- partition@500000 { -- label = "data"; -- reg = <0x0500000 0xfb00000>; -+ partition@200000 { -+ label = "ubi"; -+ reg = <0x200000 0xfe00000>; - }; - }; - diff --git a/target/linux/kirkwood/patches-5.4/103-iomega-ix2-200.patch b/target/linux/kirkwood/patches-5.4/103-iomega-ix2-200.patch deleted file mode 100644 index 9313b4bc3e..0000000000 --- a/target/linux/kirkwood/patches-5.4/103-iomega-ix2-200.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts -+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts -@@ -8,6 +8,13 @@ - model = "Iomega StorCenter ix2-200"; - compatible = "iom,ix2-200", "marvell,kirkwood-88f6281", "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_power; -+ led-failsafe = &led_health; -+ led-running = &led_power; -+ led-upgrade = &led_health; -+ }; -+ - memory { - device_type = "memory"; - reg = <0x00000000 0x10000000>; -@@ -127,16 +134,16 @@ - &pmx_led_rebuild &pmx_led_health >; - pinctrl-names = "default"; - -- power_led { -+ led_power: power_led { - label = "status:white:power_led"; - gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; -- default-state = "keep"; -+ default-state = "on"; - }; - rebuild_led { - label = "status:white:rebuild_led"; - gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; - }; -- health_led { -+ led_health: health_led { - label = "status:red:health_led"; - gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; - }; -@@ -186,18 +193,18 @@ - }; - - partition@a0000 { -- label = "env"; -+ label = "u-boot environment"; - reg = <0xa0000 0x20000>; - read-only; - }; - - partition@100000 { -- label = "uImage"; -+ label = "kernel"; - reg = <0x100000 0x300000>; - }; - - partition@400000 { -- label = "rootfs"; -+ label = "ubi"; - reg = <0x400000 0x1C00000>; - }; - }; -@@ -211,7 +218,7 @@ - }; - - ð0 { -- status = "okay"; -+ status = "disabled"; - ethernet0-port@0 { - speed = <1000>; - duplex = <1>; diff --git a/target/linux/kirkwood/patches-5.4/105-linksys-viper-dts.patch b/target/linux/kirkwood/patches-5.4/105-linksys-viper-dts.patch deleted file mode 100644 index d56a469d94..0000000000 --- a/target/linux/kirkwood/patches-5.4/105-linksys-viper-dts.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-linksys-viper.dts -+++ b/arch/arm/boot/dts/kirkwood-linksys-viper.dts -@@ -24,6 +24,10 @@ - }; - - aliases { -+ led-boot = &led_white_health; -+ led-failsafe = &led_white_health; -+ led-running = &led_white_health; -+ led-upgrade = &led_white_health; - serial0 = &uart0; - }; - -@@ -56,9 +60,10 @@ - pinctrl-0 = < &pmx_led_white_health &pmx_led_white_pulse >; - pinctrl-names = "default"; - -- white-health { -+ led_white_health: white-health { - label = "viper:white:health"; - gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; - }; - - white-pulse { -@@ -114,23 +119,23 @@ - }; - - partition@200000 { -- label = "kernel"; -- reg = <0x200000 0x2A0000>; -+ label = "kernel1"; -+ reg = <0x200000 0x1A00000>; - }; - -- partition@4a0000 { -- label = "rootfs"; -- reg = <0x4A0000 0x1760000>; -+ partition@500000 { -+ label = "rootfs1"; -+ reg = <0x500000 0x1700000>; - }; - - partition@1c00000 { -- label = "alt_kernel"; -- reg = <0x1C00000 0x2A0000>; -+ label = "kernel2"; -+ reg = <0x1C00000 0x1A00000>; - }; - -- partition@1ea0000 { -- label = "alt_rootfs"; -- reg = <0x1EA0000 0x1760000>; -+ partition@1f00000 { -+ label = "rootfs2"; -+ reg = <0x1F00000 0x1700000>; - }; - - partition@3600000 { diff --git a/target/linux/kirkwood/patches-5.4/106-goflexnet.patch b/target/linux/kirkwood/patches-5.4/106-goflexnet.patch deleted file mode 100644 index 82cf90841e..0000000000 --- a/target/linux/kirkwood/patches-5.4/106-goflexnet.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-goflexnet.dts -+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts -@@ -8,6 +8,13 @@ - model = "Seagate GoFlex Net"; - compatible = "seagate,goflexnet", "marvell,kirkwood-88f6281", "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_health; -+ led-failsafe = &led_fault; -+ led-running = &led_health; -+ led-upgrade = &led_fault; -+ }; -+ - memory { - device_type = "memory"; - reg = <0x00000000 0x8000000>; -@@ -85,12 +92,12 @@ - >; - pinctrl-names = "default"; - -- health { -+ led_health: health { - label = "status:green:health"; - gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; -- default-state = "keep"; -+ default-state = "on"; - }; -- fault { -+ led_fault: fault { - label = "status:orange:fault"; - gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; - }; -@@ -159,18 +166,8 @@ - }; - - partition@100000 { -- label = "uImage"; -- reg = <0x0100000 0x400000>; -- }; -- -- partition@500000 { -- label = "pogoplug"; -- reg = <0x0500000 0x2000000>; -- }; -- -- partition@2500000 { -- label = "root"; -- reg = <0x02500000 0xd800000>; -+ label = "ubi"; -+ reg = <0x0100000 0x0ff00000>; - }; - }; - diff --git a/target/linux/kirkwood/patches-5.4/107-01-zyxel-nsa3x0-common-nand-partitions.patch b/target/linux/kirkwood/patches-5.4/107-01-zyxel-nsa3x0-common-nand-partitions.patch deleted file mode 100644 index df654033fd..0000000000 --- a/target/linux/kirkwood/patches-5.4/107-01-zyxel-nsa3x0-common-nand-partitions.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-nsa3x0-common.dtsi -+++ b/arch/arm/boot/dts/kirkwood-nsa3x0-common.dtsi -@@ -112,40 +112,16 @@ - - partition@0 { - label = "uboot"; -- reg = <0x0000000 0x0100000>; -+ reg = <0x0000000 0x00c0000>; - read-only; - }; - partition@100000 { - label = "uboot_env"; -- reg = <0x0100000 0x0080000>; -+ reg = <0x00c0000 0x0080000>; - }; -- partition@180000 { -- label = "key_store"; -- reg = <0x0180000 0x0080000>; -- }; -- partition@200000 { -- label = "info"; -- reg = <0x0200000 0x0080000>; -- }; -- partition@280000 { -- label = "etc"; -- reg = <0x0280000 0x0a00000>; -- }; -- partition@c80000 { -- label = "kernel_1"; -- reg = <0x0c80000 0x0a00000>; -- }; -- partition@1680000 { -- label = "rootfs1"; -- reg = <0x1680000 0x2fc0000>; -- }; -- partition@4640000 { -- label = "kernel_2"; -- reg = <0x4640000 0x0a00000>; -- }; -- partition@5040000 { -- label = "rootfs2"; -- reg = <0x5040000 0x2fc0000>; -+ partition@140000 { -+ label = "ubi"; -+ reg = <0x0140000 0x7ec0000>; - }; - }; - diff --git a/target/linux/kirkwood/patches-5.4/107-03-nsa325.patch b/target/linux/kirkwood/patches-5.4/107-03-nsa325.patch deleted file mode 100644 index 374c0895a9..0000000000 --- a/target/linux/kirkwood/patches-5.4/107-03-nsa325.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-nsa325.dts -+++ b/arch/arm/boot/dts/kirkwood-nsa325.dts -@@ -15,6 +15,13 @@ - model = "ZyXEL NSA325"; - compatible = "zyxel,nsa325", "marvell,kirkwood-88f6282", "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_green_sys; -+ led-failsafe = &led_orange_sys; -+ led-running = &led_green_sys; -+ led-upgrade = &led_orange_sys; -+ }; -+ - memory { - device_type = "memory"; - reg = <0x00000000 0x20000000>; -@@ -162,17 +169,19 @@ - &pmx_led_hdd1_green &pmx_led_hdd1_red>; - pinctrl-names = "default"; - -- green-sys { -+ led_green_sys: green-sys { - label = "nsa325:green:sys"; - gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; - }; -- orange-sys { -+ led_orange_sys: orange-sys { - label = "nsa325:orange:sys"; - gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; - }; - green-hdd1 { - label = "nsa325:green:hdd1"; - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "ata1"; - }; - red-hdd1 { - label = "nsa325:red:hdd1"; -@@ -181,6 +190,7 @@ - green-hdd2 { - label = "nsa325:green:hdd2"; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "ata2"; - }; - red-hdd2 { - label = "nsa325:red:hdd2"; -@@ -189,6 +199,7 @@ - green-usb { - label = "nsa325:green:usb"; - gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "usb-host"; - }; - green-copy { - label = "nsa325:green:copy"; diff --git a/target/linux/kirkwood/patches-5.4/109-pogoplug_v4.patch b/target/linux/kirkwood/patches-5.4/109-pogoplug_v4.patch deleted file mode 100644 index 4273eb9af1..0000000000 --- a/target/linux/kirkwood/patches-5.4/109-pogoplug_v4.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-pogoplug-series-4.dts -+++ b/arch/arm/boot/dts/kirkwood-pogoplug-series-4.dts -@@ -18,12 +18,20 @@ - compatible = "cloudengines,pogoplugv4", "marvell,kirkwood-88f6192", - "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_health; -+ led-failsafe = &led_fault; -+ led-running = &led_health; -+ led-upgrade = &led_fault; -+ }; -+ - memory { - device_type = "memory"; - reg = <0x00000000 0x08000000>; - }; - - chosen { -+ bootargs = "console=ttyS0,115200"; - stdout-path = "uart0:115200n8"; - }; - -@@ -37,8 +45,8 @@ - eject { - debounce-interval = <50>; - wakeup-source; -- linux,code = ; -- label = "Eject Button"; -+ linux,code = ; -+ label = "Reset"; - gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; - }; - }; -@@ -48,12 +56,12 @@ - pinctrl-0 = <&pmx_led_green &pmx_led_red>; - pinctrl-names = "default"; - -- health { -+ led_health: health { - label = "pogoplugv4:green:health"; - gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; -- fault { -+ led_fault: fault { - label = "pogoplugv4:red:fault"; - gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; - }; -@@ -137,29 +145,19 @@ - #size-cells = <1>; - - partition@0 { -- label = "u-boot"; -- reg = <0x00000000 0x200000>; -+ label = "uboot"; -+ reg = <0x00000000 0x1c0000>; - read-only; - }; - -- partition@200000 { -- label = "uImage"; -- reg = <0x00200000 0x300000>; -- }; -- -- partition@500000 { -- label = "uImage2"; -- reg = <0x00500000 0x300000>; -- }; -- -- partition@800000 { -- label = "failsafe"; -- reg = <0x00800000 0x800000>; -+ partition@1c0000 { -+ label = "uboot_env"; -+ reg = <0x001c0000 0x40000>; - }; - -- partition@1000000 { -- label = "root"; -- reg = <0x01000000 0x7000000>; -+ partition@200000 { -+ label = "ubi"; -+ reg = <0x00200000 0x7e00000>; - }; - }; - }; diff --git a/target/linux/kirkwood/patches-5.4/110-pogo_e02.patch b/target/linux/kirkwood/patches-5.4/110-pogo_e02.patch deleted file mode 100644 index fc384d3521..0000000000 --- a/target/linux/kirkwood/patches-5.4/110-pogo_e02.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-pogo_e02.dts -+++ b/arch/arm/boot/dts/kirkwood-pogo_e02.dts -@@ -20,6 +20,13 @@ - compatible = "cloudengines,pogoe02", "marvell,kirkwood-88f6281", - "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_health; -+ led-failsafe = &led_fault; -+ led-running = &led_health; -+ led-upgrade = &led_fault; -+ }; -+ - memory { - device_type = "memory"; - reg = <0x00000000 0x10000000>; -@@ -33,12 +40,12 @@ - gpio-leds { - compatible = "gpio-leds"; - -- health { -+ led_health: health { - label = "pogo_e02:green:health"; - gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; -- default-state = "keep"; -+ default-state = "on"; - }; -- fault { -+ led_fault: fault { - label = "pogo_e02:orange:fault"; - gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; - }; -@@ -95,24 +102,24 @@ - status = "okay"; - - partition@0 { -- label = "u-boot"; -- reg = <0x0000000 0x100000>; -+ label = "uboot"; -+ reg = <0x0 0xe0000>; - read-only; - }; - -- partition@100000 { -- label = "uImage"; -- reg = <0x0100000 0x400000>; -+ partition@e0000 { -+ label = "uboot_env"; -+ reg = <0xe0000 0x20000>; - }; - -- partition@500000 { -- label = "pogoplug"; -- reg = <0x0500000 0x2000000>; -+ partition@100000 { -+ label = "second_stage_uboot"; -+ reg = <0x100000 0x100000>; - }; - -- partition@2500000 { -- label = "root"; -- reg = <0x02500000 0x5b00000>; -+ partition@200000 { -+ label = "ubi"; -+ reg = <0x200000 0x7e00000>; - }; - }; - diff --git a/target/linux/kirkwood/patches-5.4/111-l-50.patch b/target/linux/kirkwood/patches-5.4/111-l-50.patch deleted file mode 100644 index bc933cb610..0000000000 --- a/target/linux/kirkwood/patches-5.4/111-l-50.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-l-50.dts -+++ b/arch/arm/boot/dts/kirkwood-l-50.dts -@@ -18,6 +18,13 @@ - reg = <0x00000000 0x20000000>; - }; - -+ aliases { -+ led-boot = &led_status_green; -+ led-failsafe = &led_status_red; -+ led-running = &led_status_green; -+ led-upgrade = &led_status_red; -+ }; -+ - chosen { - bootargs = "console=ttyS0,115200n8"; - stdout-path = &uart0; -@@ -95,12 +102,12 @@ - leds { - compatible = "gpio-leds"; - -- status_green { -+ led_status_green: status_green { - label = "l-50:green:status"; - gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; - }; - -- status_red { -+ led_status_red: status_red { - label = "l-50:red:status"; - gpios = <&gpio3 2 GPIO_ACTIVE_LOW>; - }; -@@ -349,13 +356,8 @@ - }; - - partition@100000 { -- label = "kernel-1"; -- reg = <0x00100000 0x00800000>; -- }; -- -- partition@900000 { -- label = "rootfs-1"; -- reg = <0x00900000 0x07100000>; -+ label = "ubi"; -+ reg = <0x00100000 0x07900000>; - }; - - partition@7a00000 { diff --git a/target/linux/kirkwood/patches-5.4/112-sheevaplug.patch b/target/linux/kirkwood/patches-5.4/112-sheevaplug.patch deleted file mode 100644 index d1ff9884a0..0000000000 --- a/target/linux/kirkwood/patches-5.4/112-sheevaplug.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi -+++ b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi -@@ -78,13 +78,8 @@ - }; - - partition@100000 { -- label = "uImage"; -- reg = <0x0100000 0x400000>; -- }; -- -- partition@500000 { -- label = "root"; -- reg = <0x0500000 0x1fb00000>; -+ label = "ubi"; -+ reg = <0x0100000 0x1ff00000>; - }; - }; - ---- a/arch/arm/boot/dts/kirkwood-sheevaplug.dts -+++ b/arch/arm/boot/dts/kirkwood-sheevaplug.dts -@@ -13,6 +13,13 @@ - model = "Globalscale Technologies SheevaPlug"; - compatible = "globalscale,sheevaplug", "marvell,kirkwood-88f6281", "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_health; -+ led-failsafe = &led_health; -+ led-running = &led_health; -+ led-upgrade = &led_health; -+ }; -+ - ocp@f1000000 { - mvsdio@90000 { - pinctrl-0 = <&pmx_sdio>; -@@ -28,10 +35,10 @@ - pinctrl-0 = <&pmx_led_blue &pmx_led_red>; - pinctrl-names = "default"; - -- health { -+ led_health: health { - label = "sheevaplug:blue:health"; - gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; -- default-state = "keep"; -+ default-state = "on"; - }; - - misc { diff --git a/target/linux/kirkwood/patches-5.4/113-readynas_duo_v2.patch b/target/linux/kirkwood/patches-5.4/113-readynas_duo_v2.patch deleted file mode 100644 index c6452c55a3..0000000000 --- a/target/linux/kirkwood/patches-5.4/113-readynas_duo_v2.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts -+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts -@@ -19,6 +19,13 @@ - reg = <0x00000000 0x10000000>; - }; - -+ aliases { -+ led-boot = &led_power; -+ led-failsafe = &led_power; -+ led-running = &led_power; -+ led-upgrade = &led_power; -+ }; -+ - chosen { - bootargs = "console=ttyS0,115200n8 earlyprintk"; - stdout-path = &uart0; -@@ -115,7 +122,7 @@ - &pmx_led_blue_backup >; - pinctrl-names = "default"; - -- power_led { -+ led_power: power_led { - label = "status:blue:power_led"; - gpios = <&gpio0 31 GPIO_ACTIVE_LOW>; - default-state = "keep"; -@@ -129,11 +136,13 @@ - disk1_led { - label = "status:blue:disk1_led"; - gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "ata1"; - }; - - disk2_led { - label = "status:blue:disk2_led"; - gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "ata2"; - }; - - backup_led { -@@ -150,7 +159,13 @@ - - power-button { - label = "Power Button"; -- linux,code = ; -+ /* Power button and INT pin from PHY are both connected -+ * to this GPIO. Every network restart causes PHY restart -+ * and button is pressed. It's difficult to use it as -+ * KEY_POWER without changes in kernel (or netifd) so -+ * the button is configured as regular one. -+ */ -+ linux,code = ; - gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; - }; - -@@ -208,18 +223,13 @@ - }; - - partition@200000 { -- label = "uImage"; -+ label = "kernel"; - reg = <0x0200000 0x600000>; - }; - - partition@800000 { -- label = "minirootfs"; -- reg = <0x0800000 0x1000000>; -- }; -- -- partition@1800000 { -- label = "jffs2"; -- reg = <0x1800000 0x6800000>; -+ label = "ubi"; -+ reg = <0x0800000 0x7800000>; - }; - }; - diff --git a/target/linux/kirkwood/patches-5.4/201-enable-sata-port-specific-led-triggers.patch b/target/linux/kirkwood/patches-5.4/201-enable-sata-port-specific-led-triggers.patch deleted file mode 100644 index c1645367a4..0000000000 --- a/target/linux/kirkwood/patches-5.4/201-enable-sata-port-specific-led-triggers.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/arm/mach-mvebu/Kconfig -+++ b/arch/arm/mach-mvebu/Kconfig -@@ -119,6 +119,7 @@ config MACH_DOVE - config MACH_KIRKWOOD - bool "Marvell Kirkwood boards" - depends on ARCH_MULTI_V5 -+ select ARCH_WANT_LIBATA_LEDS - select CPU_FEROCEON - select GPIOLIB - select KIRKWOOD_CLK diff --git a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch b/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch deleted file mode 100644 index fe5e1e2cd0..0000000000 --- a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch +++ /dev/null @@ -1,62 +0,0 @@ -The WRT1900AC among other Linksys routers uses a dual-firmware layout. -Dynamically rename the active partition to "ubi". - -Signed-off-by: Imre Kaloz ---- ---- a/drivers/mtd/parsers/ofpart_core.c -+++ b/drivers/mtd/parsers/ofpart_core.c -@@ -38,6 +38,8 @@ static bool node_has_compatible(struct d - return of_get_property(pp, "compatible", NULL); - } - -+static int mangled_rootblock; -+ - static int parse_fixed_partitions(struct mtd_info *master, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -47,6 +49,7 @@ static int parse_fixed_partitions(struct - struct mtd_partition *parts; - struct device_node *mtd_node; - struct device_node *ofpart_node; -+ const char *owrtpart = "ubi"; - const char *partname; - struct device_node *pp; - int nr_parts, i, ret = 0; -@@ -133,9 +136,15 @@ static int parse_fixed_partitions(struct - parts[i].size = of_read_number(reg + a_cells, s_cells); - parts[i].of_node = pp; - -- partname = of_get_property(pp, "label", &len); -- if (!partname) -- partname = of_get_property(pp, "name", &len); -+ if (mangled_rootblock && (i == mangled_rootblock)) { -+ partname = owrtpart; -+ } else { -+ partname = of_get_property(pp, "label", &len); -+ -+ if (!partname) -+ partname = of_get_property(pp, "name", &len); -+ } -+ - parts[i].name = partname; - - if (of_get_property(pp, "read-only", &len)) -@@ -249,6 +258,18 @@ static int __init ofpart_parser_init(voi - return 0; - } - -+static int __init active_root(char *str) -+{ -+ get_option(&str, &mangled_rootblock); -+ -+ if (!mangled_rootblock) -+ return 1; -+ -+ return 1; -+} -+ -+__setup("mangled_rootblock=", active_root); -+ - static void __exit ofpart_parser_exit(void) - { - deregister_mtd_parser(&ofpart_parser); diff --git a/target/linux/kirkwood/patches-5.4/203-blackarmor-nas220.patch b/target/linux/kirkwood/patches-5.4/203-blackarmor-nas220.patch deleted file mode 100644 index e04a28206a..0000000000 --- a/target/linux/kirkwood/patches-5.4/203-blackarmor-nas220.patch +++ /dev/null @@ -1,99 +0,0 @@ ---- a/arch/arm/boot/dts/kirkwood-blackarmor-nas220.dts -+++ b/arch/arm/boot/dts/kirkwood-blackarmor-nas220.dts -@@ -17,6 +17,13 @@ - compatible = "seagate,blackarmor-nas220","marvell,kirkwood-88f6192", - "marvell,kirkwood"; - -+ aliases { -+ led-boot = &led_status_amber; -+ led-failsafe = &led_status_amber; -+ led-running = &led_status_blue; -+ led-upgrade = &led_status_amber; -+ }; -+ - memory { /* 128 MB */ - device_type = "memory"; - reg = <0x00000000 0x8000000>; -@@ -36,14 +43,14 @@ - compatible = "gpio-keys"; - - reset { -- label = "Reset"; -- linux,code = ; -+ label = "Reset Button"; -+ linux,code = ; - gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; - }; - -- button { -- label = "Power"; -- linux,code = ; -+ power { -+ label = "Power Button"; -+ linux,code = ; - gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; - }; - }; -@@ -51,11 +58,27 @@ - gpio-leds { - compatible = "gpio-leds"; - -- blue-power { -+ led_power_blue: power_blue { - label = "nas220:blue:power"; - gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "default-on"; - }; -+ -+ disk_blue { -+ label = "nas220:blue:disk"; -+ gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "disk-activity"; -+ }; -+ -+ led_status_blue: status_blue { -+ label = "nas220:blue:status"; -+ gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ led_status_amber: status_amber { -+ label = "nas220:amber:status"; -+ gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; -+ }; - }; - - regulators { -@@ -153,6 +176,33 @@ - - &nand { - status = "okay"; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ -+ partition@0 { -+ label = "uboot"; -+ reg = <0x0 0xa0000>; -+ read-only; -+ }; -+ -+ partition@a0000 { -+ label = "uboot-env"; -+ reg = <0xa0000 0x10000>; -+ read-only; -+ }; -+ -+ partition@b0000 { -+ label = "reserved"; -+ reg = <0xb0000 0x10000>; -+ read-only; -+ }; -+ -+ partition@c0000 { -+ label = "ubi"; -+ reg = <0xc0000 0x1e80000>; -+ }; -+ }; - }; - - &mdio { diff --git a/target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch b/target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch deleted file mode 100644 index 4b4d03839a..0000000000 --- a/target/linux/kirkwood/patches-5.4/800-power-reset-linkstation-poweroff-prepare-for-new-dev.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 11cab9f5cd9390cd83747e579957c8f5b807c09c Mon Sep 17 00:00:00 2001 -From: Pawel Dembicki -Date: Fri, 18 Jun 2021 12:37:27 +0200 -Subject: [PATCH 1/2] power: reset: linkstation-poweroff: prepare for new - devices - -This commit prepare driver for another device support. - -New power_off_cfg structure describes two most important things: name of -mdio bus and pointer to register setting function. It allow to add new -device with different mdio bus node and other phy register config. - -Signed-off-by: Pawel Dembicki ---- - drivers/power/reset/linkstation-poweroff.c | 35 ++++++++++++++++++---- - 1 file changed, 29 insertions(+), 6 deletions(-) - ---- a/drivers/power/reset/linkstation-poweroff.c -+++ b/drivers/power/reset/linkstation-poweroff.c -@@ -29,11 +29,21 @@ - #define LED2_FORCE_ON (0x8 << 8) - #define LEDMASK GENMASK(11,8) - -+struct power_off_cfg { -+ char *mdio_node_name; -+ void (*phy_set_reg)(bool restart); -+}; -+ - static struct phy_device *phydev; -+static const struct power_off_cfg *cfg; - --static void mvphy_reg_intn(u16 data) -+static void linkstation_mvphy_reg_intn(bool restart) - { - int rc = 0, saved_page; -+ u16 data = 0; -+ -+ if(restart) -+ data = MII_88E1318S_PHY_LED_TCR_FORCE_INT; - - saved_page = phy_select_page(phydev, MII_MARVELL_LED_PAGE); - if (saved_page < 0) -@@ -66,11 +76,16 @@ err: - dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc); - } - -+static const struct power_off_cfg linkstation_power_off_cfg = { -+ .mdio_node_name = "mdio", -+ .phy_set_reg = linkstation_mvphy_reg_intn, -+}; -+ - static int linkstation_reboot_notifier(struct notifier_block *nb, - unsigned long action, void *unused) - { - if (action == SYS_RESTART) -- mvphy_reg_intn(MII_88E1318S_PHY_LED_TCR_FORCE_INT); -+ cfg->phy_set_reg(true); - - return NOTIFY_DONE; - } -@@ -82,14 +97,18 @@ static struct notifier_block linkstation - static void linkstation_poweroff(void) - { - unregister_reboot_notifier(&linkstation_reboot_nb); -- mvphy_reg_intn(0); -+ cfg->phy_set_reg(false); - - kernel_restart("Power off"); - } - - static const struct of_device_id ls_poweroff_of_match[] = { -- { .compatible = "buffalo,ls421d" }, -- { .compatible = "buffalo,ls421de" }, -+ { .compatible = "buffalo,ls421d", -+ .data = &linkstation_power_off_cfg, -+ }, -+ { .compatible = "buffalo,ls421de", -+ .data = &linkstation_power_off_cfg, -+ }, - { }, - }; - -@@ -97,13 +116,17 @@ static int __init linkstation_poweroff_i - { - struct mii_bus *bus; - struct device_node *dn; -+ const struct of_device_id *match; - - dn = of_find_matching_node(NULL, ls_poweroff_of_match); - if (!dn) - return -ENODEV; - of_node_put(dn); - -- dn = of_find_node_by_name(NULL, "mdio"); -+ match = of_match_node(ls_poweroff_of_match, dn); -+ cfg = match->data; -+ -+ dn = of_find_node_by_name(NULL, cfg->mdio_node_name); - if (!dn) - return -ENODEV; - diff --git a/target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch b/target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch deleted file mode 100644 index a929aacfd0..0000000000 --- a/target/linux/kirkwood/patches-5.4/801-power-reset-linkstation-poweroff-add-new-device.patch +++ /dev/null @@ -1,97 +0,0 @@ -From a2d9c86df8d12646f5bf66920e4f1e6d940cfc62 Mon Sep 17 00:00:00 2001 -From: Pawel Dembicki -Date: Fri, 18 Jun 2021 13:25:33 +0200 -Subject: [PATCH 2/2] power: reset: linkstation-poweroff: add new device - -This commit introduces support for NETGEAR ReadyNAS Duo v2. -This device use bit 4 of LED[2:0] Polarity Control Register to indicate -AC Power loss. - -For more details about AC loss detection in NETGEAR ReadyNAS Duo v2, -please look at the file: -RND_5.3.13_WW.src/u-boot/board/mv_feroceon/mv_hal/usibootup/usibootup.c -from Netgear GPL sources. - -Signed-off-by: Pawel Dembicki ---- - drivers/power/reset/linkstation-poweroff.c | 43 ++++++++++++++++++++++ - 1 file changed, 43 insertions(+) - ---- a/drivers/power/reset/linkstation-poweroff.c -+++ b/drivers/power/reset/linkstation-poweroff.c -@@ -19,6 +19,7 @@ - #define MII_MARVELL_PHY_PAGE 22 - - #define MII_PHY_LED_CTRL 16 -+#define MII_PHY_LED_POL_CTRL 17 - #define MII_88E1318S_PHY_LED_TCR 18 - #define MII_88E1318S_PHY_WOL_CTRL 16 - #define MII_M1011_IEVENT 19 -@@ -29,6 +30,8 @@ - #define LED2_FORCE_ON (0x8 << 8) - #define LEDMASK GENMASK(11,8) - -+#define MII_88E1318S_PHY_LED_POL_LED2 BIT(4) -+ - struct power_off_cfg { - char *mdio_node_name; - void (*phy_set_reg)(bool restart); -@@ -76,11 +79,48 @@ err: - dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc); - } - -+static void readynas_mvphy_set_reg(bool restart) -+{ -+ int rc = 0, saved_page; -+ u16 data = 0; -+ -+ if(restart) -+ data = MII_88E1318S_PHY_LED_POL_LED2; -+ -+ saved_page = phy_select_page(phydev, MII_MARVELL_LED_PAGE); -+ if (saved_page < 0) -+ goto err; -+ -+ /* Set the LED[2].0 Polarity bit to the required state */ -+ __phy_modify(phydev, MII_PHY_LED_POL_CTRL, -+ MII_88E1318S_PHY_LED_POL_LED2, data); -+ -+ if (!data) { -+ -+ /* If WOL was enabled and a magic packet was received before powering -+ * off, we won't be able to wake up by sending another magic packet. -+ * Clear WOL status. -+ */ -+ __phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_MARVELL_WOL_PAGE); -+ __phy_set_bits(phydev, MII_88E1318S_PHY_WOL_CTRL, -+ MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS); -+ } -+err: -+ rc = phy_restore_page(phydev, saved_page, rc); -+ if (rc < 0) -+ dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc); -+} -+ - static const struct power_off_cfg linkstation_power_off_cfg = { - .mdio_node_name = "mdio", - .phy_set_reg = linkstation_mvphy_reg_intn, - }; - -+static const struct power_off_cfg readynas_power_off_cfg = { -+ .mdio_node_name = "mdio-bus", -+ .phy_set_reg = readynas_mvphy_set_reg, -+}; -+ - static int linkstation_reboot_notifier(struct notifier_block *nb, - unsigned long action, void *unused) - { -@@ -109,6 +149,9 @@ static const struct of_device_id ls_powe - { .compatible = "buffalo,ls421de", - .data = &linkstation_power_off_cfg, - }, -+ { .compatible = "netgear,readynas-duo-v2", -+ .data = &readynas_power_off_cfg, -+ }, - { }, - }; - From 0c568d044fac166e803ab6a9bcd2f18d31309f9f Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 22 Jan 2022 20:30:05 +0900 Subject: [PATCH 031/144] kirkwood: rework 02_network Just like other targets do, introduce two setup functions for interfaces and MAC addresses. Signed-off-by: Sungbo Eo --- .../base-files/etc/board.d/02_network | 111 +++++++++++------- 1 file changed, 68 insertions(+), 43 deletions(-) diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network index ebc70cfc2f..773730e642 100644 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -5,51 +5,76 @@ . /lib/functions/uci-defaults.sh . /lib/functions/system.sh +kirkwood_setup_interfaces() +{ + local board="$1" + + case "$board" in + checkpoint,l-50) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0" + ;; + cisco,on100) + ucidef_set_interface_lan "eth0 eth1" + ;; + cloudengines,pogoe02|\ + cloudengines,pogoplugv4|\ + ctera,c200-v1|\ + globalscale,sheevaplug|\ + iom,iconnect-1.1|\ + iom,ix2-200|\ + netgear,readynas-duo-v2|\ + raidsonic,ib-nas62x0|\ + seagate,blackarmor-nas220|\ + seagate,dockstar|\ + seagate,goflexhome|\ + seagate,goflexnet|\ + zyxel,nsa310b|\ + zyxel,nsa310s|\ + zyxel,nsa325) + ucidef_set_interface_lan "eth0" "dhcp" + ;; + endian,4i-edge-200) + ucidef_set_interface_lan "port1 port2 port3 port4 eth1" + ;; + linksys,e4200-v2|\ + linksys,ea3500|\ + linksys,ea4500) + ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet" + ;; + *) + ucidef_set_interface_lan "eth0" + ;; + esac +} + +kirkwood_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + local label_mac="" + + case "$board" in + linksys,e4200-v2|\ + linksys,ea3500|\ + linksys,ea4500) + wan_mac=$(mtd_get_mac_ascii u_env eth1addr) + ;; + zyxel,nsa310b|\ + zyxel,nsa325) + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + ;; + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac + [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac +} + board_config_update - board=$(board_name) - -case "$board" in -checkpoint,l-50) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0" - ;; -cisco,on100) - ucidef_set_interface_lan "eth0 eth1" - ;; -cloudengines,pogoe02|\ -cloudengines,pogoplugv4|\ -ctera,c200-v1|\ -globalscale,sheevaplug|\ -iom,iconnect-1.1|\ -iom,ix2-200|\ -netgear,readynas-duo-v2|\ -raidsonic,ib-nas62x0|\ -seagate,blackarmor-nas220|\ -seagate,dockstar|\ -seagate,goflexhome|\ -seagate,goflexnet|\ -zyxel,nsa310s) - ucidef_set_interface_lan "eth0" "dhcp" - ;; -endian,4i-edge-200) - ucidef_set_interface_lan "port1 port2 port3 port4 eth1" - ;; -linksys,e4200-v2|\ -linksys,ea3500|\ -linksys,ea4500) - ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet" - ucidef_set_interface_macaddr "wan" $( mtd_get_mac_ascii u_env eth1addr ) - ;; -zyxel,nsa310b|\ -zyxel,nsa325) - ucidef_set_interface_lan "eth0" "dhcp" - ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr ) - ;; -*) - ucidef_set_interface_lan "eth0" - ;; -esac - +kirkwood_setup_interfaces $board +kirkwood_setup_macs $board board_config_flush exit 0 From 957f9adeb1f8ec5de8d73e183dec267dbc6dc8bb Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 1 Jan 2022 21:00:36 +0900 Subject: [PATCH 032/144] kirkwood: add support for ipTIME NAS1 ipTIME NAS1 is a 1-bay NAS, based on Marvell Kirkwood SoC. Specifications: * SoC: 88F6281 * RAM: 256 MiB * Flash: SPI NOR 16 MiB * SATA: 1x 3Gb/s * Ethernet: 1x 1GbE * USB: 1x 2.0 * Fan: 2 speed level * UART: JP1 (115200 8N1) * Pinout: [3V3] (TXD) (RXD) (GND) Notes: * There are several variants of the model name: "NAS-I", "NASI", "NAS1". Here "NAS1" is adopted for consistent naming scheme. * The reset button is also a USB copy button in stock FW, but in this patch the former is the only default behavior. Installation via web interface: 1. Flash sysupgrade image through the stock web interface. Revert to stock firmware: 1. Perform sysupgrade with stock image. Signed-off-by: Sungbo Eo --- include/image-commands.mk | 5 + .../base-files/etc/board.d/02_network | 5 + .../base-files/lib/preinit/07_set_iface_mac | 4 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/kirkwood/config-5.10 | 6 + .../files/arch/arm/boot/dts/kirkwood-nas1.dts | 231 ++++++++++++++++++ target/linux/kirkwood/image/Makefile | 15 ++ 7 files changed, 270 insertions(+) create mode 100644 target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-nas1.dts diff --git a/include/image-commands.mk b/include/image-commands.mk index 158af853a5..eda3fee94b 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -295,6 +295,11 @@ define Build/install-dtb ) endef +define Build/iptime-naspkg + $(STAGING_DIR_HOST)/bin/iptime-naspkg $(1) $@ $@.new + mv $@.new $@ +endef + define Build/jffs2 rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \ mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \ diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network index 773730e642..df38694f40 100644 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -22,6 +22,7 @@ kirkwood_setup_interfaces() globalscale,sheevaplug|\ iom,iconnect-1.1|\ iom,ix2-200|\ + iptime,nas1|\ netgear,readynas-duo-v2|\ raidsonic,ib-nas62x0|\ seagate,blackarmor-nas220|\ @@ -55,6 +56,10 @@ kirkwood_setup_macs() local label_mac="" case "$board" in + iptime,nas1) + lan_mac=$(mtd_get_mac_binary u-boot 0x3ffa8) + label_mac=$lan_mac + ;; linksys,e4200-v2|\ linksys,ea3500|\ linksys,ea4500) diff --git a/target/linux/kirkwood/base-files/lib/preinit/07_set_iface_mac b/target/linux/kirkwood/base-files/lib/preinit/07_set_iface_mac index 2a52b7962f..393c540d97 100644 --- a/target/linux/kirkwood/base-files/lib/preinit/07_set_iface_mac +++ b/target/linux/kirkwood/base-files/lib/preinit/07_set_iface_mac @@ -27,6 +27,10 @@ preinit_set_mac_address() { ip link set dev port3 address $(macaddr_add $mac 2) 2>/dev/null ip link set dev port4 address $(macaddr_add $mac 3) 2>/dev/null ;; + iptime,nas1) + mac=$(mtd_get_mac_binary u-boot 0x3ffa8) + ip link set dev eth0 address $mac 2>/dev/null + ;; esac } diff --git a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh index e2f6dec44a..9885bf7d31 100644 --- a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh +++ b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh @@ -1,6 +1,7 @@ RAMFS_COPY_BIN='fw_printenv fw_setenv strings' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' +PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 platform_check_image() { @@ -33,6 +34,9 @@ platform_do_upgrade() { return 1 fi ;; + iptime,nas1) + default_do_upgrade "$1" + ;; linksys,e4200-v2|\ linksys,ea3500|\ linksys,ea4500) diff --git a/target/linux/kirkwood/config-5.10 b/target/linux/kirkwood/config-5.10 index f80a7d8f20..ae9c3b0999 100644 --- a/target/linux/kirkwood/config-5.10 +++ b/target/linux/kirkwood/config-5.10 @@ -122,6 +122,7 @@ CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y +CONFIG_HWMON=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_OMAP=y CONFIG_HZ_FIXED=0 @@ -163,6 +164,9 @@ CONFIG_MTD_NAND_ECC_SW_HAMMING=y # CONFIG_MTD_NAND_MARVELL is not set CONFIG_MTD_NAND_ORION=y CONFIG_MTD_RAW_NAND=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y @@ -248,6 +252,7 @@ CONFIG_SPARSE_IRQ=y CONFIG_SPI=y # CONFIG_SPI_ARMADA_3700 is not set CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y CONFIG_SPI_ORION=y CONFIG_SPLIT_PTLOCK_CPUS=999999 CONFIG_SRAM=y @@ -259,6 +264,7 @@ CONFIG_THERMAL=y CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_HWMON=y CONFIG_THERMAL_OF=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y diff --git a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-nas1.dts b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-nas1.dts new file mode 100644 index 0000000000..a8d86406b5 --- /dev/null +++ b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-nas1.dts @@ -0,0 +1,231 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "kirkwood.dtsi" +#include "kirkwood-6281.dtsi" + +/ { + model = "ipTIME NAS1"; + compatible = "iptime,nas1", "marvell,kirkwood-88f6281", "marvell,kirkwood"; + + aliases { + serial0 = &uart0; + led-boot = &led_ready; + led-failsafe = &led_ready; + led-running = &led_ready; + led-upgrade = &led_ready; + }; + + chosen { + /* + * "root" argument from the stock bootloader should be ignored + * as it'll prevent the kernel from finding the correct rootfs. + */ + bootargs-append = " console=ttyS0,115200 root="; + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x10000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + pinctrl-0 = <&pmx_led>; + pinctrl-names = "default"; + + hdd { + label = "blue:hdd"; + gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "ata1"; + }; + + usb { + label = "blue:usb"; + gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; + trigger-sources = <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + + led_ready: ready { + label = "blue:ready"; + gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + pinctrl-0 = <&pmx_button>; + pinctrl-names = "default"; + + reset-copy { + label = "Reset/Copy Button"; + linux,code = ; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + + power { + label = "Power Button"; + linux,code = ; + gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-fan { + compatible = "gpio-fan"; + + pinctrl-0 = <&pmx_fan>; + pinctrl-names = "default"; + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>, + <&gpio1 10 GPIO_ACTIVE_HIGH>; + /* We don't know the exact rpm, just use dummy values here. */ + gpio-fan,speed-map = <0 0>, <1 1>, <2 2>; + #cooling-cells = <2>; + }; + + gpio-poweroff { + compatible = "gpio-poweroff"; + gpios = <&pca9536 0 GPIO_ACTIVE_LOW>; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-0 = <&pmx_usb_vbus>; + pinctrl-names = "default"; + + regulator@1 { + compatible = "regulator-fixed"; + reg = <1>; + regulator-name = "USB Power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pinctrl { + pmx_led: pmx-led { + marvell,pins = "mpp35", "mpp45", "mpp46"; + marvell,function = "gpio"; + }; + + pmx_fan: pmx-fan { + marvell,pins = "mpp41", "mpp42"; + marvell,function = "gpio"; + }; + + pmx_usb_vbus: pmx-usb-vbus { + marvell,pins = "mpp43"; + marvell,function = "gpio"; + }; + + pmx_button: pmx-button { + marvell,pins = "mpp44", "mpp48"; + marvell,function = "gpio"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,offset = <0x400>; + label = "firmware"; + reg = <0x40000 0xf80000>; + }; + + partition@fc0000 { + label = "config"; + reg = <0xfc0000 0x40000>; + read-only; + }; + }; + }; +}; + +&rtc { + status = "disabled"; +}; + +&i2c0 { + status = "okay"; + + pca9536: gpio@41 { + compatible = "nxp,pca9536"; + reg = <0x41>; + gpio-controller; + #gpio-cells = <2>; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + + ehci_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&mdio { + status = "okay"; + + ethphyb: ethernet-phy@b { + reg = <0x0b>; + }; +}; + +ð1 { + status = "okay"; +}; + +ð1port { + phy-handle = <ðphyb>; + phy-connection-type = "rgmii-id"; +}; + +&sata { + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + nr-ports = <1>; + + sata-port@0 { + reg = <0>; + #thermal-sensor-cells = <0>; + }; +}; diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index 4a2ca8d68e..60e8654ad3 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -184,6 +184,21 @@ define Device/iom_ix2-200 endef TARGET_DEVICES += iom_ix2-200 +define Device/iptime_nas1 + DEVICE_VENDOR := ipTIME + DEVICE_MODEL := NAS1 + DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \ + kmod-gpio-button-hotplug kmod-gpio-pca953x kmod-hwmon-drivetemp \ + kmod-hwmon-gpiofan kmod-usb-ledtrig-usbport -uboot-envtools + KERNEL := $$(KERNEL) | iptime-naspkg nas1 + BLOCKSIZE := 256k + IMAGE_SIZE := 15872k + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + check-size | append-metadata +endef +TARGET_DEVICES += iptime_nas1 + define Device/linksys DEVICE_VENDOR := Linksys DEVICE_PACKAGES := kmod-mwl8k wpad-basic-wolfssl kmod-gpio-button-hotplug From 7a4a33060ff1457df6fdfeb3257b44a01f673776 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 1 Jan 2022 21:57:47 +0900 Subject: [PATCH 033/144] kernel: add disabled POWER_RESET_QNAP Move the disabled symbol from target configs to generic configs. Signed-off-by: Sungbo Eo --- target/linux/generic/config-5.10 | 1 + target/linux/generic/config-5.4 | 1 + target/linux/kirkwood/config-5.10 | 1 - target/linux/mvebu/config-5.10 | 1 - target/linux/mvebu/modules.mk | 3 +-- 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index 619399a319..30c48d521b 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -4504,6 +4504,7 @@ CONFIG_POSIX_TIMERS=y # CONFIG_POWER_RESET_LINKSTATION is not set # CONFIG_POWER_RESET_LTC2952 is not set # CONFIG_POWER_RESET_PIIX4_POWEROFF is not set +# CONFIG_POWER_RESET_QNAP is not set # CONFIG_POWER_RESET_RESTART is not set # CONFIG_POWER_RESET_SYSCON is not set # CONFIG_POWER_RESET_SYSCON_POWEROFF is not set diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index 6ee1d472db..7fcb045b37 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -4134,6 +4134,7 @@ CONFIG_POSIX_TIMERS=y # CONFIG_POWER_RESET_LINKSTATION is not set # CONFIG_POWER_RESET_LTC2952 is not set # CONFIG_POWER_RESET_PIIX4_POWEROFF is not set +# CONFIG_POWER_RESET_QNAP is not set # CONFIG_POWER_RESET_RESTART is not set # CONFIG_POWER_RESET_SYSCON is not set # CONFIG_POWER_RESET_SYSCON_POWEROFF is not set diff --git a/target/linux/kirkwood/config-5.10 b/target/linux/kirkwood/config-5.10 index ae9c3b0999..4963712ef4 100644 --- a/target/linux/kirkwood/config-5.10 +++ b/target/linux/kirkwood/config-5.10 @@ -226,7 +226,6 @@ CONFIG_PLAT_ORION=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO=y CONFIG_POWER_RESET_LINKSTATION=y -# CONFIG_POWER_RESET_QNAP is not set CONFIG_POWER_SUPPLY=y CONFIG_RATIONAL=y CONFIG_REGMAP=y diff --git a/target/linux/mvebu/config-5.10 b/target/linux/mvebu/config-5.10 index 86d8784c74..ee9331252c 100644 --- a/target/linux/mvebu/config-5.10 +++ b/target/linux/mvebu/config-5.10 @@ -339,7 +339,6 @@ CONFIG_PLAT_ORION=y CONFIG_PM_OPP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO=y -# CONFIG_POWER_RESET_QNAP is not set CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=11 CONFIG_PWM=y CONFIG_PWM_SYSFS=y diff --git a/target/linux/mvebu/modules.mk b/target/linux/mvebu/modules.mk index 3a5e316788..8d4dc4d968 100644 --- a/target/linux/mvebu/modules.mk +++ b/target/linux/mvebu/modules.mk @@ -4,8 +4,7 @@ define KernelPackage/linkstation-poweroff TITLE:=Buffalo LinkStation power off driver KCONFIG:= \ CONFIG_POWER_RESET=y \ - CONFIG_POWER_RESET_LINKSTATION \ - CONFIG_POWER_RESET_QNAP=n + CONFIG_POWER_RESET_LINKSTATION FILES:=$(LINUX_DIR)/drivers/power/reset/linkstation-poweroff.ko AUTOLOAD:=$(call AutoLoad,31,linkstation-poweroff,1) From f4fd2a1354a81e5222b6a263076538fbb7d4a090 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 1 Jan 2022 22:00:56 +0900 Subject: [PATCH 034/144] mvebu: remove duplicate CONFIG_POWER_RESET entries The option is already enabled in the target config since 9149ed4f05f8 ("mvebu: cortexa9: Add support for Ctera C200-V2"). Signed-off-by: Sungbo Eo --- target/linux/mvebu/cortexa53/config-5.10 | 1 - target/linux/mvebu/cortexa72/config-5.10 | 1 - target/linux/mvebu/modules.mk | 5 +---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/target/linux/mvebu/cortexa53/config-5.10 b/target/linux/mvebu/cortexa53/config-5.10 index 79f815b6d2..a47d66c669 100644 --- a/target/linux/mvebu/cortexa53/config-5.10 +++ b/target/linux/mvebu/cortexa53/config-5.10 @@ -62,7 +62,6 @@ CONFIG_PHY_MVEBU_A3700_UTMI=y CONFIG_PINCTRL_ARMADA_37XX=y CONFIG_PINCTRL_ARMADA_AP806=y CONFIG_PINCTRL_ARMADA_CP110=y -CONFIG_POWER_RESET=y CONFIG_POWER_SUPPLY=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y diff --git a/target/linux/mvebu/cortexa72/config-5.10 b/target/linux/mvebu/cortexa72/config-5.10 index be78be5a34..740f0fcfdf 100644 --- a/target/linux/mvebu/cortexa72/config-5.10 +++ b/target/linux/mvebu/cortexa72/config-5.10 @@ -71,7 +71,6 @@ CONFIG_PHY_MVEBU_CP110_COMPHY=y CONFIG_PINCTRL_ARMADA_37XX=y CONFIG_PINCTRL_ARMADA_AP806=y CONFIG_PINCTRL_ARMADA_CP110=y -CONFIG_POWER_RESET=y CONFIG_POWER_SUPPLY=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y diff --git a/target/linux/mvebu/modules.mk b/target/linux/mvebu/modules.mk index 8d4dc4d968..2700e2b159 100644 --- a/target/linux/mvebu/modules.mk +++ b/target/linux/mvebu/modules.mk @@ -2,10 +2,7 @@ define KernelPackage/linkstation-poweroff SUBMENU:=$(OTHER_MENU) DEPENDS:=@TARGET_mvebu TITLE:=Buffalo LinkStation power off driver - KCONFIG:= \ - CONFIG_POWER_RESET=y \ - CONFIG_POWER_RESET_LINKSTATION - + KCONFIG:=CONFIG_POWER_RESET_LINKSTATION FILES:=$(LINUX_DIR)/drivers/power/reset/linkstation-poweroff.ko AUTOLOAD:=$(call AutoLoad,31,linkstation-poweroff,1) endef From 6ff970bb51f53c731b0612152734cec82ca92543 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 1 Jan 2022 23:47:43 +0900 Subject: [PATCH 035/144] mvebu: add support for ipTIME NAS1dual ipTIME NAS1dual is a 1-bay NAS, based on Marvell Armada 385 SoC. Specifications: * SoC: 88F6820 * RAM: 2 GiB * Flash: SPI NOR 64 MiB * SATA: 1x 3Gb/s * Ethernet: 2x 1GbE * USB: 1x 3.0 * Fan: 2 speed level * UART: J11 (115200 8N1) * Pinout: [3V3] (TXD) (RXD) (GND) Installation via web interface: 1. Flash **initramfs** image through the stock web interface. 2. Boot into OpenWrt and perform sysupgrade with sysupgrade image. Revert to stock firmware: 1. Perform sysupgrade with stock image. Signed-off-by: Sungbo Eo --- .../base-files/etc/board.d/02_network | 3 + .../base-files/lib/upgrade/platform.sh | 2 + .../arch/arm/boot/dts/armada-385-nas1dual.dts | 318 ++++++++++++++++++ target/linux/mvebu/image/cortexa9.mk | 14 + 4 files changed, 337 insertions(+) create mode 100644 target/linux/mvebu/files/arch/arm/boot/dts/armada-385-nas1dual.dts diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index 36769e8c18..c613a3cd60 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -18,6 +18,9 @@ mvebu_setup_interfaces() cznic,turris-omnia) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2" ;; + iptime,nas1dual) + ucidef_set_interface_lan "eth0 eth1" "dhcp" + ;; linksys,wrt1200ac|\ linksys,wrt1900ac-v1|\ linksys,wrt1900ac-v2|\ diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 030e66e699..18b978d437 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -5,6 +5,8 @@ RAMFS_COPY_BIN='fw_printenv fw_setenv strings' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' + +PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 platform_check_image() { diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-nas1dual.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-nas1dual.dts new file mode 100644 index 0000000000..d14ea8b94e --- /dev/null +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-nas1dual.dts @@ -0,0 +1,318 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR MIT) +/* + * Device Tree file for ipTIME NAS1dual + * + * Copyright (C) 2020 Sungbo Eo + * + * Based on armada-385-linksys.dtsi + * Copyright (C) 2015 Imre Kaloz + */ + +/dts-v1/; + +#include +#include +#include "armada-385.dtsi" + +/ { + model = "ipTIME NAS1dual"; + compatible = "iptime,nas1dual", "marvell,armada385", "marvell,armada380"; + + aliases { + led-boot = &led_ready; + led-failsafe = &led_ready; + led-running = &led_ready; + led-upgrade = &led_ready; + label-mac-device = ð0; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x80000000>; /* 2GB */ + }; + + soc { + ranges = ; + }; + + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_keys_pins>; + + power { + label = "Power Button"; + linux,input-type = ; + linux,code = ; + gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "Reset Button"; + linux,code = ; + gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; + }; + + copy { + label = "USB Copy Button"; + linux,code = ; + gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_leds_pins>; + + led_ready: ready { + label = "blue:ready"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + }; + + hdd { + label = "blue:hdd"; + gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; + }; + + usb { + label = "blue:usb"; + gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; + trigger-sources = <&usb3_0_port1 &usb3_0_port2>; + linux,default-trigger = "usbport"; + }; + }; + + gpio-fan { + compatible = "gpio-fan"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_fan_pins>; + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>, + <&gpio1 18 GPIO_ACTIVE_HIGH>; + /* We don't know the exact rpm, just use dummy values here. */ + gpio-fan,speed-map = <0 0>, <1 1>, <2 2>; + #cooling-cells = <2>; + }; + + gpio-poweroff { + compatible = "gpio-poweroff"; + gpios = <&pca9536 1 GPIO_ACTIVE_LOW>; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&sata_power_pins>; + + reg_sata_power: regulator@1 { + compatible = "regulator-fixed"; + reg = <1>; + regulator-name = "sata-power"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + gpio = <&gpio1 20 GPIO_ACTIVE_LOW>; + regulator-always-on; + }; + }; +}; + +&ahci0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + sata-port@0 { + reg = <0>; + target-supply = <®_sata_power>; + #thermal-sensor-cells = <0>; + }; +}; + +&bm { + status = "okay"; +}; + +&bm_bppi { + status = "okay"; +}; + +ð0 { + pinctrl-names = "default"; + pinctrl-0 = <&ge0_rgmii_pins>; + status = "okay"; + phy-handle = <ðphy1>; + phy-connection-type = "rgmii-id"; + buffer-manager = <&bm>; + bm,pool-long = <0>; + bm,pool-short = <1>; + nvmem-cells = <&macaddr_uboot_fffa8>; + nvmem-cell-names = "mac-address"; +}; + +ð1 { + pinctrl-names = "default"; + pinctrl-0 = <&ge1_rgmii_pins>; + status = "okay"; + phy-handle = <ðphy0>; + phy-connection-type = "rgmii-id"; + buffer-manager = <&bm>; + bm,pool-long = <2>; + bm,pool-short = <3>; + nvmem-cells = <&macaddr_uboot_fffa8>; + nvmem-cell-names = "mac-address"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; + + pca9536: gpio@41 { + compatible = "nxp,pca9536"; + reg = <0x41>; + gpio-controller; + #gpio-cells = <2>; + gpio-line-names = "power-led", "power-board"; + }; +}; + +&mdio { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + /* LED1: On - Link, Blink - Activity, Off - No Link */ + + ethphy0: ethernet-phy@0 { + reg = <0>; + marvell,reg-init = <3 16 0 0x1017>; + }; + + ethphy1: ethernet-phy@1 { + reg = <1>; + marvell,reg-init = <3 16 0 0x1017>; + }; +}; + +&pinctrl { + gpio_keys_pins: gpio-keys-pins { + marvell,pins = "mpp24", "mpp26", "mpp48"; + marvell,function = "gpio"; + }; + + gpio_leds_pins: gpio-leds-pins { + marvell,pins = "mpp18", "mpp20", "mpp51"; + marvell,function = "gpio"; + }; + + gpio_fan_pins: gpio-fan-pins { + marvell,pins = "mpp25", "mpp50"; + marvell,function = "gpio"; + }; + + sata_power_pins: sata-power-pins { + marvell,pins = "mpp52"; + marvell,function = "gpio"; + }; + + uart1_pins_alt: uart-pins-1-alt { + marvell,pins = "mpp45", "mpp46"; + marvell,function = "ua1"; + }; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spi1_pins>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x00000000 0x00100000>; + label = "u-boot"; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_uboot_fffa8: macaddr@fffa8 { + reg = <0xfffa8 0x6>; + }; + }; + + partition@100000 { + reg = <0x00100000 0x03ec0000>; + label = "firmware"; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x00000000 0x00600000>; + label = "kernel"; + }; + + partition@600000 { + reg = <0x00600000 0x038c0000>; + label = "rootfs"; + }; + }; + + partition@3fc0000 { + reg = <0x03fc0000 0x00040000>; + label = "config"; + read-only; + }; + }; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins_alt>; + status = "okay"; +}; + +&usb3_0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + usb3_0_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + usb3_0_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; +}; diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 06252670ab..b06c5594bd 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -78,6 +78,20 @@ define Device/globalscale_mirabox endef TARGET_DEVICES += globalscale_mirabox +define Device/iptime_nas1dual + DEVICE_VENDOR := ipTIME + DEVICE_MODEL := NAS1dual + DEVICE_PACKAGES := kmod-hwmon-drivetemp kmod-hwmon-gpiofan kmod-usb3 + SOC := armada-385 + KERNEL := kernel-bin | append-dtb | iptime-naspkg nas1dual + KERNEL_SIZE := 6144k + IMAGES := sysupgrade.bin + IMAGE_SIZE := 64256k + IMAGE/sysupgrade.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ + append-rootfs | pad-rootfs | check-size | append-metadata +endef +TARGET_DEVICES += iptime_nas1dual + define Device/kobol_helios4 DEVICE_VENDOR := Kobol DEVICE_MODEL := Helios4 From 03aa57d7ab7a50ca022a26d087d6c64740232a3b Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 29 Jan 2022 23:24:07 +0900 Subject: [PATCH 036/144] ramips: make the relocation address configurable If no argument is given to relocate-kernel, KERNEL_LOADADDR will be used just as before. This is a preparation for ramips support of ipTIME AX2004M. Signed-off-by: Sungbo Eo --- target/linux/ramips/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index ac256cf1ae..241b620941 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -113,7 +113,7 @@ endef define Build/relocate-kernel rm -rf $@.relocate $(CP) ../../generic/image/relocate $@.relocate - $(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS) + $(MAKE) -C $@.relocate KERNEL_ADDR=$(if $(1),$(1),$(KERNEL_LOADADDR)) CROSS_COMPILE=$(TARGET_CROSS) ( \ dd if=$@.relocate/loader.bin bs=32 conv=sync && \ perl -e '@s = stat("$@"); print pack("V", @s[7])' && \ From f4a79148f8cbb7dfbcddfb0c1128caec45a01596 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 29 Jan 2022 23:25:32 +0900 Subject: [PATCH 037/144] ramips: add support for ipTIME AX2004M ipTIME AX2004M is an 802.11ax (Wi-Fi 6) router, based on MediaTek MT7621A. Specification: * SoC: MT7621A * RAM: 256 MiB * Flash: NAND 128 MiB * Wi-Fi: * MT7915D: 2.4/5 GHz (DBDC) * Ethernet: 5x 1GbE * Switch: SoC built-in * USB: 1x 3.0 * UART: J4 (115200 baud) * Pinout: [3V3] (TXD) (RXD) (GND) MAC address: | interface | MAC | source | comment |-----------|-------------------|----------------|--------- | LAN | 58:XX:XX:00:XX:9B | | [1] | WAN | 58:XX:XX:00:XX:99 | | | WLAN 2G | 58:XX:XX:00:XX:98 | factory 0x4 | | WLAN 5G | 5A:XX:XX:40:XX:98 | | | | | | | | 58:XX:XX:00:XX:98 | config ethaddr | [1] Used in this patch as WLAN 5G MAC address with the local bit set Load address: * stock * 0x80010000: FIT image * 0x81001000: kernel image -> entry * OpenWrt * 0x80010000: FIT image * 0x82000000: uncompressed kernel+relocate image * 0x80001000: relocated kernel image -> entry Installation via **recovery** mode: 1. Press reset button, power up the device, wait >10s for CPU LED to stop blinking. 2. Upload recovery image through the recovery web page at 192.168.0.1. Revert to stock firmware: 1. Install stock image via recovery mode. Signed-off-by: Sungbo Eo --- include/image-commands.mk | 5 + .../ramips/dts/mt7621_iptime_ax2004m.dts | 165 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 20 +++ .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 6 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 5 files changed, 197 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_iptime_ax2004m.dts diff --git a/include/image-commands.mk b/include/image-commands.mk index eda3fee94b..485d870f05 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -295,6 +295,11 @@ define Build/install-dtb ) endef +define Build/iptime-crc32 + $(STAGING_DIR_HOST)/bin/iptime-crc32 $(1) $@ $@.new + mv $@.new $@ +endef + define Build/iptime-naspkg $(STAGING_DIR_HOST)/bin/iptime-naspkg $(1) $@ $@.new mv $@.new $@ diff --git a/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts b/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts new file mode 100644 index 0000000000..6da223689c --- /dev/null +++ b/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "iptime,ax2004m", "mediatek,mt7621-soc"; + model = "ipTIME AX2004M"; + + aliases { + led-boot = &led_cpu; + led-failsafe = &led_cpu; + led-running = &led_cpu; + led-upgrade = &led_cpu; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_cpu: cpu { + label = "amber:cpu"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "amber:wlan2g"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0radio"; + }; + + wlan5g { + label = "amber:wlan5g"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1radio"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x80000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + + partition@180000 { + label = "firmware"; + reg = <0x180000 0x7680000>; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x400000 0x7280000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <3>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + }; + + port@1 { + status = "okay"; + label = "lan4"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan2"; + }; + + port@4 { + status = "okay"; + label = "lan1"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index a461c57f15..b125df48d9 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -817,6 +817,26 @@ define Device/iptime_a8004t endef TARGET_DEVICES += iptime_a8004t +define Device/iptime_ax2004m + $(Device/dsa-migration) + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 121344k + UBINIZE_OPTS := -E 5 + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGES += recovery.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/recovery.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size | iptime-crc32 ax2004m + DEVICE_VENDOR := ipTIME + DEVICE_MODEL := AX2004M + DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 +endef +TARGET_DEVICES += iptime_ax2004m + define Device/iptime_t5004 $(Device/dsa-migration) BLOCKSIZE := 128k diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 242e1e6efe..6d7af90e80 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -25,6 +25,12 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress ;; + iptime,ax2004m) + if [ "$PHYNBR" = "1" ]; then + base_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 3) + macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress + fi + ;; jcg,q20) [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 8e1bdc157f..afbba0a646 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -59,6 +59,7 @@ platform_do_upgrade() { dlink,dir-853-a3|\ hiwifi,hc5962|\ iptime,a3004t|\ + iptime,ax2004m|\ iptime,t5004|\ jcg,q20|\ linksys,e5600|\ From 3dc38823a2994639500ca201ac16928b7bf0bd8a Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Thu, 27 Jan 2022 10:25:19 +0100 Subject: [PATCH 038/144] CI: add formal checks The formal checks verify the following things: - Commits does not contain any merge commits - Signed by a real name - Commit titles starts with an `:` - Author name matches signed of name - Commit message is not empty Signed-off-by: Paul Spooren --- .github/workflows/ci_helpers.sh | 26 ++++++++++++ .github/workflows/formal.yml | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 .github/workflows/ci_helpers.sh create mode 100644 .github/workflows/formal.yml diff --git a/.github/workflows/ci_helpers.sh b/.github/workflows/ci_helpers.sh new file mode 100644 index 0000000000..2f9daf81e2 --- /dev/null +++ b/.github/workflows/ci_helpers.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +color_out() { + printf "\e[0;$1m%s\e[0;0m\n" "$2" +} + +success() { + color_out 32 "$1" +} + +info() { + color_out 36 "$1" +} + +err() { + color_out 31 "$1" +} + +warn() { + color_out 33 "$1" +} + +err_die() { + err "$1" + exit 1 +} diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml new file mode 100644 index 0000000000..74e8fd6942 --- /dev/null +++ b/.github/workflows/formal.yml @@ -0,0 +1,70 @@ +name: Test Formalities + +on: + pull_request: + +jobs: + build: + name: Test Formalities + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Determine branch name + run: | + BRANCH="${GITHUB_BASE_REF#refs/heads/}" + echo "Building for $BRANCH" + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + + - name: Test formalities + run: | + source .github/workflows/ci_helpers.sh + + RET=0 + for commit in $(git rev-list HEAD ^origin/$BRANCH); do + info "=== Checking commit '$commit'" + if git show --format='%P' -s $commit | grep -qF ' '; then + err "Pull request should not include merge commits" + RET=1 + fi + + author="$(git show -s --format=%aN $commit)" + if echo $author | grep -q '\S\+\s\+\S\+'; then + success "Author name ($author) seems ok" + else + err "Author name ($author) need to be your real name 'firstname lastname'" + RET=1 + fi + + subject="$(git show -s --format=%s $commit)" + if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then + success "Commit subject line seems ok ($subject)" + else + err "Commit subject line MUST start with ': ' ($subject)" + RET=1 + fi + + body="$(git show -s --format=%b $commit)" + sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)" + if echo "$body" | grep -qF "$sob"; then + success "Signed-off-by match author" + else + err "Signed-off-by is missing or doesn't match author (should be '$sob')" + RET=1 + fi + + if echo "$body" | grep -v "Signed-off-by:"; then + success "A commit message exists" + else + err "Missing commit message. Please describe your changes" + RET=1 + fi + done + + exit $RET From 8fde82095ba0321b2ab377b63f22b64a2443762c Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Sat, 4 Dec 2021 04:15:30 +0100 Subject: [PATCH 039/144] ramips: add support for Wavlink WL-WN535K1 The Wavlink WL-WN535K1 is a "mesh" router with 2 gigabit ethernet ports and one fast ethernet port. Mine is branded as Talius TAL-WMESH1. It can be found in kits of 2 or 3 (WL-WN535K2 or WL-WN535K3). The motherboard is labelled as WS-WN535G3-B-V1.2 so this image could potentially work for WL-WN535G3R and WS-WN535G3R with little to none effort, but it's untested. Hardware -------- SoC: Mediatek MT7620A RAM: 64MB FLASH: 8MB NOR (GigaDevice GD25Q64CS) ETH: - 2x 10/100/1000 Mbps Ethernet (RTL8211F) - 1x 10/100 Mbps Ethernet (integrated in SOC) WIFI: - 2.4GHz: 1x (integrated in SOC) (2x2:2) - 5GHz: 1x MT7612E (2x2:2) - 4 internal antennas BTN: - 1x Reset button - 1x Touchlink button (set to WPS) - 1x ON/OFF switch LEDS: - 1x Red led (system status) - 1x Blue led (system status) - 3x Green leds (ethernet port status/act) UART: - 57600-8-N-1 Everything works correctly. Currently there is no firmware update available. Because of this, in order to restore the OEM firmware, you must firstly dump the OEM firmware from your router before you flash the OpenWrt image. Backup the OEM Firmware ----------------------- The following steps are to be intended for users having little to none experience in linux. Obviously there are many ways to backup the OEM firmware, but probably this is the easiest way for this router. Procedure tested on WN535K1_V1510_200916 firmware version. 1) Go to http://192.168.10.1/webcmd.shtml 2) Type the following line in the "Command" input box and then press enter: mkdir /etc_ro/lighttpd/www/dev; dd if=/dev/mtd0ro of=/etc_ro/lighttpd/www/dev/mtd0ro 3) After few seconds in the textarea should appear this output: 16384+0 records in 16384+0 records out If your output doesn't match mine, stop reading and ask for help in the forum. 4) Open in another tab http://192.168.10.1/dev/mtd0ro to download the content of the whole NOR. If the file size is 0 byte, stop reading and ask for help in the forum. 5) Come back to the http://192.168.10.1/webcmd.shtml webpage and type: rm /etc_ro/lighttpd/www/dev/mtd0ro;for i in 1 2 3 4 5; do dd if=/dev/mtd${i}ro of=/etc_ro/lighttpd/www/dev/mtd${i}ro; done 6) After few seconds, in the textarea should appear this output: 384+0 records in 384+0 records out 128+0 records in 128+0 records out 128+0 records in 128+0 records out 14720+0 records in 14720+0 records out 1024+0 records in 1024+0 records out If your output doesn't match mine, stop reading and ask for help in the forum. 7) Open the following links to download the partitions of the OEM FW: http://192.168.10.1/dev/mtd1ro http://192.168.10.1/dev/mtd2ro http://192.168.10.1/dev/mtd3ro http://192.168.10.1/dev/mtd4ro http://192.168.10.1/dev/mtd5ro If one (or more) of these files are 0 byte, stop reading and ask for help in the forum. 8) Store these downloaded files in a safe place. 9) Reboot your router to remove any temporary file in ram. Installation ------------ Flash the initramfs image in the OEM firmware interface (http://192.168.10.1/update_mesh.shtml). When Openwrt boots, flash the sysupgrade image otherwise you won't be able to keep configuration between reboots. Restore OEM Firmware -------------------- Flash the "mtd4ro" file you previously backed-up directly from LUCI. Warning: Remember to not keep settings! Warning2: Remember to force the flash. Notes ----- 1) Router mac addresses: LAN XX:XX:XX:XX:XX:E2 (factory @ 0x28) WAN XX:XX:XX:XX:XX:E3 (factory @ 0x2e) WIFI 2G XX:XX:XX:XX:XX:E4 (factory @ 0x04) WIFI 5G XX:XX:XX:XX:XX:E5 (factory @ 0x8004) LABEL XX:XX:XX:XX:XX:E5 2) The OEM firmware upgrade page accepts only files containing the string "WN535K1" in the filename. 3) Additional notes 1,2,3 in the WS-WN583A6 commit are still valid (https://github.com/openwrt/openwrt/commit/92780d80ab6f5f03fac2407c06eb267dd83914a1) Signed-off-by: Davide Fioravanti [remove trailing whitespace] Signed-off-by: Sungbo Eo --- .../ramips/dts/mt7620a_wavlink_wl-wn535k1.dts | 185 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 12 ++ .../mt7620/base-files/etc/board.d/01_leds | 5 + .../mt7620/base-files/etc/board.d/02_network | 8 + 4 files changed, 210 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts diff --git a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts new file mode 100644 index 0000000000..67a7d8d488 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts @@ -0,0 +1,185 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "wavlink,wl-wn535k1", "ralink,mt7620a-soc"; + model = "Wavlink WL-WN535K1"; + + aliases { + label-mac-device = &wifi0; + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_red; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + touchlink { + label = "touchlink"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + }; + + lan1 { + label = "green:lan1"; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + }; + + lan2 { + label = "green:lan2"; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "green:wan"; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x730000>; + }; + + partition@780000 { + label = "vendor"; + reg = <0x780000 0x80000>; + read-only; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi0: wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; + + mediatek,portmap = "llllw"; + + port@4 { + status = "okay"; + phy-handle = <&phy4>; + phy-mode = "rgmii"; + }; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&gsw { + mediatek,port4-gmac; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&state_default { + gpio { + groups = "ephy", "i2c", "uartf"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 498170236a..5efb4e5e17 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -1165,6 +1165,18 @@ define Device/wavlink_wl-wn530hg4 endef TARGET_DEVICES += wavlink_wl-wn530hg4 +define Device/wavlink_wl-wn535k1 + SOC := mt7620a + IMAGE_SIZE := 7360k + DEVICE_VENDOR := Wavlink + DEVICE_MODEL := WL-WN535K1 + DEVICE_ALT0_VENDOR := Talius + DEVICE_ALT0_MODEL := TAL-WMESH1 + KERNEL_INITRAMFS_SUFFIX := -WN535K1$$(KERNEL_SUFFIX) + DEVICE_PACKAGES := kmod-mt76x2 kmod-phy-realtek +endef +TARGET_DEVICES += wavlink_wl-wn535k1 + define Device/wavlink_wl-wn579x3 SOC := mt7620a IMAGE_SIZE := 7744k diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index 8d438538fc..1f53930311 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -202,6 +202,11 @@ tplink,archer-mr200) tplink,re200-v1) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; +wavlink,wl-wn535k1) + ucidef_set_led_switch "lan1" "lan2" "green:lan1" "switch0" "0x04" + ucidef_set_led_switch "lan2" "lan2" "green:lan2" "switch0" "0x20" + ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10" + ;; wavlink,wl-wn579x3) ucidef_set_led_switch "lan" "lan" "blue:lan" "switch0" "0x20" ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x10" diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index ea8394ec59..47bd02f3d1 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -219,6 +219,10 @@ ramips_setup_interfaces() "0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0" ucidef_set_interface_wan "usb0" ;; + wavlink,wl-wn535k1) + ucidef_add_switch "switch0" \ + "2:lan" "5:lan" "4:wan" "6@eth0" + ;; wavlink,wl-wn579x3) ucidef_add_switch "switch0" \ "5:lan" "4:wan" "6@eth0" @@ -367,6 +371,10 @@ ramips_setup_macs() tplink,archer-mr200) wan_mac=$(macaddr_add "$(mtd_get_mac_binary rom 0xf100)" 1) ;; + wavlink,wl-wn535k1) + wan_mac=$(mtd_get_mac_binary factory 0x2e) + label_mac=$(mtd_get_mac_binary factory 0x8004) + ;; zbtlink,zbt-we1026-5g-16m) label_mac=$(mtd_get_mac_binary factory 0x4) ;; From b21bc3479d46e6a4c3cc6bf7c245d4b0ddccb7db Mon Sep 17 00:00:00 2001 From: Tamas Balogh Date: Tue, 25 Jan 2022 14:16:37 +0100 Subject: [PATCH 040/144] ath79: ASUS RP-AC66 use flash till the end This makes available the additional space, which was occupied by OEM's jffs2 partition before: "0x000000f80000-0x000001000000 : jffs2" Reverting to the OEM firmware will also recover this partition, i.e. it is not needed and can be used by OpenWrt. Signed-off-by: Tamas Balogh --- target/linux/ath79/dts/qca9563_asus_rp-ac66.dts | 2 +- target/linux/ath79/image/generic.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts b/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts index 39c96127e6..c4b6483497 100644 --- a/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts +++ b/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts @@ -125,7 +125,7 @@ partition@60000 { compatible = "denx,uimage"; label = "firmware"; - reg = <0x060000 0xf20000>; + reg = <0x060000 0xfa0000>; }; }; }; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 7cde28e85b..b3598a2000 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -334,7 +334,7 @@ define Device/asus_rp-ac66 SOC := qca9563 DEVICE_VENDOR := ASUS DEVICE_MODEL := RP-AC66 - IMAGE_SIZE := 15488k + IMAGE_SIZE := 16000k IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ append-rootfs | pad-rootfs From 6d76ec38721f964ae9ac65d80ef8628199986fa4 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Jan 2022 19:37:41 +0000 Subject: [PATCH 041/144] procd: support generic mount triggers and clean up Allow init scripts to trigger free-form actions by exposing procd_add_action_mount_trigger. Clean up mount trigger wrappers while at it to reduce code duplication. Signed-off-by: Daniel Golle --- package/system/procd/files/procd.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 2284f55ed2..5148b2f03c 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -363,14 +363,15 @@ _procd_add_mount_trigger() { } _procd_add_action_mount_trigger() { + local action="$1" + shift + local mountpoints="$(procd_get_mountpoints "$@")" + [ "${mountpoints//[[:space:]]}" ] || return 0 local script=$(readlink "$initscript") local name=$(basename ${script:-$initscript}) - local action="$1" - local mpath - shift _procd_open_trigger - _procd_add_mount_trigger mount.add $action "$@" + _procd_add_mount_trigger mount.add $action "$mountpoints" _procd_close_trigger } @@ -384,7 +385,7 @@ procd_get_mountpoints() { target="${target%%/}/" [ "$path" != "${path##$target}" ] && echo "${target%%/}" } - + local mpath config_load fstab for mpath in "$@"; do config_foreach __procd_check_mount mount "$mpath" @@ -393,15 +394,11 @@ procd_get_mountpoints() { } _procd_add_restart_mount_trigger() { - local mountpoints="$(procd_get_mountpoints "$@")" - [ "${mountpoints//[[:space:]]}" ] && - _procd_add_action_mount_trigger restart $mountpoints + _procd_add_action_mount_trigger restart "$@" } _procd_add_reload_mount_trigger() { - local mountpoints="$(procd_get_mountpoints "$@")" - [ "${mountpoints//[[:space:]]}" ] && - _procd_add_action_mount_trigger reload $mountpoints + _procd_add_action_mount_trigger reload "$@" } _procd_add_raw_trigger() { @@ -638,6 +635,7 @@ _procd_wrapper \ procd_add_mount_trigger \ procd_add_reload_trigger \ procd_add_reload_interface_trigger \ + procd_add_action_mount_trigger \ procd_add_reload_mount_trigger \ procd_add_restart_mount_trigger \ procd_open_trigger \ From 88baf6ce2c880149bd1c1d8ddacc7bc61dd4f18b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Jan 2022 19:39:21 +0000 Subject: [PATCH 042/144] ubox: only start log to file when filesystem has been mounted If log_file is on an filesystem mounted using /etc/config/fstab we have to wait for that to happen before starting the logread process. Inhibit the start of the file-writer process and use a mount trigger to fire it up once the filesystem actually becomes available. Signed-off-by: Daniel Golle --- package/system/ubox/files/log.init | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init index c4802d4199..6587cf6b06 100644 --- a/package/system/ubox/files/log.init +++ b/package/system/ubox/files/log.init @@ -9,6 +9,8 @@ PIDCOUNT=0 USE_PROCD=1 PROG=/sbin/logread +extra_command "start_file" "Start writing to log file" + validate_log_section() { uci_load_validate system system "$1" "$2" \ @@ -34,7 +36,7 @@ start_service_daemon() { [ $log_buffer_size -eq 0 -a $log_size -gt 0 ] && log_buffer_size=$log_size [ $log_buffer_size -eq 0 ] && log_buffer_size=64 - procd_open_instance + procd_open_instance logd procd_set_param command "/sbin/logd" procd_append_param command -S "${log_buffer_size}" procd_set_param respawn 5 1 -1 @@ -52,9 +54,12 @@ start_service_file() } [ -z "${log_file}" ] && return + [ "$_BOOT" = "1" ] && + [ "$(procd_get_mountpoints "${log_file}")" ] && return 0 + mkdir -p "$(dirname "${log_file}")" - procd_open_instance + procd_open_instance logfile procd_set_param command "$PROG" -f -F "$log_file" -p "$pid_file" [ -n "${log_size}" ] && procd_append_param command -S "$log_size" procd_close_instance @@ -73,7 +78,7 @@ start_service_remote() [ -z "${log_ip}" ] && return [ -z "${log_hostname}" ] && log_hostname=$(cat /proc/sys/kernel/hostname) - procd_open_instance + procd_open_instance logremote procd_set_param command "$PROG" -f -h "$log_hostname" -r "$log_ip" "${log_port}" -p "$pid_file" case "${log_proto}" in "udp") procd_append_param command -u;; @@ -83,10 +88,17 @@ start_service_remote() procd_close_instance } +register_mount_trigger() +{ + [ -n "${log_file}" ] && procd_add_action_mount_trigger start_file "${log_file}" +} + service_triggers() { + config_load system procd_add_reload_trigger "system" procd_add_validation validate_log_section + config_foreach validate_log_section system register_mount_trigger } start_service() @@ -96,3 +108,13 @@ start_service() config_foreach validate_log_section system start_service_file config_foreach validate_log_section system start_service_remote } + +start_file() +{ + config_load system + config_foreach validate_log_section system start_service_file +} + +boot() { + _BOOT=1 start +} From 3572c5a5da9dfd31ecc4096a8ba1c90683dba3e2 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sun, 30 Jan 2022 22:19:34 +0100 Subject: [PATCH 043/144] glibc: update to 2.34 HEAD 72123e1b56 NEWS: Add a bug entry for BZ #28755 08beb3a3f4 x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755] b50d5b746c x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755] 1b9cd6a721 NEWS: add bug entry for BZ #28769 and BZ #28770 3438bbca90 Linux: Detect user namespace support in io/tst-getcwd-smallbuff d084965adc realpath: Avoid overwriting preexisting error (CVE-2021-3998) 472e799a5f getcwd: Set errno to ERANGE for size == 1 (CVE-2021-3999) 8c8a71c85f tst-realpath-toolong: Fix hurd build f7a79879c0 realpath: Set errno to ENAMETOOLONG for result larger than PATH_MAX [BZ #28770] 73c362840c stdlib: Fix formatting of tests list in Makefile 269eb9d930 stdlib: Sort tests in Makefile 062ff490c1 support: Add helpers to create paths longer than PATH_MAX 82b1acd9de powerpc: Fix unrecognized instruction errors with recent binutils 1d401d1fcc x86: use default cache size if it cannot be determined [BZ #28784] 6890b8a3ae CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug 28768) 1081f1d3dd sunrpc: Test case for clnt_create "unix" buffer overflow (bug 22542) 7b5d433fd0 CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" (bug 22542) 5575daae50 socket: Add the __sockaddr_un_set function 03e6e02e6a Disable debuginfod in printer tests [BZ #28757] 705f1e4606 Update syscall lists for Linux 5.16 2fe2af88ab i386: Remove broken CAN_USE_REGISTER_ASM_EBP (bug 28771) 73558ffe84 Update syscall lists for Linux 5.15 e64235ff42 powerpc: Fix unrecognized instruction errors with recent GCC Signed-off-by: Hans Dedecker --- toolchain/glibc/common.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index e957ff52e5..51d13c457e 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -12,8 +12,8 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=d5ba02f67dd62a63e29c29eebd6c543722aa6b5b -PKG_MIRROR_HASH:=19e49929c7ea3480a0d1213b6763a23a5ed8129a34fe201a985498927c583ce1 +PKG_SOURCE_VERSION:=72123e1b56f53f9205bb105f8a62d0869b837b22 +PKG_MIRROR_HASH:=934ec7067d41da0b76b8f29a1cd03b10ba9d98c2f761f7b32f8595e59ac2b428 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz From b0145891676faa38f0a5991e3e229aed7b4a9117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 30 Jan 2022 23:30:16 +0100 Subject: [PATCH 044/144] bcm4908: backport BCM4908 pinctrl driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- target/linux/bcm4908/config-5.10 | 6 + target/linux/bcm4908/config-5.4 | 6 + ...ctrl-Add-binding-for-BCM4908-pinctrl.patch | 111 ++++ ...rl-bcm-add-driver-for-BCM4908-pinmux.patch | 629 ++++++++++++++++++ ...ctrl-Add-binding-for-BCM4908-pinctrl.patch | 111 ++++ ...rl-bcm-add-driver-for-BCM4908-pinmux.patch | 629 ++++++++++++++++++ 6 files changed, 1492 insertions(+) create mode 100644 target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch create mode 100644 target/linux/bcm4908/patches-5.10/085-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch create mode 100644 target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch create mode 100644 target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch diff --git a/target/linux/bcm4908/config-5.10 b/target/linux/bcm4908/config-5.10 index 48a91b3f0b..41253a8400 100644 --- a/target/linux/bcm4908/config-5.10 +++ b/target/linux/bcm4908/config-5.10 @@ -81,6 +81,9 @@ CONFIG_GENERIC_MSI_IRQ=y CONFIG_GENERIC_MSI_IRQ_DOMAIN=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_STRNCPY_FROM_USER=y @@ -160,6 +163,9 @@ CONFIG_PHYLIB=y CONFIG_PHYLINK=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_BRCM_USB=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_BCM4908=y +# CONFIG_PINCTRL_SINGLE is not set CONFIG_PM=y CONFIG_PM_CLK=y CONFIG_PM_GENERIC_DOMAINS=y diff --git a/target/linux/bcm4908/config-5.4 b/target/linux/bcm4908/config-5.4 index 37706f61d3..54c2edb29f 100644 --- a/target/linux/bcm4908/config-5.4 +++ b/target/linux/bcm4908/config-5.4 @@ -90,6 +90,9 @@ CONFIG_GENERIC_MSI_IRQ=y CONFIG_GENERIC_MSI_IRQ_DOMAIN=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_STRNCPY_FROM_USER=y @@ -167,6 +170,9 @@ CONFIG_PHYLIB=y CONFIG_PHYLINK=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_BRCM_USB=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_BCM4908=y +# CONFIG_PINCTRL_SINGLE is not set CONFIG_PM=y CONFIG_PM_CLK=y CONFIG_PM_GENERIC_DOMAINS=y diff --git a/target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch b/target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch new file mode 100644 index 0000000000..0d2573b902 --- /dev/null +++ b/target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch @@ -0,0 +1,111 @@ +From 7b5730f0ff24b0d7d1cb660a482384a807618a46 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 24 Jan 2022 11:22:42 +0100 +Subject: [PATCH] dt-bindings: pinctrl: Add binding for BCM4908 pinctrl +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's hardware block that is part of every SoC from BCM4908 family. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20220124102243.14912-1-zajec5@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm4908-pinctrl.yaml | 72 +++++++++++++++++++ + MAINTAINERS | 7 ++ + 2 files changed, 79 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml +@@ -0,0 +1,72 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm4908-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM4908 pin controller ++ ++maintainers: ++ - Rafał Miłecki ++ ++description: ++ Binding for pin controller present on BCM4908 family SoCs. ++ ++properties: ++ compatible: ++ const: brcm,bcm4908-pinctrl ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ led_0, led_1, led_2, led_3, led_4, led_5, led_6, led_7, led_8, ++ led_9, led_10, led_11, led_12, led_13, led_14, led_15, led_16, ++ led_17, led_18, led_19, led_20, led_21, led_22, led_23, led_24, ++ led_25, led_26, led_27, led_28, led_29, led_30, led_31, ++ hs_uart, i2c, i2s, nand_ctrl, nand_data, emmc_ctrl, usb0_pwr, ++ usb1_pwr ] ++ ++ groups: ++ minItems: 1 ++ maxItems: 2 ++ items: ++ enum: [ led_0_grp_a, led_1_grp_a, led_2_grp_a, led_3_grp_a, ++ led_4_grp_a, led_5_grp_a, led_6_grp_a, led_7_grp_a, ++ led_8_grp_a, led_9_grp_a, led_10_grp_a, led_10_grp_b, ++ led_11_grp_a, led_11_grp_b, led_12_grp_a, led_12_grp_b, ++ led_13_grp_a, led_13_grp_b, led_14_grp_a, led_15_grp_a, ++ led_16_grp_a, led_17_grp_a, led_18_grp_a, led_19_grp_a, ++ led_20_grp_a, led_21_grp_a, led_22_grp_a, led_23_grp_a, ++ led_24_grp_a, led_25_grp_a, led_26_grp_a, led_27_grp_a, ++ led_28_grp_a, led_29_grp_a, led_30_grp_a, led_31_grp_a, ++ led_31_grp_b, hs_uart_grp, i2c_grp_a, i2c_grp_b, i2s_grp, ++ nand_ctrl_grp, nand_data_grp, emmc_ctrl_grp, usb0_pwr_grp, ++ usb1_pwr_grp ] ++ ++allOf: ++ - $ref: pinctrl.yaml# ++ ++required: ++ - compatible ++ - reg ++ ++unevaluatedProperties: false ++ ++examples: ++ - | ++ pinctrl@ff800560 { ++ compatible = "brcm,bcm4908-pinctrl"; ++ reg = <0xff800560 0x10>; ++ ++ led_0-a-pins { ++ function = "led_0"; ++ groups = "led_0_grp_a"; ++ }; ++ }; +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -3688,6 +3688,13 @@ F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml + F: drivers/net/ethernet/broadcom/bcm4908_enet.* + F: drivers/net/ethernet/broadcom/unimac.h + ++BROADCOM BCM4908 PINMUX DRIVER ++M: Rafał Miłecki ++M: bcm-kernel-feedback-list@broadcom.com ++L: linux-gpio@vger.kernel.org ++S: Maintained ++F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml ++ + BROADCOM BCM5301X ARM ARCHITECTURE + M: Florian Fainelli + M: Hauke Mehrtens diff --git a/target/linux/bcm4908/patches-5.10/085-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch b/target/linux/bcm4908/patches-5.10/085-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch new file mode 100644 index 0000000000..bb2ae459e9 --- /dev/null +++ b/target/linux/bcm4908/patches-5.10/085-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch @@ -0,0 +1,629 @@ +From f7e322d99f1180270fb4a3e1ae992b3116cfcf34 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 24 Jan 2022 11:22:43 +0100 +Subject: [PATCH] pinctrl: bcm: add driver for BCM4908 pinmux +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM4908 has its own pins layout so it needs a custom binding and a Linux +driver. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20220124102243.14912-2-zajec5@gmail.com +Signed-off-by: Linus Walleij +--- + MAINTAINERS | 1 + + drivers/pinctrl/bcm/Kconfig | 14 + + drivers/pinctrl/bcm/Makefile | 1 + + drivers/pinctrl/bcm/pinctrl-bcm4908.c | 563 ++++++++++++++++++++++++++ + 4 files changed, 579 insertions(+) + create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm4908.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -3442,6 +3442,7 @@ M: bcm-kernel-feedback-list@broadcom.com + L: linux-gpio@vger.kernel.org + S: Maintained + F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml ++F: drivers/pinctrl/bcm/pinctrl-bcm4908.c + + BROADCOM BCM5301X ARM ARCHITECTURE + M: Hauke Mehrtens +--- a/drivers/pinctrl/bcm/Kconfig ++++ b/drivers/pinctrl/bcm/Kconfig +@@ -29,6 +29,20 @@ config PINCTRL_BCM2835 + help + Say Y here to enable the Broadcom BCM2835 GPIO driver. + ++config PINCTRL_BCM4908 ++ tristate "Broadcom BCM4908 pinmux driver" ++ depends on OF && (ARCH_BCM4908 || COMPILE_TEST) ++ select PINMUX ++ select PINCONF ++ select GENERIC_PINCONF ++ select GENERIC_PINCTRL_GROUPS ++ select GENERIC_PINMUX_FUNCTIONS ++ default ARCH_BCM4908 ++ help ++ Driver for BCM4908 family SoCs with integrated pin controller. ++ ++ If compiled as module it will be called pinctrl-bcm4908. ++ + config PINCTRL_IPROC_GPIO + bool "Broadcom iProc GPIO (with PINCONF) driver" + depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) +--- a/drivers/pinctrl/bcm/Makefile ++++ b/drivers/pinctrl/bcm/Makefile +@@ -3,6 +3,7 @@ + + obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o + obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o ++obj-$(CONFIG_PINCTRL_BCM4908) += pinctrl-bcm4908.o + obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o + obj-$(CONFIG_PINCTRL_CYGNUS_MUX) += pinctrl-cygnus-mux.o + obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o +--- /dev/null ++++ b/drivers/pinctrl/bcm/pinctrl-bcm4908.c +@@ -0,0 +1,560 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* Copyright (C) 2021 Rafał Miłecki */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "../core.h" ++#include "../pinmux.h" ++ ++#define BCM4908_NUM_PINS 86 ++ ++#define BCM4908_TEST_PORT_BLOCK_EN_LSB 0x00 ++#define BCM4908_TEST_PORT_BLOCK_DATA_MSB 0x04 ++#define BCM4908_TEST_PORT_BLOCK_DATA_LSB 0x08 ++#define BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT 12 ++#define BCM4908_TEST_PORT_COMMAND 0x0c ++#define BCM4908_TEST_PORT_CMD_LOAD_MUX_REG 0x00000021 ++ ++struct bcm4908_pinctrl { ++ struct device *dev; ++ void __iomem *base; ++ struct mutex mutex; ++ struct pinctrl_dev *pctldev; ++ struct pinctrl_desc pctldesc; ++}; ++ ++/* ++ * Groups ++ */ ++ ++struct bcm4908_pinctrl_pin_setup { ++ unsigned int number; ++ unsigned int function; ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_0_pins_a[] = { ++ { 0, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_1_pins_a[] = { ++ { 1, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_2_pins_a[] = { ++ { 2, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_3_pins_a[] = { ++ { 3, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_4_pins_a[] = { ++ { 4, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_5_pins_a[] = { ++ { 5, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_6_pins_a[] = { ++ { 6, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_7_pins_a[] = { ++ { 7, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_8_pins_a[] = { ++ { 8, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_9_pins_a[] = { ++ { 9, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_10_pins_a[] = { ++ { 10, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_11_pins_a[] = { ++ { 11, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_12_pins_a[] = { ++ { 12, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_13_pins_a[] = { ++ { 13, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_14_pins_a[] = { ++ { 14, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_15_pins_a[] = { ++ { 15, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_16_pins_a[] = { ++ { 16, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_17_pins_a[] = { ++ { 17, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_18_pins_a[] = { ++ { 18, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_19_pins_a[] = { ++ { 19, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_20_pins_a[] = { ++ { 20, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_21_pins_a[] = { ++ { 21, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_22_pins_a[] = { ++ { 22, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_23_pins_a[] = { ++ { 23, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_24_pins_a[] = { ++ { 24, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_25_pins_a[] = { ++ { 25, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_26_pins_a[] = { ++ { 26, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_27_pins_a[] = { ++ { 27, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_28_pins_a[] = { ++ { 28, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_29_pins_a[] = { ++ { 29, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_30_pins_a[] = { ++ { 30, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_31_pins_a[] = { ++ { 31, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_10_pins_b[] = { ++ { 8, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_11_pins_b[] = { ++ { 9, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_12_pins_b[] = { ++ { 0, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_13_pins_b[] = { ++ { 1, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_31_pins_b[] = { ++ { 30, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup hs_uart_pins[] = { ++ { 10, 0 }, /* CTS */ ++ { 11, 0 }, /* RTS */ ++ { 12, 0 }, /* RXD */ ++ { 13, 0 }, /* TXD */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup i2c_pins_a[] = { ++ { 18, 0 }, /* SDA */ ++ { 19, 0 }, /* SCL */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup i2c_pins_b[] = { ++ { 22, 0 }, /* SDA */ ++ { 23, 0 }, /* SCL */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup i2s_pins[] = { ++ { 27, 0 }, /* MCLK */ ++ { 28, 0 }, /* LRCK */ ++ { 29, 0 }, /* SDATA */ ++ { 30, 0 }, /* SCLK */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup nand_ctrl_pins[] = { ++ { 32, 0 }, ++ { 33, 0 }, ++ { 34, 0 }, ++ { 43, 0 }, ++ { 44, 0 }, ++ { 45, 0 }, ++ { 56, 1 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup nand_data_pins[] = { ++ { 35, 0 }, ++ { 36, 0 }, ++ { 37, 0 }, ++ { 38, 0 }, ++ { 39, 0 }, ++ { 40, 0 }, ++ { 41, 0 }, ++ { 42, 0 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup emmc_ctrl_pins[] = { ++ { 46, 0 }, ++ { 47, 0 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup usb0_pwr_pins[] = { ++ { 63, 0 }, ++ { 64, 0 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup usb1_pwr_pins[] = { ++ { 66, 0 }, ++ { 67, 0 }, ++}; ++ ++struct bcm4908_pinctrl_grp { ++ const char *name; ++ const struct bcm4908_pinctrl_pin_setup *pins; ++ const unsigned int num_pins; ++}; ++ ++static const struct bcm4908_pinctrl_grp bcm4908_pinctrl_grps[] = { ++ { "led_0_grp_a", led_0_pins_a, ARRAY_SIZE(led_0_pins_a) }, ++ { "led_1_grp_a", led_1_pins_a, ARRAY_SIZE(led_1_pins_a) }, ++ { "led_2_grp_a", led_2_pins_a, ARRAY_SIZE(led_2_pins_a) }, ++ { "led_3_grp_a", led_3_pins_a, ARRAY_SIZE(led_3_pins_a) }, ++ { "led_4_grp_a", led_4_pins_a, ARRAY_SIZE(led_4_pins_a) }, ++ { "led_5_grp_a", led_5_pins_a, ARRAY_SIZE(led_5_pins_a) }, ++ { "led_6_grp_a", led_6_pins_a, ARRAY_SIZE(led_6_pins_a) }, ++ { "led_7_grp_a", led_7_pins_a, ARRAY_SIZE(led_7_pins_a) }, ++ { "led_8_grp_a", led_8_pins_a, ARRAY_SIZE(led_8_pins_a) }, ++ { "led_9_grp_a", led_9_pins_a, ARRAY_SIZE(led_9_pins_a) }, ++ { "led_10_grp_a", led_10_pins_a, ARRAY_SIZE(led_10_pins_a) }, ++ { "led_11_grp_a", led_11_pins_a, ARRAY_SIZE(led_11_pins_a) }, ++ { "led_12_grp_a", led_12_pins_a, ARRAY_SIZE(led_12_pins_a) }, ++ { "led_13_grp_a", led_13_pins_a, ARRAY_SIZE(led_13_pins_a) }, ++ { "led_14_grp_a", led_14_pins_a, ARRAY_SIZE(led_14_pins_a) }, ++ { "led_15_grp_a", led_15_pins_a, ARRAY_SIZE(led_15_pins_a) }, ++ { "led_16_grp_a", led_16_pins_a, ARRAY_SIZE(led_16_pins_a) }, ++ { "led_17_grp_a", led_17_pins_a, ARRAY_SIZE(led_17_pins_a) }, ++ { "led_18_grp_a", led_18_pins_a, ARRAY_SIZE(led_18_pins_a) }, ++ { "led_19_grp_a", led_19_pins_a, ARRAY_SIZE(led_19_pins_a) }, ++ { "led_20_grp_a", led_20_pins_a, ARRAY_SIZE(led_20_pins_a) }, ++ { "led_21_grp_a", led_21_pins_a, ARRAY_SIZE(led_21_pins_a) }, ++ { "led_22_grp_a", led_22_pins_a, ARRAY_SIZE(led_22_pins_a) }, ++ { "led_23_grp_a", led_23_pins_a, ARRAY_SIZE(led_23_pins_a) }, ++ { "led_24_grp_a", led_24_pins_a, ARRAY_SIZE(led_24_pins_a) }, ++ { "led_25_grp_a", led_25_pins_a, ARRAY_SIZE(led_25_pins_a) }, ++ { "led_26_grp_a", led_26_pins_a, ARRAY_SIZE(led_26_pins_a) }, ++ { "led_27_grp_a", led_27_pins_a, ARRAY_SIZE(led_27_pins_a) }, ++ { "led_28_grp_a", led_28_pins_a, ARRAY_SIZE(led_28_pins_a) }, ++ { "led_29_grp_a", led_29_pins_a, ARRAY_SIZE(led_29_pins_a) }, ++ { "led_30_grp_a", led_30_pins_a, ARRAY_SIZE(led_30_pins_a) }, ++ { "led_31_grp_a", led_31_pins_a, ARRAY_SIZE(led_31_pins_a) }, ++ { "led_10_grp_b", led_10_pins_b, ARRAY_SIZE(led_10_pins_b) }, ++ { "led_11_grp_b", led_11_pins_b, ARRAY_SIZE(led_11_pins_b) }, ++ { "led_12_grp_b", led_12_pins_b, ARRAY_SIZE(led_12_pins_b) }, ++ { "led_13_grp_b", led_13_pins_b, ARRAY_SIZE(led_13_pins_b) }, ++ { "led_31_grp_b", led_31_pins_b, ARRAY_SIZE(led_31_pins_b) }, ++ { "hs_uart_grp", hs_uart_pins, ARRAY_SIZE(hs_uart_pins) }, ++ { "i2c_grp_a", i2c_pins_a, ARRAY_SIZE(i2c_pins_a) }, ++ { "i2c_grp_b", i2c_pins_b, ARRAY_SIZE(i2c_pins_b) }, ++ { "i2s_grp", i2s_pins, ARRAY_SIZE(i2s_pins) }, ++ { "nand_ctrl_grp", nand_ctrl_pins, ARRAY_SIZE(nand_ctrl_pins) }, ++ { "nand_data_grp", nand_data_pins, ARRAY_SIZE(nand_data_pins) }, ++ { "emmc_ctrl_grp", emmc_ctrl_pins, ARRAY_SIZE(emmc_ctrl_pins) }, ++ { "usb0_pwr_grp", usb0_pwr_pins, ARRAY_SIZE(usb0_pwr_pins) }, ++ { "usb1_pwr_grp", usb1_pwr_pins, ARRAY_SIZE(usb1_pwr_pins) }, ++}; ++ ++/* ++ * Functions ++ */ ++ ++struct bcm4908_pinctrl_function { ++ const char *name; ++ const char * const *groups; ++ const unsigned int num_groups; ++}; ++ ++static const char * const led_0_groups[] = { "led_0_grp_a" }; ++static const char * const led_1_groups[] = { "led_1_grp_a" }; ++static const char * const led_2_groups[] = { "led_2_grp_a" }; ++static const char * const led_3_groups[] = { "led_3_grp_a" }; ++static const char * const led_4_groups[] = { "led_4_grp_a" }; ++static const char * const led_5_groups[] = { "led_5_grp_a" }; ++static const char * const led_6_groups[] = { "led_6_grp_a" }; ++static const char * const led_7_groups[] = { "led_7_grp_a" }; ++static const char * const led_8_groups[] = { "led_8_grp_a" }; ++static const char * const led_9_groups[] = { "led_9_grp_a" }; ++static const char * const led_10_groups[] = { "led_10_grp_a", "led_10_grp_b" }; ++static const char * const led_11_groups[] = { "led_11_grp_a", "led_11_grp_b" }; ++static const char * const led_12_groups[] = { "led_12_grp_a", "led_12_grp_b" }; ++static const char * const led_13_groups[] = { "led_13_grp_a", "led_13_grp_b" }; ++static const char * const led_14_groups[] = { "led_14_grp_a" }; ++static const char * const led_15_groups[] = { "led_15_grp_a" }; ++static const char * const led_16_groups[] = { "led_16_grp_a" }; ++static const char * const led_17_groups[] = { "led_17_grp_a" }; ++static const char * const led_18_groups[] = { "led_18_grp_a" }; ++static const char * const led_19_groups[] = { "led_19_grp_a" }; ++static const char * const led_20_groups[] = { "led_20_grp_a" }; ++static const char * const led_21_groups[] = { "led_21_grp_a" }; ++static const char * const led_22_groups[] = { "led_22_grp_a" }; ++static const char * const led_23_groups[] = { "led_23_grp_a" }; ++static const char * const led_24_groups[] = { "led_24_grp_a" }; ++static const char * const led_25_groups[] = { "led_25_grp_a" }; ++static const char * const led_26_groups[] = { "led_26_grp_a" }; ++static const char * const led_27_groups[] = { "led_27_grp_a" }; ++static const char * const led_28_groups[] = { "led_28_grp_a" }; ++static const char * const led_29_groups[] = { "led_29_grp_a" }; ++static const char * const led_30_groups[] = { "led_30_grp_a" }; ++static const char * const led_31_groups[] = { "led_31_grp_a", "led_31_grp_b" }; ++static const char * const hs_uart_groups[] = { "hs_uart_grp" }; ++static const char * const i2c_groups[] = { "i2c_grp_a", "i2c_grp_b" }; ++static const char * const i2s_groups[] = { "i2s_grp" }; ++static const char * const nand_ctrl_groups[] = { "nand_ctrl_grp" }; ++static const char * const nand_data_groups[] = { "nand_data_grp" }; ++static const char * const emmc_ctrl_groups[] = { "emmc_ctrl_grp" }; ++static const char * const usb0_pwr_groups[] = { "usb0_pwr_grp" }; ++static const char * const usb1_pwr_groups[] = { "usb1_pwr_grp" }; ++ ++static const struct bcm4908_pinctrl_function bcm4908_pinctrl_functions[] = { ++ { "led_0", led_0_groups, ARRAY_SIZE(led_0_groups) }, ++ { "led_1", led_1_groups, ARRAY_SIZE(led_1_groups) }, ++ { "led_2", led_2_groups, ARRAY_SIZE(led_2_groups) }, ++ { "led_3", led_3_groups, ARRAY_SIZE(led_3_groups) }, ++ { "led_4", led_4_groups, ARRAY_SIZE(led_4_groups) }, ++ { "led_5", led_5_groups, ARRAY_SIZE(led_5_groups) }, ++ { "led_6", led_6_groups, ARRAY_SIZE(led_6_groups) }, ++ { "led_7", led_7_groups, ARRAY_SIZE(led_7_groups) }, ++ { "led_8", led_8_groups, ARRAY_SIZE(led_8_groups) }, ++ { "led_9", led_9_groups, ARRAY_SIZE(led_9_groups) }, ++ { "led_10", led_10_groups, ARRAY_SIZE(led_10_groups) }, ++ { "led_11", led_11_groups, ARRAY_SIZE(led_11_groups) }, ++ { "led_12", led_12_groups, ARRAY_SIZE(led_12_groups) }, ++ { "led_13", led_13_groups, ARRAY_SIZE(led_13_groups) }, ++ { "led_14", led_14_groups, ARRAY_SIZE(led_14_groups) }, ++ { "led_15", led_15_groups, ARRAY_SIZE(led_15_groups) }, ++ { "led_16", led_16_groups, ARRAY_SIZE(led_16_groups) }, ++ { "led_17", led_17_groups, ARRAY_SIZE(led_17_groups) }, ++ { "led_18", led_18_groups, ARRAY_SIZE(led_18_groups) }, ++ { "led_19", led_19_groups, ARRAY_SIZE(led_19_groups) }, ++ { "led_20", led_20_groups, ARRAY_SIZE(led_20_groups) }, ++ { "led_21", led_21_groups, ARRAY_SIZE(led_21_groups) }, ++ { "led_22", led_22_groups, ARRAY_SIZE(led_22_groups) }, ++ { "led_23", led_23_groups, ARRAY_SIZE(led_23_groups) }, ++ { "led_24", led_24_groups, ARRAY_SIZE(led_24_groups) }, ++ { "led_25", led_25_groups, ARRAY_SIZE(led_25_groups) }, ++ { "led_26", led_26_groups, ARRAY_SIZE(led_26_groups) }, ++ { "led_27", led_27_groups, ARRAY_SIZE(led_27_groups) }, ++ { "led_28", led_28_groups, ARRAY_SIZE(led_28_groups) }, ++ { "led_29", led_29_groups, ARRAY_SIZE(led_29_groups) }, ++ { "led_30", led_30_groups, ARRAY_SIZE(led_30_groups) }, ++ { "led_31", led_31_groups, ARRAY_SIZE(led_31_groups) }, ++ { "hs_uart", hs_uart_groups, ARRAY_SIZE(hs_uart_groups) }, ++ { "i2c", i2c_groups, ARRAY_SIZE(i2c_groups) }, ++ { "i2s", i2s_groups, ARRAY_SIZE(i2s_groups) }, ++ { "nand_ctrl", nand_ctrl_groups, ARRAY_SIZE(nand_ctrl_groups) }, ++ { "nand_data", nand_data_groups, ARRAY_SIZE(nand_data_groups) }, ++ { "emmc_ctrl", emmc_ctrl_groups, ARRAY_SIZE(emmc_ctrl_groups) }, ++ { "usb0_pwr", usb0_pwr_groups, ARRAY_SIZE(usb0_pwr_groups) }, ++ { "usb1_pwr", usb1_pwr_groups, ARRAY_SIZE(usb1_pwr_groups) }, ++}; ++ ++/* ++ * Groups code ++ */ ++ ++static const struct pinctrl_ops bcm4908_pinctrl_ops = { ++ .get_groups_count = pinctrl_generic_get_group_count, ++ .get_group_name = pinctrl_generic_get_group_name, ++ .get_group_pins = pinctrl_generic_get_group_pins, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_group, ++ .dt_free_map = pinconf_generic_dt_free_map, ++}; ++ ++/* ++ * Functions code ++ */ ++ ++static int bcm4908_pinctrl_set_mux(struct pinctrl_dev *pctrl_dev, ++ unsigned int func_selector, ++ unsigned int group_selector) ++{ ++ struct bcm4908_pinctrl *bcm4908_pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); ++ const struct bcm4908_pinctrl_grp *group; ++ struct group_desc *group_desc; ++ int i; ++ ++ group_desc = pinctrl_generic_get_group(pctrl_dev, group_selector); ++ if (!group_desc) ++ return -EINVAL; ++ group = group_desc->data; ++ ++ mutex_lock(&bcm4908_pinctrl->mutex); ++ for (i = 0; i < group->num_pins; i++) { ++ u32 lsb = 0; ++ ++ lsb |= group->pins[i].number; ++ lsb |= group->pins[i].function << BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT; ++ ++ writel(0x0, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_MSB); ++ writel(lsb, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_LSB); ++ writel(BCM4908_TEST_PORT_CMD_LOAD_MUX_REG, ++ bcm4908_pinctrl->base + BCM4908_TEST_PORT_COMMAND); ++ } ++ mutex_unlock(&bcm4908_pinctrl->mutex); ++ ++ return 0; ++} ++ ++static const struct pinmux_ops bcm4908_pinctrl_pmxops = { ++ .get_functions_count = pinmux_generic_get_function_count, ++ .get_function_name = pinmux_generic_get_function_name, ++ .get_function_groups = pinmux_generic_get_function_groups, ++ .set_mux = bcm4908_pinctrl_set_mux, ++}; ++ ++/* ++ * Controller code ++ */ ++ ++static struct pinctrl_desc bcm4908_pinctrl_desc = { ++ .name = "bcm4908-pinctrl", ++ .pctlops = &bcm4908_pinctrl_ops, ++ .pmxops = &bcm4908_pinctrl_pmxops, ++}; ++ ++static const struct of_device_id bcm4908_pinctrl_of_match_table[] = { ++ { .compatible = "brcm,bcm4908-pinctrl", }, ++ { } ++}; ++ ++static int bcm4908_pinctrl_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct bcm4908_pinctrl *bcm4908_pinctrl; ++ struct pinctrl_desc *pctldesc; ++ struct pinctrl_pin_desc *pins; ++ int i; ++ ++ bcm4908_pinctrl = devm_kzalloc(dev, sizeof(*bcm4908_pinctrl), GFP_KERNEL); ++ if (!bcm4908_pinctrl) ++ return -ENOMEM; ++ pctldesc = &bcm4908_pinctrl->pctldesc; ++ platform_set_drvdata(pdev, bcm4908_pinctrl); ++ ++ /* Set basic properties */ ++ ++ bcm4908_pinctrl->dev = dev; ++ ++ bcm4908_pinctrl->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(bcm4908_pinctrl->base)) ++ return PTR_ERR(bcm4908_pinctrl->base); ++ ++ mutex_init(&bcm4908_pinctrl->mutex); ++ ++ memcpy(pctldesc, &bcm4908_pinctrl_desc, sizeof(*pctldesc)); ++ ++ /* Set pinctrl properties */ ++ ++ pins = devm_kcalloc(dev, BCM4908_NUM_PINS, sizeof(*pins), GFP_KERNEL); ++ if (!pins) ++ return -ENOMEM; ++ for (i = 0; i < BCM4908_NUM_PINS; i++) { ++ pins[i].number = i; ++ pins[i].name = devm_kasprintf(dev, GFP_KERNEL, "pin-%d", i); ++ if (!pins[i].name) ++ return -ENOMEM; ++ } ++ pctldesc->pins = pins; ++ pctldesc->npins = BCM4908_NUM_PINS; ++ ++ /* Register */ ++ ++ bcm4908_pinctrl->pctldev = devm_pinctrl_register(dev, pctldesc, bcm4908_pinctrl); ++ if (IS_ERR(bcm4908_pinctrl->pctldev)) ++ return dev_err_probe(dev, PTR_ERR(bcm4908_pinctrl->pctldev), ++ "Failed to register pinctrl\n"); ++ ++ /* Groups */ ++ ++ for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_grps); i++) { ++ const struct bcm4908_pinctrl_grp *group = &bcm4908_pinctrl_grps[i]; ++ int *pins; ++ int j; ++ ++ pins = devm_kcalloc(dev, group->num_pins, sizeof(*pins), GFP_KERNEL); ++ if (!pins) ++ return -ENOMEM; ++ for (j = 0; j < group->num_pins; j++) ++ pins[j] = group->pins[j].number; ++ ++ pinctrl_generic_add_group(bcm4908_pinctrl->pctldev, group->name, ++ pins, group->num_pins, (void *)group); ++ } ++ ++ /* Functions */ ++ ++ for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_functions); i++) { ++ const struct bcm4908_pinctrl_function *function = &bcm4908_pinctrl_functions[i]; ++ ++ pinmux_generic_add_function(bcm4908_pinctrl->pctldev, ++ function->name, ++ function->groups, ++ function->num_groups, NULL); ++ } ++ ++ return 0; ++} ++ ++static struct platform_driver bcm4908_pinctrl_driver = { ++ .probe = bcm4908_pinctrl_probe, ++ .driver = { ++ .name = "bcm4908-pinctrl", ++ .of_match_table = bcm4908_pinctrl_of_match_table, ++ }, ++}; ++ ++module_platform_driver(bcm4908_pinctrl_driver); ++ ++MODULE_AUTHOR("Rafał Miłecki"); ++MODULE_LICENSE("GPL v2"); ++MODULE_DEVICE_TABLE(of, bcm4908_pinctrl_of_match_table); diff --git a/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch b/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch new file mode 100644 index 0000000000..0d2573b902 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch @@ -0,0 +1,111 @@ +From 7b5730f0ff24b0d7d1cb660a482384a807618a46 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 24 Jan 2022 11:22:42 +0100 +Subject: [PATCH] dt-bindings: pinctrl: Add binding for BCM4908 pinctrl +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's hardware block that is part of every SoC from BCM4908 family. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20220124102243.14912-1-zajec5@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm4908-pinctrl.yaml | 72 +++++++++++++++++++ + MAINTAINERS | 7 ++ + 2 files changed, 79 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml +@@ -0,0 +1,72 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm4908-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM4908 pin controller ++ ++maintainers: ++ - Rafał Miłecki ++ ++description: ++ Binding for pin controller present on BCM4908 family SoCs. ++ ++properties: ++ compatible: ++ const: brcm,bcm4908-pinctrl ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ led_0, led_1, led_2, led_3, led_4, led_5, led_6, led_7, led_8, ++ led_9, led_10, led_11, led_12, led_13, led_14, led_15, led_16, ++ led_17, led_18, led_19, led_20, led_21, led_22, led_23, led_24, ++ led_25, led_26, led_27, led_28, led_29, led_30, led_31, ++ hs_uart, i2c, i2s, nand_ctrl, nand_data, emmc_ctrl, usb0_pwr, ++ usb1_pwr ] ++ ++ groups: ++ minItems: 1 ++ maxItems: 2 ++ items: ++ enum: [ led_0_grp_a, led_1_grp_a, led_2_grp_a, led_3_grp_a, ++ led_4_grp_a, led_5_grp_a, led_6_grp_a, led_7_grp_a, ++ led_8_grp_a, led_9_grp_a, led_10_grp_a, led_10_grp_b, ++ led_11_grp_a, led_11_grp_b, led_12_grp_a, led_12_grp_b, ++ led_13_grp_a, led_13_grp_b, led_14_grp_a, led_15_grp_a, ++ led_16_grp_a, led_17_grp_a, led_18_grp_a, led_19_grp_a, ++ led_20_grp_a, led_21_grp_a, led_22_grp_a, led_23_grp_a, ++ led_24_grp_a, led_25_grp_a, led_26_grp_a, led_27_grp_a, ++ led_28_grp_a, led_29_grp_a, led_30_grp_a, led_31_grp_a, ++ led_31_grp_b, hs_uart_grp, i2c_grp_a, i2c_grp_b, i2s_grp, ++ nand_ctrl_grp, nand_data_grp, emmc_ctrl_grp, usb0_pwr_grp, ++ usb1_pwr_grp ] ++ ++allOf: ++ - $ref: pinctrl.yaml# ++ ++required: ++ - compatible ++ - reg ++ ++unevaluatedProperties: false ++ ++examples: ++ - | ++ pinctrl@ff800560 { ++ compatible = "brcm,bcm4908-pinctrl"; ++ reg = <0xff800560 0x10>; ++ ++ led_0-a-pins { ++ function = "led_0"; ++ groups = "led_0_grp_a"; ++ }; ++ }; +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -3688,6 +3688,13 @@ F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml + F: drivers/net/ethernet/broadcom/bcm4908_enet.* + F: drivers/net/ethernet/broadcom/unimac.h + ++BROADCOM BCM4908 PINMUX DRIVER ++M: Rafał Miłecki ++M: bcm-kernel-feedback-list@broadcom.com ++L: linux-gpio@vger.kernel.org ++S: Maintained ++F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml ++ + BROADCOM BCM5301X ARM ARCHITECTURE + M: Florian Fainelli + M: Hauke Mehrtens diff --git a/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch b/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch new file mode 100644 index 0000000000..bb2ae459e9 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch @@ -0,0 +1,629 @@ +From f7e322d99f1180270fb4a3e1ae992b3116cfcf34 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 24 Jan 2022 11:22:43 +0100 +Subject: [PATCH] pinctrl: bcm: add driver for BCM4908 pinmux +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM4908 has its own pins layout so it needs a custom binding and a Linux +driver. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20220124102243.14912-2-zajec5@gmail.com +Signed-off-by: Linus Walleij +--- + MAINTAINERS | 1 + + drivers/pinctrl/bcm/Kconfig | 14 + + drivers/pinctrl/bcm/Makefile | 1 + + drivers/pinctrl/bcm/pinctrl-bcm4908.c | 563 ++++++++++++++++++++++++++ + 4 files changed, 579 insertions(+) + create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm4908.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -3442,6 +3442,7 @@ M: bcm-kernel-feedback-list@broadcom.com + L: linux-gpio@vger.kernel.org + S: Maintained + F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml ++F: drivers/pinctrl/bcm/pinctrl-bcm4908.c + + BROADCOM BCM5301X ARM ARCHITECTURE + M: Hauke Mehrtens +--- a/drivers/pinctrl/bcm/Kconfig ++++ b/drivers/pinctrl/bcm/Kconfig +@@ -29,6 +29,20 @@ config PINCTRL_BCM2835 + help + Say Y here to enable the Broadcom BCM2835 GPIO driver. + ++config PINCTRL_BCM4908 ++ tristate "Broadcom BCM4908 pinmux driver" ++ depends on OF && (ARCH_BCM4908 || COMPILE_TEST) ++ select PINMUX ++ select PINCONF ++ select GENERIC_PINCONF ++ select GENERIC_PINCTRL_GROUPS ++ select GENERIC_PINMUX_FUNCTIONS ++ default ARCH_BCM4908 ++ help ++ Driver for BCM4908 family SoCs with integrated pin controller. ++ ++ If compiled as module it will be called pinctrl-bcm4908. ++ + config PINCTRL_IPROC_GPIO + bool "Broadcom iProc GPIO (with PINCONF) driver" + depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) +--- a/drivers/pinctrl/bcm/Makefile ++++ b/drivers/pinctrl/bcm/Makefile +@@ -3,6 +3,7 @@ + + obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o + obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o ++obj-$(CONFIG_PINCTRL_BCM4908) += pinctrl-bcm4908.o + obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o + obj-$(CONFIG_PINCTRL_CYGNUS_MUX) += pinctrl-cygnus-mux.o + obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o +--- /dev/null ++++ b/drivers/pinctrl/bcm/pinctrl-bcm4908.c +@@ -0,0 +1,560 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* Copyright (C) 2021 Rafał Miłecki */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "../core.h" ++#include "../pinmux.h" ++ ++#define BCM4908_NUM_PINS 86 ++ ++#define BCM4908_TEST_PORT_BLOCK_EN_LSB 0x00 ++#define BCM4908_TEST_PORT_BLOCK_DATA_MSB 0x04 ++#define BCM4908_TEST_PORT_BLOCK_DATA_LSB 0x08 ++#define BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT 12 ++#define BCM4908_TEST_PORT_COMMAND 0x0c ++#define BCM4908_TEST_PORT_CMD_LOAD_MUX_REG 0x00000021 ++ ++struct bcm4908_pinctrl { ++ struct device *dev; ++ void __iomem *base; ++ struct mutex mutex; ++ struct pinctrl_dev *pctldev; ++ struct pinctrl_desc pctldesc; ++}; ++ ++/* ++ * Groups ++ */ ++ ++struct bcm4908_pinctrl_pin_setup { ++ unsigned int number; ++ unsigned int function; ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_0_pins_a[] = { ++ { 0, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_1_pins_a[] = { ++ { 1, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_2_pins_a[] = { ++ { 2, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_3_pins_a[] = { ++ { 3, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_4_pins_a[] = { ++ { 4, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_5_pins_a[] = { ++ { 5, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_6_pins_a[] = { ++ { 6, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_7_pins_a[] = { ++ { 7, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_8_pins_a[] = { ++ { 8, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_9_pins_a[] = { ++ { 9, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_10_pins_a[] = { ++ { 10, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_11_pins_a[] = { ++ { 11, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_12_pins_a[] = { ++ { 12, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_13_pins_a[] = { ++ { 13, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_14_pins_a[] = { ++ { 14, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_15_pins_a[] = { ++ { 15, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_16_pins_a[] = { ++ { 16, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_17_pins_a[] = { ++ { 17, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_18_pins_a[] = { ++ { 18, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_19_pins_a[] = { ++ { 19, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_20_pins_a[] = { ++ { 20, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_21_pins_a[] = { ++ { 21, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_22_pins_a[] = { ++ { 22, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_23_pins_a[] = { ++ { 23, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_24_pins_a[] = { ++ { 24, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_25_pins_a[] = { ++ { 25, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_26_pins_a[] = { ++ { 26, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_27_pins_a[] = { ++ { 27, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_28_pins_a[] = { ++ { 28, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_29_pins_a[] = { ++ { 29, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_30_pins_a[] = { ++ { 30, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_31_pins_a[] = { ++ { 31, 3 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_10_pins_b[] = { ++ { 8, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_11_pins_b[] = { ++ { 9, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_12_pins_b[] = { ++ { 0, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_13_pins_b[] = { ++ { 1, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup led_31_pins_b[] = { ++ { 30, 2 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup hs_uart_pins[] = { ++ { 10, 0 }, /* CTS */ ++ { 11, 0 }, /* RTS */ ++ { 12, 0 }, /* RXD */ ++ { 13, 0 }, /* TXD */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup i2c_pins_a[] = { ++ { 18, 0 }, /* SDA */ ++ { 19, 0 }, /* SCL */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup i2c_pins_b[] = { ++ { 22, 0 }, /* SDA */ ++ { 23, 0 }, /* SCL */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup i2s_pins[] = { ++ { 27, 0 }, /* MCLK */ ++ { 28, 0 }, /* LRCK */ ++ { 29, 0 }, /* SDATA */ ++ { 30, 0 }, /* SCLK */ ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup nand_ctrl_pins[] = { ++ { 32, 0 }, ++ { 33, 0 }, ++ { 34, 0 }, ++ { 43, 0 }, ++ { 44, 0 }, ++ { 45, 0 }, ++ { 56, 1 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup nand_data_pins[] = { ++ { 35, 0 }, ++ { 36, 0 }, ++ { 37, 0 }, ++ { 38, 0 }, ++ { 39, 0 }, ++ { 40, 0 }, ++ { 41, 0 }, ++ { 42, 0 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup emmc_ctrl_pins[] = { ++ { 46, 0 }, ++ { 47, 0 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup usb0_pwr_pins[] = { ++ { 63, 0 }, ++ { 64, 0 }, ++}; ++ ++static const struct bcm4908_pinctrl_pin_setup usb1_pwr_pins[] = { ++ { 66, 0 }, ++ { 67, 0 }, ++}; ++ ++struct bcm4908_pinctrl_grp { ++ const char *name; ++ const struct bcm4908_pinctrl_pin_setup *pins; ++ const unsigned int num_pins; ++}; ++ ++static const struct bcm4908_pinctrl_grp bcm4908_pinctrl_grps[] = { ++ { "led_0_grp_a", led_0_pins_a, ARRAY_SIZE(led_0_pins_a) }, ++ { "led_1_grp_a", led_1_pins_a, ARRAY_SIZE(led_1_pins_a) }, ++ { "led_2_grp_a", led_2_pins_a, ARRAY_SIZE(led_2_pins_a) }, ++ { "led_3_grp_a", led_3_pins_a, ARRAY_SIZE(led_3_pins_a) }, ++ { "led_4_grp_a", led_4_pins_a, ARRAY_SIZE(led_4_pins_a) }, ++ { "led_5_grp_a", led_5_pins_a, ARRAY_SIZE(led_5_pins_a) }, ++ { "led_6_grp_a", led_6_pins_a, ARRAY_SIZE(led_6_pins_a) }, ++ { "led_7_grp_a", led_7_pins_a, ARRAY_SIZE(led_7_pins_a) }, ++ { "led_8_grp_a", led_8_pins_a, ARRAY_SIZE(led_8_pins_a) }, ++ { "led_9_grp_a", led_9_pins_a, ARRAY_SIZE(led_9_pins_a) }, ++ { "led_10_grp_a", led_10_pins_a, ARRAY_SIZE(led_10_pins_a) }, ++ { "led_11_grp_a", led_11_pins_a, ARRAY_SIZE(led_11_pins_a) }, ++ { "led_12_grp_a", led_12_pins_a, ARRAY_SIZE(led_12_pins_a) }, ++ { "led_13_grp_a", led_13_pins_a, ARRAY_SIZE(led_13_pins_a) }, ++ { "led_14_grp_a", led_14_pins_a, ARRAY_SIZE(led_14_pins_a) }, ++ { "led_15_grp_a", led_15_pins_a, ARRAY_SIZE(led_15_pins_a) }, ++ { "led_16_grp_a", led_16_pins_a, ARRAY_SIZE(led_16_pins_a) }, ++ { "led_17_grp_a", led_17_pins_a, ARRAY_SIZE(led_17_pins_a) }, ++ { "led_18_grp_a", led_18_pins_a, ARRAY_SIZE(led_18_pins_a) }, ++ { "led_19_grp_a", led_19_pins_a, ARRAY_SIZE(led_19_pins_a) }, ++ { "led_20_grp_a", led_20_pins_a, ARRAY_SIZE(led_20_pins_a) }, ++ { "led_21_grp_a", led_21_pins_a, ARRAY_SIZE(led_21_pins_a) }, ++ { "led_22_grp_a", led_22_pins_a, ARRAY_SIZE(led_22_pins_a) }, ++ { "led_23_grp_a", led_23_pins_a, ARRAY_SIZE(led_23_pins_a) }, ++ { "led_24_grp_a", led_24_pins_a, ARRAY_SIZE(led_24_pins_a) }, ++ { "led_25_grp_a", led_25_pins_a, ARRAY_SIZE(led_25_pins_a) }, ++ { "led_26_grp_a", led_26_pins_a, ARRAY_SIZE(led_26_pins_a) }, ++ { "led_27_grp_a", led_27_pins_a, ARRAY_SIZE(led_27_pins_a) }, ++ { "led_28_grp_a", led_28_pins_a, ARRAY_SIZE(led_28_pins_a) }, ++ { "led_29_grp_a", led_29_pins_a, ARRAY_SIZE(led_29_pins_a) }, ++ { "led_30_grp_a", led_30_pins_a, ARRAY_SIZE(led_30_pins_a) }, ++ { "led_31_grp_a", led_31_pins_a, ARRAY_SIZE(led_31_pins_a) }, ++ { "led_10_grp_b", led_10_pins_b, ARRAY_SIZE(led_10_pins_b) }, ++ { "led_11_grp_b", led_11_pins_b, ARRAY_SIZE(led_11_pins_b) }, ++ { "led_12_grp_b", led_12_pins_b, ARRAY_SIZE(led_12_pins_b) }, ++ { "led_13_grp_b", led_13_pins_b, ARRAY_SIZE(led_13_pins_b) }, ++ { "led_31_grp_b", led_31_pins_b, ARRAY_SIZE(led_31_pins_b) }, ++ { "hs_uart_grp", hs_uart_pins, ARRAY_SIZE(hs_uart_pins) }, ++ { "i2c_grp_a", i2c_pins_a, ARRAY_SIZE(i2c_pins_a) }, ++ { "i2c_grp_b", i2c_pins_b, ARRAY_SIZE(i2c_pins_b) }, ++ { "i2s_grp", i2s_pins, ARRAY_SIZE(i2s_pins) }, ++ { "nand_ctrl_grp", nand_ctrl_pins, ARRAY_SIZE(nand_ctrl_pins) }, ++ { "nand_data_grp", nand_data_pins, ARRAY_SIZE(nand_data_pins) }, ++ { "emmc_ctrl_grp", emmc_ctrl_pins, ARRAY_SIZE(emmc_ctrl_pins) }, ++ { "usb0_pwr_grp", usb0_pwr_pins, ARRAY_SIZE(usb0_pwr_pins) }, ++ { "usb1_pwr_grp", usb1_pwr_pins, ARRAY_SIZE(usb1_pwr_pins) }, ++}; ++ ++/* ++ * Functions ++ */ ++ ++struct bcm4908_pinctrl_function { ++ const char *name; ++ const char * const *groups; ++ const unsigned int num_groups; ++}; ++ ++static const char * const led_0_groups[] = { "led_0_grp_a" }; ++static const char * const led_1_groups[] = { "led_1_grp_a" }; ++static const char * const led_2_groups[] = { "led_2_grp_a" }; ++static const char * const led_3_groups[] = { "led_3_grp_a" }; ++static const char * const led_4_groups[] = { "led_4_grp_a" }; ++static const char * const led_5_groups[] = { "led_5_grp_a" }; ++static const char * const led_6_groups[] = { "led_6_grp_a" }; ++static const char * const led_7_groups[] = { "led_7_grp_a" }; ++static const char * const led_8_groups[] = { "led_8_grp_a" }; ++static const char * const led_9_groups[] = { "led_9_grp_a" }; ++static const char * const led_10_groups[] = { "led_10_grp_a", "led_10_grp_b" }; ++static const char * const led_11_groups[] = { "led_11_grp_a", "led_11_grp_b" }; ++static const char * const led_12_groups[] = { "led_12_grp_a", "led_12_grp_b" }; ++static const char * const led_13_groups[] = { "led_13_grp_a", "led_13_grp_b" }; ++static const char * const led_14_groups[] = { "led_14_grp_a" }; ++static const char * const led_15_groups[] = { "led_15_grp_a" }; ++static const char * const led_16_groups[] = { "led_16_grp_a" }; ++static const char * const led_17_groups[] = { "led_17_grp_a" }; ++static const char * const led_18_groups[] = { "led_18_grp_a" }; ++static const char * const led_19_groups[] = { "led_19_grp_a" }; ++static const char * const led_20_groups[] = { "led_20_grp_a" }; ++static const char * const led_21_groups[] = { "led_21_grp_a" }; ++static const char * const led_22_groups[] = { "led_22_grp_a" }; ++static const char * const led_23_groups[] = { "led_23_grp_a" }; ++static const char * const led_24_groups[] = { "led_24_grp_a" }; ++static const char * const led_25_groups[] = { "led_25_grp_a" }; ++static const char * const led_26_groups[] = { "led_26_grp_a" }; ++static const char * const led_27_groups[] = { "led_27_grp_a" }; ++static const char * const led_28_groups[] = { "led_28_grp_a" }; ++static const char * const led_29_groups[] = { "led_29_grp_a" }; ++static const char * const led_30_groups[] = { "led_30_grp_a" }; ++static const char * const led_31_groups[] = { "led_31_grp_a", "led_31_grp_b" }; ++static const char * const hs_uart_groups[] = { "hs_uart_grp" }; ++static const char * const i2c_groups[] = { "i2c_grp_a", "i2c_grp_b" }; ++static const char * const i2s_groups[] = { "i2s_grp" }; ++static const char * const nand_ctrl_groups[] = { "nand_ctrl_grp" }; ++static const char * const nand_data_groups[] = { "nand_data_grp" }; ++static const char * const emmc_ctrl_groups[] = { "emmc_ctrl_grp" }; ++static const char * const usb0_pwr_groups[] = { "usb0_pwr_grp" }; ++static const char * const usb1_pwr_groups[] = { "usb1_pwr_grp" }; ++ ++static const struct bcm4908_pinctrl_function bcm4908_pinctrl_functions[] = { ++ { "led_0", led_0_groups, ARRAY_SIZE(led_0_groups) }, ++ { "led_1", led_1_groups, ARRAY_SIZE(led_1_groups) }, ++ { "led_2", led_2_groups, ARRAY_SIZE(led_2_groups) }, ++ { "led_3", led_3_groups, ARRAY_SIZE(led_3_groups) }, ++ { "led_4", led_4_groups, ARRAY_SIZE(led_4_groups) }, ++ { "led_5", led_5_groups, ARRAY_SIZE(led_5_groups) }, ++ { "led_6", led_6_groups, ARRAY_SIZE(led_6_groups) }, ++ { "led_7", led_7_groups, ARRAY_SIZE(led_7_groups) }, ++ { "led_8", led_8_groups, ARRAY_SIZE(led_8_groups) }, ++ { "led_9", led_9_groups, ARRAY_SIZE(led_9_groups) }, ++ { "led_10", led_10_groups, ARRAY_SIZE(led_10_groups) }, ++ { "led_11", led_11_groups, ARRAY_SIZE(led_11_groups) }, ++ { "led_12", led_12_groups, ARRAY_SIZE(led_12_groups) }, ++ { "led_13", led_13_groups, ARRAY_SIZE(led_13_groups) }, ++ { "led_14", led_14_groups, ARRAY_SIZE(led_14_groups) }, ++ { "led_15", led_15_groups, ARRAY_SIZE(led_15_groups) }, ++ { "led_16", led_16_groups, ARRAY_SIZE(led_16_groups) }, ++ { "led_17", led_17_groups, ARRAY_SIZE(led_17_groups) }, ++ { "led_18", led_18_groups, ARRAY_SIZE(led_18_groups) }, ++ { "led_19", led_19_groups, ARRAY_SIZE(led_19_groups) }, ++ { "led_20", led_20_groups, ARRAY_SIZE(led_20_groups) }, ++ { "led_21", led_21_groups, ARRAY_SIZE(led_21_groups) }, ++ { "led_22", led_22_groups, ARRAY_SIZE(led_22_groups) }, ++ { "led_23", led_23_groups, ARRAY_SIZE(led_23_groups) }, ++ { "led_24", led_24_groups, ARRAY_SIZE(led_24_groups) }, ++ { "led_25", led_25_groups, ARRAY_SIZE(led_25_groups) }, ++ { "led_26", led_26_groups, ARRAY_SIZE(led_26_groups) }, ++ { "led_27", led_27_groups, ARRAY_SIZE(led_27_groups) }, ++ { "led_28", led_28_groups, ARRAY_SIZE(led_28_groups) }, ++ { "led_29", led_29_groups, ARRAY_SIZE(led_29_groups) }, ++ { "led_30", led_30_groups, ARRAY_SIZE(led_30_groups) }, ++ { "led_31", led_31_groups, ARRAY_SIZE(led_31_groups) }, ++ { "hs_uart", hs_uart_groups, ARRAY_SIZE(hs_uart_groups) }, ++ { "i2c", i2c_groups, ARRAY_SIZE(i2c_groups) }, ++ { "i2s", i2s_groups, ARRAY_SIZE(i2s_groups) }, ++ { "nand_ctrl", nand_ctrl_groups, ARRAY_SIZE(nand_ctrl_groups) }, ++ { "nand_data", nand_data_groups, ARRAY_SIZE(nand_data_groups) }, ++ { "emmc_ctrl", emmc_ctrl_groups, ARRAY_SIZE(emmc_ctrl_groups) }, ++ { "usb0_pwr", usb0_pwr_groups, ARRAY_SIZE(usb0_pwr_groups) }, ++ { "usb1_pwr", usb1_pwr_groups, ARRAY_SIZE(usb1_pwr_groups) }, ++}; ++ ++/* ++ * Groups code ++ */ ++ ++static const struct pinctrl_ops bcm4908_pinctrl_ops = { ++ .get_groups_count = pinctrl_generic_get_group_count, ++ .get_group_name = pinctrl_generic_get_group_name, ++ .get_group_pins = pinctrl_generic_get_group_pins, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_group, ++ .dt_free_map = pinconf_generic_dt_free_map, ++}; ++ ++/* ++ * Functions code ++ */ ++ ++static int bcm4908_pinctrl_set_mux(struct pinctrl_dev *pctrl_dev, ++ unsigned int func_selector, ++ unsigned int group_selector) ++{ ++ struct bcm4908_pinctrl *bcm4908_pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); ++ const struct bcm4908_pinctrl_grp *group; ++ struct group_desc *group_desc; ++ int i; ++ ++ group_desc = pinctrl_generic_get_group(pctrl_dev, group_selector); ++ if (!group_desc) ++ return -EINVAL; ++ group = group_desc->data; ++ ++ mutex_lock(&bcm4908_pinctrl->mutex); ++ for (i = 0; i < group->num_pins; i++) { ++ u32 lsb = 0; ++ ++ lsb |= group->pins[i].number; ++ lsb |= group->pins[i].function << BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT; ++ ++ writel(0x0, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_MSB); ++ writel(lsb, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_LSB); ++ writel(BCM4908_TEST_PORT_CMD_LOAD_MUX_REG, ++ bcm4908_pinctrl->base + BCM4908_TEST_PORT_COMMAND); ++ } ++ mutex_unlock(&bcm4908_pinctrl->mutex); ++ ++ return 0; ++} ++ ++static const struct pinmux_ops bcm4908_pinctrl_pmxops = { ++ .get_functions_count = pinmux_generic_get_function_count, ++ .get_function_name = pinmux_generic_get_function_name, ++ .get_function_groups = pinmux_generic_get_function_groups, ++ .set_mux = bcm4908_pinctrl_set_mux, ++}; ++ ++/* ++ * Controller code ++ */ ++ ++static struct pinctrl_desc bcm4908_pinctrl_desc = { ++ .name = "bcm4908-pinctrl", ++ .pctlops = &bcm4908_pinctrl_ops, ++ .pmxops = &bcm4908_pinctrl_pmxops, ++}; ++ ++static const struct of_device_id bcm4908_pinctrl_of_match_table[] = { ++ { .compatible = "brcm,bcm4908-pinctrl", }, ++ { } ++}; ++ ++static int bcm4908_pinctrl_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct bcm4908_pinctrl *bcm4908_pinctrl; ++ struct pinctrl_desc *pctldesc; ++ struct pinctrl_pin_desc *pins; ++ int i; ++ ++ bcm4908_pinctrl = devm_kzalloc(dev, sizeof(*bcm4908_pinctrl), GFP_KERNEL); ++ if (!bcm4908_pinctrl) ++ return -ENOMEM; ++ pctldesc = &bcm4908_pinctrl->pctldesc; ++ platform_set_drvdata(pdev, bcm4908_pinctrl); ++ ++ /* Set basic properties */ ++ ++ bcm4908_pinctrl->dev = dev; ++ ++ bcm4908_pinctrl->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(bcm4908_pinctrl->base)) ++ return PTR_ERR(bcm4908_pinctrl->base); ++ ++ mutex_init(&bcm4908_pinctrl->mutex); ++ ++ memcpy(pctldesc, &bcm4908_pinctrl_desc, sizeof(*pctldesc)); ++ ++ /* Set pinctrl properties */ ++ ++ pins = devm_kcalloc(dev, BCM4908_NUM_PINS, sizeof(*pins), GFP_KERNEL); ++ if (!pins) ++ return -ENOMEM; ++ for (i = 0; i < BCM4908_NUM_PINS; i++) { ++ pins[i].number = i; ++ pins[i].name = devm_kasprintf(dev, GFP_KERNEL, "pin-%d", i); ++ if (!pins[i].name) ++ return -ENOMEM; ++ } ++ pctldesc->pins = pins; ++ pctldesc->npins = BCM4908_NUM_PINS; ++ ++ /* Register */ ++ ++ bcm4908_pinctrl->pctldev = devm_pinctrl_register(dev, pctldesc, bcm4908_pinctrl); ++ if (IS_ERR(bcm4908_pinctrl->pctldev)) ++ return dev_err_probe(dev, PTR_ERR(bcm4908_pinctrl->pctldev), ++ "Failed to register pinctrl\n"); ++ ++ /* Groups */ ++ ++ for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_grps); i++) { ++ const struct bcm4908_pinctrl_grp *group = &bcm4908_pinctrl_grps[i]; ++ int *pins; ++ int j; ++ ++ pins = devm_kcalloc(dev, group->num_pins, sizeof(*pins), GFP_KERNEL); ++ if (!pins) ++ return -ENOMEM; ++ for (j = 0; j < group->num_pins; j++) ++ pins[j] = group->pins[j].number; ++ ++ pinctrl_generic_add_group(bcm4908_pinctrl->pctldev, group->name, ++ pins, group->num_pins, (void *)group); ++ } ++ ++ /* Functions */ ++ ++ for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_functions); i++) { ++ const struct bcm4908_pinctrl_function *function = &bcm4908_pinctrl_functions[i]; ++ ++ pinmux_generic_add_function(bcm4908_pinctrl->pctldev, ++ function->name, ++ function->groups, ++ function->num_groups, NULL); ++ } ++ ++ return 0; ++} ++ ++static struct platform_driver bcm4908_pinctrl_driver = { ++ .probe = bcm4908_pinctrl_probe, ++ .driver = { ++ .name = "bcm4908-pinctrl", ++ .of_match_table = bcm4908_pinctrl_of_match_table, ++ }, ++}; ++ ++module_platform_driver(bcm4908_pinctrl_driver); ++ ++MODULE_AUTHOR("Rafał Miłecki"); ++MODULE_LICENSE("GPL v2"); ++MODULE_DEVICE_TABLE(of, bcm4908_pinctrl_of_match_table); From a11e9fd1d5b511eeaec2c1e024d2adb33d9f16c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 31 Jan 2022 00:34:01 +0100 Subject: [PATCH 045/144] bcm4908: fixup pinctrl patches for kernel 5.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: b0145891676f ("bcm4908: backport BCM4908 pinctrl driver") Signed-off-by: Rafał Miłecki --- ...ings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch | 4 ++-- ...02-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch b/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch index 0d2573b902..ab18c17fd1 100644 --- a/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch +++ b/target/linux/bcm4908/patches-5.4/087-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch @@ -95,7 +95,7 @@ Signed-off-by: Linus Walleij + }; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -3688,6 +3688,13 @@ F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml +@@ -3217,6 +3217,13 @@ F: Documentation/devicetree/bindings/net F: drivers/net/ethernet/broadcom/bcm4908_enet.* F: drivers/net/ethernet/broadcom/unimac.h @@ -107,5 +107,5 @@ Signed-off-by: Linus Walleij +F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml + BROADCOM BCM5301X ARM ARCHITECTURE - M: Florian Fainelli M: Hauke Mehrtens + M: Rafał Miłecki diff --git a/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch b/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch index bb2ae459e9..670cbee948 100644 --- a/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch +++ b/target/linux/bcm4908/patches-5.4/087-v5.18-0002-pinctrl-bcm-add-driver-for-BCM4908-pinmux.patch @@ -23,7 +23,7 @@ Signed-off-by: Linus Walleij --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -3442,6 +3442,7 @@ M: bcm-kernel-feedback-list@broadcom.com +@@ -3223,6 +3223,7 @@ M: bcm-kernel-feedback-list@broadcom.com L: linux-gpio@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml @@ -66,7 +66,7 @@ Signed-off-by: Linus Walleij obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o --- /dev/null +++ b/drivers/pinctrl/bcm/pinctrl-bcm4908.c -@@ -0,0 +1,560 @@ +@@ -0,0 +1,561 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2021 Rafał Miłecki */ + @@ -579,9 +579,10 @@ Signed-off-by: Linus Walleij + /* Register */ + + bcm4908_pinctrl->pctldev = devm_pinctrl_register(dev, pctldesc, bcm4908_pinctrl); -+ if (IS_ERR(bcm4908_pinctrl->pctldev)) -+ return dev_err_probe(dev, PTR_ERR(bcm4908_pinctrl->pctldev), -+ "Failed to register pinctrl\n"); ++ if (IS_ERR(bcm4908_pinctrl->pctldev)) { ++ dev_err(dev, "Failed to register pinctrl\n"); ++ return PTR_ERR(bcm4908_pinctrl->pctldev); ++ } + + /* Groups */ + From 840f07e532e081befc2465fd16a0388dd95e55fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 31 Jan 2022 00:57:17 +0100 Subject: [PATCH 046/144] bcm4908: backport bcm_sf2 patch for better LED registers support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...dsa-bcm_sf2-refactor-LED-regs-access.patch | 209 ++++++++++++++++++ ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- ...dsa-bcm_sf2-refactor-LED-regs-access.patch | 209 ++++++++++++++++++ ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- 6 files changed, 422 insertions(+), 4 deletions(-) create mode 100644 target/linux/bcm4908/patches-5.10/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch create mode 100644 target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch diff --git a/target/linux/bcm4908/patches-5.10/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.10/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch new file mode 100644 index 0000000000..dc5aa578cd --- /dev/null +++ b/target/linux/bcm4908/patches-5.10/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch @@ -0,0 +1,209 @@ +From af30f8eaa8fe4ff1987280f716309711997bd979 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 29 Dec 2021 18:16:42 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: refactor LED regs access +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Define more regs. Some switches (e.g. BCM4908) have up to 6 regs. +2. Add helper for handling non-lineral port <-> reg mappings. +3. Add support for 12 B LED reg blocks on BCM4908 (different layout) + +Complete support for LEDs setup will be implemented once Linux receives +a proper design & implementation for "hardware" LEDs. + +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20211229171642.22942-1-zajec5@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/bcm_sf2.c | 54 ++++++++++++++++++++++++---- + drivers/net/dsa/bcm_sf2.h | 10 ++++++ + drivers/net/dsa/bcm_sf2_regs.h | 65 +++++++++++++++++++++++++++++++--- + 3 files changed, 119 insertions(+), 10 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -32,6 +32,38 @@ + #include "b53/b53_priv.h" + #include "b53/b53_regs.h" + ++static u16 bcm_sf2_reg_led_base(struct bcm_sf2_priv *priv, int port) ++{ ++ switch (port) { ++ case 0: ++ return REG_LED_0_CNTRL; ++ case 1: ++ return REG_LED_1_CNTRL; ++ case 2: ++ return REG_LED_2_CNTRL; ++ } ++ ++ switch (priv->type) { ++ case BCM4908_DEVICE_ID: ++ switch (port) { ++ case 3: ++ return REG_LED_3_CNTRL; ++ case 7: ++ return REG_LED_4_CNTRL; ++ default: ++ break; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ WARN_ONCE(1, "Unsupported port %d\n", port); ++ ++ /* RO fallback reg */ ++ return REG_SWITCH_STATUS; ++} ++ + /* Return the number of active ports, not counting the IMP (CPU) port */ + static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds) + { +@@ -187,9 +219,14 @@ static void bcm_sf2_gphy_enable_set(stru + + /* Use PHY-driven LED signaling */ + if (!enable) { +- reg = reg_readl(priv, REG_LED_CNTRL(0)); +- reg |= SPDLNK_SRC_SEL; +- reg_writel(priv, reg, REG_LED_CNTRL(0)); ++ u16 led_ctrl = bcm_sf2_reg_led_base(priv, 0); ++ ++ if (priv->type == BCM7278_DEVICE_ID || ++ priv->type == BCM7445_DEVICE_ID) { ++ reg = reg_led_readl(priv, led_ctrl, 0); ++ reg |= LED_CNTRL_SPDLNK_SRC_SEL; ++ reg_led_writel(priv, reg, led_ctrl, 0); ++ } + } + } + +@@ -1232,9 +1269,14 @@ static const u16 bcm_sf2_4908_reg_offset + [REG_SPHY_CNTRL] = 0x24, + [REG_CROSSBAR] = 0xc8, + [REG_RGMII_11_CNTRL] = 0x014c, +- [REG_LED_0_CNTRL] = 0x40, +- [REG_LED_1_CNTRL] = 0x4c, +- [REG_LED_2_CNTRL] = 0x58, ++ [REG_LED_0_CNTRL] = 0x40, ++ [REG_LED_1_CNTRL] = 0x4c, ++ [REG_LED_2_CNTRL] = 0x58, ++ [REG_LED_3_CNTRL] = 0x64, ++ [REG_LED_4_CNTRL] = 0x88, ++ [REG_LED_5_CNTRL] = 0xa0, ++ [REG_LED_AGGREGATE_CTRL] = 0xb8, ++ + }; + + static const struct bcm_sf2_of_data bcm_sf2_4908_data = { +--- a/drivers/net/dsa/bcm_sf2.h ++++ b/drivers/net/dsa/bcm_sf2.h +@@ -210,6 +210,16 @@ SF2_IO_MACRO(acb); + SWITCH_INTR_L2(0); + SWITCH_INTR_L2(1); + ++static inline u32 reg_led_readl(struct bcm_sf2_priv *priv, u16 off, u16 reg) ++{ ++ return readl_relaxed(priv->reg + priv->reg_offsets[off] + reg); ++} ++ ++static inline void reg_led_writel(struct bcm_sf2_priv *priv, u32 val, u16 off, u16 reg) ++{ ++ writel_relaxed(val, priv->reg + priv->reg_offsets[off] + reg); ++} ++ + /* RXNFC */ + int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port, + struct ethtool_rxnfc *nfc, u32 *rule_locs); +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -25,6 +25,10 @@ enum bcm_sf2_reg_offs { + REG_LED_0_CNTRL, + REG_LED_1_CNTRL, + REG_LED_2_CNTRL, ++ REG_LED_3_CNTRL, ++ REG_LED_4_CNTRL, ++ REG_LED_5_CNTRL, ++ REG_LED_AGGREGATE_CTRL, + REG_SWITCH_REG_MAX, + }; + +@@ -56,6 +60,63 @@ enum bcm_sf2_reg_offs { + #define CROSSBAR_BCM4908_EXT_GPHY4 1 + #define CROSSBAR_BCM4908_EXT_RGMII 2 + ++/* Relative to REG_LED_*_CNTRL (BCM7278, BCM7445) */ ++#define LED_CNTRL_NO_LINK_ENCODE_SHIFT 0 ++#define LED_CNTRL_M10_ENCODE_SHIFT 2 ++#define LED_CNTRL_M100_ENCODE_SHIFT 4 ++#define LED_CNTRL_M1000_ENCODE_SHIFT 6 ++#define LED_CNTRL_SEL_NO_LINK_ENCODE_SHIFT 8 ++#define LED_CNTRL_SEL_10M_ENCODE_SHIFT 10 ++#define LED_CNTRL_SEL_100M_ENCODE_SHIFT 12 ++#define LED_CNTRL_SEL_1000M_ENCODE_SHIFT 14 ++#define LED_CNTRL_RX_DV_EN (1 << 16) ++#define LED_CNTRL_TX_EN_EN (1 << 17) ++#define LED_CNTRL_SPDLNK_LED0_ACT_SEL_SHIFT 18 ++#define LED_CNTRL_SPDLNK_LED1_ACT_SEL_SHIFT 20 ++#define LED_CNTRL_ACT_LED_ACT_SEL_SHIFT 22 ++#define LED_CNTRL_SPDLNK_SRC_SEL (1 << 24) ++#define LED_CNTRL_SPDLNK_LED0_ACT_POL_SEL (1 << 25) ++#define LED_CNTRL_SPDLNK_LED1_ACT_POL_SEL (1 << 26) ++#define LED_CNTRL_ACT_LED_POL_SEL (1 << 27) ++#define LED_CNTRL_MASK 0x3 ++ ++/* Register relative to REG_LED_*_CNTRL (BCM4908) */ ++#define REG_LED_CTRL 0x0 ++#define LED_CTRL_RX_ACT_EN 0x00000001 ++#define LED_CTRL_TX_ACT_EN 0x00000002 ++#define LED_CTRL_SPDLNK_LED0_ACT_SEL 0x00000004 ++#define LED_CTRL_SPDLNK_LED1_ACT_SEL 0x00000008 ++#define LED_CTRL_SPDLNK_LED2_ACT_SEL 0x00000010 ++#define LED_CTRL_ACT_LED_ACT_SEL 0x00000020 ++#define LED_CTRL_SPDLNK_LED0_ACT_POL_SEL 0x00000040 ++#define LED_CTRL_SPDLNK_LED1_ACT_POL_SEL 0x00000080 ++#define LED_CTRL_SPDLNK_LED2_ACT_POL_SEL 0x00000100 ++#define LED_CTRL_ACT_LED_POL_SEL 0x00000200 ++#define LED_CTRL_LED_SPD_OVRD 0x00001c00 ++#define LED_CTRL_LNK_STATUS_OVRD 0x00002000 ++#define LED_CTRL_SPD_OVRD_EN 0x00004000 ++#define LED_CTRL_LNK_OVRD_EN 0x00008000 ++ ++/* Register relative to REG_LED_*_CNTRL (BCM4908) */ ++#define REG_LED_LINK_SPEED_ENC_SEL 0x4 ++#define LED_LINK_SPEED_ENC_SEL_NO_LINK_SHIFT 0 ++#define LED_LINK_SPEED_ENC_SEL_10M_SHIFT 3 ++#define LED_LINK_SPEED_ENC_SEL_100M_SHIFT 6 ++#define LED_LINK_SPEED_ENC_SEL_1000M_SHIFT 9 ++#define LED_LINK_SPEED_ENC_SEL_2500M_SHIFT 12 ++#define LED_LINK_SPEED_ENC_SEL_10G_SHIFT 15 ++#define LED_LINK_SPEED_ENC_SEL_MASK 0x7 ++ ++/* Register relative to REG_LED_*_CNTRL (BCM4908) */ ++#define REG_LED_LINK_SPEED_ENC 0x8 ++#define LED_LINK_SPEED_ENC_NO_LINK_SHIFT 0 ++#define LED_LINK_SPEED_ENC_M10_SHIFT 3 ++#define LED_LINK_SPEED_ENC_M100_SHIFT 6 ++#define LED_LINK_SPEED_ENC_M1000_SHIFT 9 ++#define LED_LINK_SPEED_ENC_M2500_SHIFT 12 ++#define LED_LINK_SPEED_ENC_M10G_SHIFT 15 ++#define LED_LINK_SPEED_ENC_MASK 0x7 ++ + /* Relative to REG_RGMII_CNTRL */ + #define RGMII_MODE_EN (1 << 0) + #define ID_MODE_DIS (1 << 1) +@@ -73,10 +134,6 @@ enum bcm_sf2_reg_offs { + #define LPI_COUNT_SHIFT 9 + #define LPI_COUNT_MASK 0x3F + +-#define REG_LED_CNTRL(x) (REG_LED_0_CNTRL + (x)) +- +-#define SPDLNK_SRC_SEL (1 << 24) +- + /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */ + #define INTRL2_CPU_STATUS 0x00 + #define INTRL2_CPU_SET 0x04 diff --git a/target/linux/bcm4908/patches-5.10/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.10/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index d3714dfa7a..5150b074a9 100644 --- a/target/linux/bcm4908/patches-5.10/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.10/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1487,10 +1487,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1529,10 +1529,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.10/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.10/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index b027fe3672..0358a31f43 100644 --- a/target/linux/bcm4908/patches-5.10/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.10/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1501,6 +1501,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1543,6 +1543,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch new file mode 100644 index 0000000000..88f2c3c0cd --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch @@ -0,0 +1,209 @@ +From af30f8eaa8fe4ff1987280f716309711997bd979 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 29 Dec 2021 18:16:42 +0100 +Subject: [PATCH] net: dsa: bcm_sf2: refactor LED regs access +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Define more regs. Some switches (e.g. BCM4908) have up to 6 regs. +2. Add helper for handling non-lineral port <-> reg mappings. +3. Add support for 12 B LED reg blocks on BCM4908 (different layout) + +Complete support for LEDs setup will be implemented once Linux receives +a proper design & implementation for "hardware" LEDs. + +Signed-off-by: Rafał Miłecki +Acked-by: Florian Fainelli +Link: https://lore.kernel.org/r/20211229171642.22942-1-zajec5@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/bcm_sf2.c | 54 ++++++++++++++++++++++++---- + drivers/net/dsa/bcm_sf2.h | 10 ++++++ + drivers/net/dsa/bcm_sf2_regs.h | 65 +++++++++++++++++++++++++++++++--- + 3 files changed, 119 insertions(+), 10 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -31,6 +31,38 @@ + #include "b53/b53_priv.h" + #include "b53/b53_regs.h" + ++static u16 bcm_sf2_reg_led_base(struct bcm_sf2_priv *priv, int port) ++{ ++ switch (port) { ++ case 0: ++ return REG_LED_0_CNTRL; ++ case 1: ++ return REG_LED_1_CNTRL; ++ case 2: ++ return REG_LED_2_CNTRL; ++ } ++ ++ switch (priv->type) { ++ case BCM4908_DEVICE_ID: ++ switch (port) { ++ case 3: ++ return REG_LED_3_CNTRL; ++ case 7: ++ return REG_LED_4_CNTRL; ++ default: ++ break; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ WARN_ONCE(1, "Unsupported port %d\n", port); ++ ++ /* RO fallback reg */ ++ return REG_SWITCH_STATUS; ++} ++ + static u16 bcm_sf2_reg_rgmii_cntrl(struct bcm_sf2_priv *priv, int port) + { + switch (priv->type) { +@@ -141,9 +173,14 @@ static void bcm_sf2_gphy_enable_set(stru + + /* Use PHY-driven LED signaling */ + if (!enable) { +- reg = reg_readl(priv, REG_LED_CNTRL(0)); +- reg |= SPDLNK_SRC_SEL; +- reg_writel(priv, reg, REG_LED_CNTRL(0)); ++ u16 led_ctrl = bcm_sf2_reg_led_base(priv, 0); ++ ++ if (priv->type == BCM7278_DEVICE_ID || ++ priv->type == BCM7445_DEVICE_ID) { ++ reg = reg_led_readl(priv, led_ctrl, 0); ++ reg |= LED_CNTRL_SPDLNK_SRC_SEL; ++ reg_led_writel(priv, reg, led_ctrl, 0); ++ } + } + } + +@@ -1085,9 +1122,14 @@ static const u16 bcm_sf2_4908_reg_offset + [REG_SPHY_CNTRL] = 0x24, + [REG_CROSSBAR] = 0xc8, + [REG_RGMII_11_CNTRL] = 0x014c, +- [REG_LED_0_CNTRL] = 0x40, +- [REG_LED_1_CNTRL] = 0x4c, +- [REG_LED_2_CNTRL] = 0x58, ++ [REG_LED_0_CNTRL] = 0x40, ++ [REG_LED_1_CNTRL] = 0x4c, ++ [REG_LED_2_CNTRL] = 0x58, ++ [REG_LED_3_CNTRL] = 0x64, ++ [REG_LED_4_CNTRL] = 0x88, ++ [REG_LED_5_CNTRL] = 0xa0, ++ [REG_LED_AGGREGATE_CTRL] = 0xb8, ++ + }; + + static const struct bcm_sf2_of_data bcm_sf2_4908_data = { +--- a/drivers/net/dsa/bcm_sf2.h ++++ b/drivers/net/dsa/bcm_sf2.h +@@ -203,6 +203,16 @@ SF2_IO_MACRO(acb); + SWITCH_INTR_L2(0); + SWITCH_INTR_L2(1); + ++static inline u32 reg_led_readl(struct bcm_sf2_priv *priv, u16 off, u16 reg) ++{ ++ return readl_relaxed(priv->reg + priv->reg_offsets[off] + reg); ++} ++ ++static inline void reg_led_writel(struct bcm_sf2_priv *priv, u32 val, u16 off, u16 reg) ++{ ++ writel_relaxed(val, priv->reg + priv->reg_offsets[off] + reg); ++} ++ + /* RXNFC */ + int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port, + struct ethtool_rxnfc *nfc, u32 *rule_locs); +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -25,6 +25,10 @@ enum bcm_sf2_reg_offs { + REG_LED_0_CNTRL, + REG_LED_1_CNTRL, + REG_LED_2_CNTRL, ++ REG_LED_3_CNTRL, ++ REG_LED_4_CNTRL, ++ REG_LED_5_CNTRL, ++ REG_LED_AGGREGATE_CTRL, + REG_SWITCH_REG_MAX, + }; + +@@ -56,6 +60,63 @@ enum bcm_sf2_reg_offs { + #define CROSSBAR_BCM4908_EXT_GPHY4 1 + #define CROSSBAR_BCM4908_EXT_RGMII 2 + ++/* Relative to REG_LED_*_CNTRL (BCM7278, BCM7445) */ ++#define LED_CNTRL_NO_LINK_ENCODE_SHIFT 0 ++#define LED_CNTRL_M10_ENCODE_SHIFT 2 ++#define LED_CNTRL_M100_ENCODE_SHIFT 4 ++#define LED_CNTRL_M1000_ENCODE_SHIFT 6 ++#define LED_CNTRL_SEL_NO_LINK_ENCODE_SHIFT 8 ++#define LED_CNTRL_SEL_10M_ENCODE_SHIFT 10 ++#define LED_CNTRL_SEL_100M_ENCODE_SHIFT 12 ++#define LED_CNTRL_SEL_1000M_ENCODE_SHIFT 14 ++#define LED_CNTRL_RX_DV_EN (1 << 16) ++#define LED_CNTRL_TX_EN_EN (1 << 17) ++#define LED_CNTRL_SPDLNK_LED0_ACT_SEL_SHIFT 18 ++#define LED_CNTRL_SPDLNK_LED1_ACT_SEL_SHIFT 20 ++#define LED_CNTRL_ACT_LED_ACT_SEL_SHIFT 22 ++#define LED_CNTRL_SPDLNK_SRC_SEL (1 << 24) ++#define LED_CNTRL_SPDLNK_LED0_ACT_POL_SEL (1 << 25) ++#define LED_CNTRL_SPDLNK_LED1_ACT_POL_SEL (1 << 26) ++#define LED_CNTRL_ACT_LED_POL_SEL (1 << 27) ++#define LED_CNTRL_MASK 0x3 ++ ++/* Register relative to REG_LED_*_CNTRL (BCM4908) */ ++#define REG_LED_CTRL 0x0 ++#define LED_CTRL_RX_ACT_EN 0x00000001 ++#define LED_CTRL_TX_ACT_EN 0x00000002 ++#define LED_CTRL_SPDLNK_LED0_ACT_SEL 0x00000004 ++#define LED_CTRL_SPDLNK_LED1_ACT_SEL 0x00000008 ++#define LED_CTRL_SPDLNK_LED2_ACT_SEL 0x00000010 ++#define LED_CTRL_ACT_LED_ACT_SEL 0x00000020 ++#define LED_CTRL_SPDLNK_LED0_ACT_POL_SEL 0x00000040 ++#define LED_CTRL_SPDLNK_LED1_ACT_POL_SEL 0x00000080 ++#define LED_CTRL_SPDLNK_LED2_ACT_POL_SEL 0x00000100 ++#define LED_CTRL_ACT_LED_POL_SEL 0x00000200 ++#define LED_CTRL_LED_SPD_OVRD 0x00001c00 ++#define LED_CTRL_LNK_STATUS_OVRD 0x00002000 ++#define LED_CTRL_SPD_OVRD_EN 0x00004000 ++#define LED_CTRL_LNK_OVRD_EN 0x00008000 ++ ++/* Register relative to REG_LED_*_CNTRL (BCM4908) */ ++#define REG_LED_LINK_SPEED_ENC_SEL 0x4 ++#define LED_LINK_SPEED_ENC_SEL_NO_LINK_SHIFT 0 ++#define LED_LINK_SPEED_ENC_SEL_10M_SHIFT 3 ++#define LED_LINK_SPEED_ENC_SEL_100M_SHIFT 6 ++#define LED_LINK_SPEED_ENC_SEL_1000M_SHIFT 9 ++#define LED_LINK_SPEED_ENC_SEL_2500M_SHIFT 12 ++#define LED_LINK_SPEED_ENC_SEL_10G_SHIFT 15 ++#define LED_LINK_SPEED_ENC_SEL_MASK 0x7 ++ ++/* Register relative to REG_LED_*_CNTRL (BCM4908) */ ++#define REG_LED_LINK_SPEED_ENC 0x8 ++#define LED_LINK_SPEED_ENC_NO_LINK_SHIFT 0 ++#define LED_LINK_SPEED_ENC_M10_SHIFT 3 ++#define LED_LINK_SPEED_ENC_M100_SHIFT 6 ++#define LED_LINK_SPEED_ENC_M1000_SHIFT 9 ++#define LED_LINK_SPEED_ENC_M2500_SHIFT 12 ++#define LED_LINK_SPEED_ENC_M10G_SHIFT 15 ++#define LED_LINK_SPEED_ENC_MASK 0x7 ++ + /* Relative to REG_RGMII_CNTRL */ + #define RGMII_MODE_EN (1 << 0) + #define ID_MODE_DIS (1 << 1) +@@ -73,10 +134,6 @@ enum bcm_sf2_reg_offs { + #define LPI_COUNT_SHIFT 9 + #define LPI_COUNT_MASK 0x3F + +-#define REG_LED_CNTRL(x) (REG_LED_0_CNTRL + (x)) +- +-#define SPDLNK_SRC_SEL (1 << 24) +- + /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */ + #define INTRL2_CPU_STATUS 0x00 + #define INTRL2_CPU_SET 0x04 diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index c9e4c67376..d9d972c9cd 100644 --- a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1321,10 +1321,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1363,10 +1363,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index 5bc5bff2e9..c8fe1121ba 100644 --- a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1335,6 +1335,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1377,6 +1377,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); From 5e6867fd542b04c0b8c8e7b8360f1cac03a77b99 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 30 Jan 2022 22:46:44 +0000 Subject: [PATCH 047/144] mediatek: u7623-02: enable early console also in legacy image Append 'earlycon=uart8250,mmio32,0x11004000' to the boot arguments embedded in device-tree in order to enable early console on the UniElec U7623 board when using the vendor/stock bootloader. Signed-off-by: Daniel Golle --- .../linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts index 609bb8f109..c255e9af96 100644 --- a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts +++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts @@ -11,7 +11,7 @@ compatible = "unielec,u7623-02-emmc-512m", "unielec,u7623-02", "mediatek,mt7623"; chosen { - bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)"; + bootargs = "earlycon=uart8250,mmio32,0x11004000 console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root) rootfstype=squashfs root=/dev/mmcblk0p2"; }; memory@80000000 { From 5d110c016184fc2f072a41b77fce322b439bc225 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 31 Jan 2022 00:07:32 +0000 Subject: [PATCH 048/144] procd: seccomp/jail: Fix build error on arm with glibc From: Peter Lundkvist This fixes the make_syscall_h.sh script to recognize both __NR_Linux, used by mips, and __NR_SYSCALL_BASE and __ARM_NR_BASE used by arm. Run-tested on arm (ipq806x) and mips (ath79), both with glibc. Compile-tested and checked resulting syscall_names.h file wuth glibc: aarch64, powerpc, x86_64, i486 musl: arm, mips Fixes: FS#4194, FS#4195 Signed-off-by: Peter Lundkvist Signed-off-by: Daniel Golle --- package/system/procd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 27b235cea7..a7de6920eb 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_MIRROR_HASH:=0e506062a992f77979bd59eb51fb5d500e45197cc7bfba3a9302415d754dbfd1 -PKG_SOURCE_DATE:=2022-01-11 -PKG_SOURCE_VERSION:=ac2b8b365bdbcbf292f77409d180ec3c0963faf3 +PKG_MIRROR_HASH:=6880a4013c6b846ff0ad088a84294bbdbf7bb030a6838a97211c8e0161ee29db +PKG_SOURCE_DATE:=2022-01-31 +PKG_SOURCE_VERSION:=cb0031c47b9d46f3cf84daa90d484af5f9c90e31 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 9ba7a834254de33a3578a1a5884a39dc88ef7caf Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 31 Jan 2022 00:45:10 +0000 Subject: [PATCH 049/144] mediatek: mt7623: simplify partition generation The two options 'emmc' and 'sdmmc' now became identical lines after introducing CONFIG_TARGET_ROOTFS_PARTSIZE. Remove the now useless if-clauses. Fixes: a40b4d335a ("mediatek: use CONFIG_TARGET_ROOTFS_PARTSIZE") Signed-off-by: Daniel Golle --- target/linux/mediatek/image/mt7623.mk | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 16f59790b0..4ef0aabe4d 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -57,12 +57,7 @@ define Build/mt7623-mbr ptgen -o $@.tmp -h 4 -s 63 -a 0 -l 1024 \ -t 0x41 -N uboot -p 1M@$(UBOOT_OFFSET) \ -t 0xea -N recovery -p 40M@4M \ - $(if $(findstring sdmmc,$1), \ - -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@48M \ - ) \ - $(if $(findstring emmc,$1), \ - -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@48M \ - ) + -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@48M echo -en \ $(if $(findstring sdmmc,$1),"SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00") \ From b6a2cee4b79f6834a4ac437016a09a77ae8eba14 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 31 Jan 2022 15:00:13 +0000 Subject: [PATCH 050/144] ubox: fix broken deferred start of logfile writer Just use 'start' action which will have the desired effect instead of trying to introduce a 'start_file' action which didn't work that way because procd jshn magic would have to wrap around it. Fixes: 88baf6ce2c ("ubox: only start log to file when filesystem has been mounted") Signed-off-by: Daniel Golle --- package/system/ubox/files/log.init | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init index 6587cf6b06..c6fdf44292 100644 --- a/package/system/ubox/files/log.init +++ b/package/system/ubox/files/log.init @@ -9,8 +9,6 @@ PIDCOUNT=0 USE_PROCD=1 PROG=/sbin/logread -extra_command "start_file" "Start writing to log file" - validate_log_section() { uci_load_validate system system "$1" "$2" \ @@ -90,7 +88,7 @@ start_service_remote() register_mount_trigger() { - [ -n "${log_file}" ] && procd_add_action_mount_trigger start_file "${log_file}" + [ -n "${log_file}" ] && procd_add_action_mount_trigger start "${log_file}" } service_triggers() @@ -109,12 +107,6 @@ start_service() config_foreach validate_log_section system start_service_remote } -start_file() -{ - config_load system - config_foreach validate_log_section system start_service_file -} - boot() { _BOOT=1 start } From 0c635cf830bc9bb46005f5f8ac414c80e1bcab4e Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Tue, 1 Feb 2022 02:10:01 +0900 Subject: [PATCH 051/144] linux-firmware: intel: add firmware for AX210 Add the most recent supported firmware file for Intel Wi-Fi 6E AX210 wireless chip. The API version 67 is not yet supported by the driver. Additional PNVM file is required since API version 62. Signed-off-by: Sungbo Eo --- package/firmware/linux-firmware/intel.mk | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 968c61f64c..908aa9dde0 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -7,13 +7,6 @@ define Package/ibt-firmware/install endef $(eval $(call BuildPackage,ibt-firmware)) -Package/iwlwifi-firmware-ax200 = $(call Package/firmware-default,Intel AX200 firmware) -define Package/iwlwifi-firmware-ax200/install - $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-cc-a0-62.ucode $(1)/lib/firmware -endef -$(eval $(call BuildPackage,iwlwifi-firmware-ax200)) - Package/iwl3945-firmware = $(call Package/firmware-default,Intel IWL3945 firmware) define Package/iwl3945-firmware/install $(INSTALL_DIR) $(1)/lib/firmware @@ -175,6 +168,21 @@ define Package/iwlwifi-firmware-iwl9260/install endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl9260)) +Package/iwlwifi-firmware-ax200 = $(call Package/firmware-default,Intel AX200 firmware) +define Package/iwlwifi-firmware-ax200/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-cc-a0-62.ucode $(1)/lib/firmware +endef +$(eval $(call BuildPackage,iwlwifi-firmware-ax200)) + +Package/iwlwifi-firmware-ax210 = $(call Package/firmware-default,Intel AX210 firmware) +define Package/iwlwifi-firmware-ax210/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0-66.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0.pnvm $(1)/lib/firmware +endef +$(eval $(call BuildPackage,iwlwifi-firmware-ax210)) + Package/e100-firmware = $(call Package/firmware-default,Intel e100) define Package/e100-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/e100 From c7a559980ad18270c0c1c7afa4cbe708f26fb851 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Mon, 31 Jan 2022 13:21:47 +0900 Subject: [PATCH 052/144] ath79: improve support for Dongwon T&I DW02-412H * Move &nand node to DTSI * Utilize nvmem for fetching caldata * Rename build recipe, clean before build * Simplify KERNEL definition Signed-off-by: Sungbo Eo --- .../dts/qca9557_dongwon_dw02-412h-128m.dts | 26 +------- .../dts/qca9557_dongwon_dw02-412h-64m.dts | 26 +------- .../ath79/dts/qca9557_dongwon_dw02-412h.dtsi | 66 ++++++++++++++----- target/linux/ath79/image/nand.mk | 12 ++-- .../etc/hotplug.d/firmware/11-ath10k-caldata | 5 -- 5 files changed, 60 insertions(+), 75 deletions(-) diff --git a/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-128m.dts b/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-128m.dts index 2308d82af9..199529e709 100644 --- a/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-128m.dts +++ b/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-128m.dts @@ -7,28 +7,6 @@ compatible = "dongwon,dw02-412h-128m", "qca,qca9557"; }; -&nand { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "current"; - reg = <0x0 0x1000000>; - read-only; - }; - - partition@1000000 { - label = "kernel"; - reg = <0x1000000 0x800000>; - }; - - partition@1800000 { - label = "ubi"; - reg = <0x1800000 0x6800000>; - }; - }; +&ubi { + reg = <0x1800000 0x6800000>; }; diff --git a/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-64m.dts b/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-64m.dts index 2420dc11a9..15d3d677a9 100644 --- a/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-64m.dts +++ b/target/linux/ath79/dts/qca9557_dongwon_dw02-412h-64m.dts @@ -7,28 +7,6 @@ compatible = "dongwon,dw02-412h-64m", "qca,qca9557"; }; -&nand { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "current"; - reg = <0x0 0x1000000>; - read-only; - }; - - partition@1000000 { - label = "kernel"; - reg = <0x1000000 0x800000>; - }; - - partition@1800000 { - label = "ubi"; - reg = <0x1800000 0x2800000>; - }; - }; +&ubi { + reg = <0x1800000 0x2800000>; }; diff --git a/target/linux/ath79/dts/qca9557_dongwon_dw02-412h.dtsi b/target/linux/ath79/dts/qca9557_dongwon_dw02-412h.dtsi index fd56983432..498499c146 100644 --- a/target/linux/ath79/dts/qca9557_dongwon_dw02-412h.dtsi +++ b/target/linux/ath79/dts/qca9557_dongwon_dw02-412h.dtsi @@ -97,30 +97,74 @@ read-only; }; - art: partition@1f0000 { + partition@1f0000 { label = "art"; reg = <0x1f0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + cal_art_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: cal@5000 { + reg = <0x5000 0x844>; + }; }; }; }; }; +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "current"; + reg = <0x0 0x1000000>; + read-only; + }; + + partition@1000000 { + label = "kernel"; + reg = <0x1000000 0x800000>; + }; + + ubi: partition@1800000 { + label = "ubi"; + }; + }; +}; + &pcie0 { status = "okay"; wifi@0,0 { compatible = "qcom,ath10k"; reg = <0 0 0 0 0>; + + nvmem-cells = <&macaddr_art_0>, <&cal_art_5000>; + nvmem-cell-names = "mac-address", "calibration"; + mac-address-increment = <4>; }; }; &wmac { status = "okay"; - mtd-cal-data = <&art 0x1000>; - nvmem-cells = <&macaddr_art_0>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_0>, <&cal_art_1000>; + nvmem-cell-names = "mac-address", "calibration"; mac-address-increment = <3>; }; @@ -144,8 +188,8 @@ 0x54 0x00000000 /* LED Control Register 1 */ 0x58 0x00000000 /* LED Control Register 2 */ 0x5c 0x0030c300 /* LED Control Register 3 */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; + 0x7c 0x0000007e /* PORT0_STATUS */ + >; }; }; @@ -163,13 +207,3 @@ rgmii-enabled = <1>; }; }; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; -}; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index b8006c6d0c..1e1152551b 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -1,7 +1,7 @@ -define Build/dw-headers - head -c 4 $@ >> $@.tmp && \ - head -c 8 /dev/zero >> $@.tmp && \ - tail -c +9 $@ >> $@.tmp && \ +define Build/dongwon-header + head -c 4 $@ > $@.tmp + head -c 8 /dev/zero >> $@.tmp + tail -c +9 $@ >> $@.tmp ( \ header_crc="$$(head -c 68 $@.tmp | gzip -c | \ tail -c 8 | od -An -N4 -tx4 --endian little | tr -d ' \n')"; \ @@ -99,8 +99,8 @@ define Device/dongwon_dw02-412h KERNEL_SIZE := 8192k BLOCKSIZE := 128k PAGESIZE := 2048 - KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | dw-headers - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma | dw-headers + KERNEL := $$(KERNEL) | dongwon-header + KERNEL_INITRAMFS := $$(KERNEL) UBINIZE_OPTS := -E 5 IMAGES += factory.img IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 03e225ddde..d47e296853 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -13,11 +13,6 @@ case "$FIRMWARE" in caldata_extract "art" 0x5000 0x844 ath10k_patch_mac $(mtd_get_mac_binary art 0x12) ;; - dongwon,dw02-412h-64m|\ - dongwon,dw02-412h-128m) - caldata_extract "art" 0x5000 0x844 - ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 4) - ;; glinet,gl-ar750s-nor|\ glinet,gl-ar750s-nor-nand) caldata_extract "art" 0x5000 0x844 From f16f4190222a0ce2955d71b3972367505dfad2ab Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Tue, 1 Feb 2022 02:35:26 +0900 Subject: [PATCH 053/144] ipq806x: convert remaining mtd-mac-address-increment Commit d284e6ef0f06 ("treewide: convert mtd-mac-address-increment* to generic implementation") renamed "mtd-mac-address-increment" property to "mac-address-increment". Convert remaining usages that have been added after that. Fixes: f44e933458b1 ("ipq806x: provide WiFI mac-addresses from dts") Signed-off-by: Sungbo Eo --- .../ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts index 863c5d7b1c..a671202dc9 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts @@ -297,7 +297,7 @@ nvmem-cells = <&macaddr_defaultmac_0>; nvmem-cell-names = "mac-address"; - mtd-mac-address-increment = <(-1)>; + mac-address-increment = <(-1)>; }; }; }; From ad5bf160016a6206b6cfe219bfdff7964f21717a Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Tue, 1 Feb 2022 02:36:11 +0900 Subject: [PATCH 054/144] ath79: convert remaining mtd-mac-address-increment Commit d284e6ef0f06 ("treewide: convert mtd-mac-address-increment* to generic implementation") renamed "mtd-mac-address-increment" property to "mac-address-increment". Convert remaining usages that have been added after that. Fixes: af8a059bb41d ("ath79: add support for GL.iNet GL-XE300") Signed-off-by: Sungbo Eo --- target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts b/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts index 59344917ad..391d76c5dd 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts @@ -143,7 +143,7 @@ nvmem-cells = <&macaddr_art_0>; nvmem-cell-names = "mac-address"; - mtd-mac-address-increment = <1>; + mac-address-increment = <1>; }; ð1 { From da8b720b0ecbb6d58f28a31b082b0c53be149a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 1 Feb 2022 10:45:38 +0100 Subject: [PATCH 055/144] bcm4908: backport first 5.18 DTS changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...adcom-bcm4908-use-proper-TWD-binding.patch | 47 +++++ ...broadcom-bcm4908-add-pinctrl-binding.patch | 160 ++++++++++++++++++ ...ctrl-Add-binding-for-BCM4908-pinctrl.patch | 4 +- ...4-dts-broadcom-bcm4908-add-TWD-block.patch | 23 +-- ...adcom-bcm4908-use-proper-TWD-binding.patch | 47 +++++ ...broadcom-bcm4908-add-pinctrl-binding.patch | 160 ++++++++++++++++++ ...4-dts-broadcom-bcm4908-add-TWD-block.patch | 23 +-- 7 files changed, 424 insertions(+), 40 deletions(-) create mode 100644 target/linux/bcm4908/patches-5.10/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch create mode 100644 target/linux/bcm4908/patches-5.10/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch create mode 100644 target/linux/bcm4908/patches-5.4/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch create mode 100644 target/linux/bcm4908/patches-5.4/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch diff --git a/target/linux/bcm4908/patches-5.10/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch b/target/linux/bcm4908/patches-5.10/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch new file mode 100644 index 0000000000..420f790fdd --- /dev/null +++ b/target/linux/bcm4908/patches-5.10/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch @@ -0,0 +1,47 @@ +From 33826e9c6ba76b265d4e26cb95493fa27ed78974 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 29 Dec 2021 11:23:14 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: use proper TWD binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Block at is a TWD that contains timers, watchdog and +reset. Actual timers happen to be at block beginning but they only span +across the first 0x28 registers. It means the old block description was +incorrect (size 0x3c). + +Drop timers binding for now and use documented TWD binding. Timers +should be properly documented and defined as TWD subnode. + +Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files") +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +@@ -273,9 +273,9 @@ + #size-cells = <1>; + ranges = <0x00 0x00 0xff800000 0x3000>; + +- timer: timer@400 { +- compatible = "brcm,bcm6328-timer", "syscon"; +- reg = <0x400 0x3c>; ++ twd: timer-mfd@400 { ++ compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; ++ reg = <0x400 0x4c>; + }; + + gpio0: gpio-controller@500 { +@@ -330,7 +330,7 @@ + + reboot { + compatible = "syscon-reboot"; +- regmap = <&timer>; ++ regmap = <&twd>; + offset = <0x34>; + mask = <1>; + }; diff --git a/target/linux/bcm4908/patches-5.10/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch b/target/linux/bcm4908/patches-5.10/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch new file mode 100644 index 0000000000..2f4baf80c6 --- /dev/null +++ b/target/linux/bcm4908/patches-5.10/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch @@ -0,0 +1,160 @@ +From 72b1c5da796ec5266f2012c36470e226cb4f09c9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 30 Dec 2021 12:05:35 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: add pinctrl binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Describe pinmux block with its maps. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 135 ++++++++++++++++++ + 1 file changed, 135 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +@@ -287,6 +287,141 @@ + gpio-controller; + }; + ++ pinctrl@560 { ++ compatible = "brcm,bcm4908-pinctrl"; ++ reg = <0x560 0x10>; ++ ++ pins_led_0_a: led_0-a-pins { ++ function = "led_0"; ++ groups = "led_0_grp_a"; ++ }; ++ ++ pins_led_1_a: led_1-a-pins { ++ function = "led_1"; ++ groups = "led_1_grp_a"; ++ }; ++ ++ pins_led_2_a: led_2-a-pins { ++ function = "led_2"; ++ groups = "led_2_grp_a"; ++ }; ++ ++ pins_led_3_a: led_3-a-pins { ++ function = "led_3"; ++ groups = "led_3_grp_a"; ++ }; ++ ++ pins_led_4_a: led_4-a-pins { ++ function = "led_4"; ++ groups = "led_4_grp_a"; ++ }; ++ ++ pins_led_5_a: led_5-a-pins { ++ function = "led_5"; ++ groups = "led_5_grp_a"; ++ }; ++ ++ pins_led_6_a: led_6-a-pins { ++ function = "led_6"; ++ groups = "led_6_grp_a"; ++ }; ++ ++ pins_led_7_a: led_7-a-pins { ++ function = "led_7"; ++ groups = "led_7_grp_a"; ++ }; ++ ++ pins_led_8_a: led_8-a-pins { ++ function = "led_8"; ++ groups = "led_8_grp_a"; ++ }; ++ ++ pins_led_9_a: led_9-a-pins { ++ function = "led_9"; ++ groups = "led_9_grp_a"; ++ }; ++ ++ pins_led_21_a: led_21-a-pins { ++ function = "led_21"; ++ groups = "led_21_grp_a"; ++ }; ++ ++ pins_led_22_a: led_22-a-pins { ++ function = "led_22"; ++ groups = "led_22_grp_a"; ++ }; ++ ++ pins_led_26_a: led_26-a-pins { ++ function = "led_26"; ++ groups = "led_26_grp_a"; ++ }; ++ ++ pins_led_27_a: led_27-a-pins { ++ function = "led_27"; ++ groups = "led_27_grp_a"; ++ }; ++ ++ pins_led_28_a: led_28-a-pins { ++ function = "led_28"; ++ groups = "led_28_grp_a"; ++ }; ++ ++ pins_led_29_a: led_29-a-pins { ++ function = "led_29"; ++ groups = "led_29_grp_a"; ++ }; ++ ++ pins_led_30_a: led_30-a-pins { ++ function = "led_30"; ++ groups = "led_30_grp_a"; ++ }; ++ ++ pins_hs_uart: hs_uart-pins { ++ function = "hs_uart"; ++ groups = "hs_uart_grp"; ++ }; ++ ++ pins_i2c_a: i2c-a-pins { ++ function = "i2c"; ++ groups = "i2c_grp_a"; ++ }; ++ ++ pins_i2c_b: i2c-b-pins { ++ function = "i2c"; ++ groups = "i2c_grp_b"; ++ }; ++ ++ pins_i2s: i2s-pins { ++ function = "i2s"; ++ groups = "i2s_grp"; ++ }; ++ ++ pins_nand_ctrl: nand_ctrl-pins { ++ function = "nand_ctrl"; ++ groups = "nand_ctrl_grp"; ++ }; ++ ++ pins_nand_data: nand_data-pins { ++ function = "nand_data"; ++ groups = "nand_data_grp"; ++ }; ++ ++ pins_emmc_ctrl: emmc_ctrl-pins { ++ function = "emmc_ctrl"; ++ groups = "emmc_ctrl_grp"; ++ }; ++ ++ pins_usb0_pwr: usb0_pwr-pins { ++ function = "usb0_pwr"; ++ groups = "usb0_pwr_grp"; ++ }; ++ ++ pins_usb1_pwr: usb1_pwr-pins { ++ function = "usb1_pwr"; ++ groups = "usb1_pwr_grp"; ++ }; ++ }; ++ + uart0: serial@640 { + compatible = "brcm,bcm6345-uart"; + reg = <0x640 0x18>; diff --git a/target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch b/target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch index 0d2573b902..0dcc112edb 100644 --- a/target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch +++ b/target/linux/bcm4908/patches-5.10/085-v5.18-0001-dt-bindings-pinctrl-Add-binding-for-BCM4908-pinctrl.patch @@ -95,7 +95,7 @@ Signed-off-by: Linus Walleij + }; --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -3688,6 +3688,13 @@ F: Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml +@@ -3436,6 +3436,13 @@ F: Documentation/devicetree/bindings/net F: drivers/net/ethernet/broadcom/bcm4908_enet.* F: drivers/net/ethernet/broadcom/unimac.h @@ -107,5 +107,5 @@ Signed-off-by: Linus Walleij +F: Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml + BROADCOM BCM5301X ARM ARCHITECTURE - M: Florian Fainelli M: Hauke Mehrtens + M: Rafał Miłecki diff --git a/target/linux/bcm4908/patches-5.10/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch b/target/linux/bcm4908/patches-5.10/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch index 41d731d8db..c505a46d46 100644 --- a/target/linux/bcm4908/patches-5.10/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch +++ b/target/linux/bcm4908/patches-5.10/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch @@ -17,16 +17,10 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -273,9 +273,18 @@ - #size-cells = <1>; - ranges = <0x00 0x00 0xff800000 0x3000>; - -- timer: timer@400 { -- compatible = "brcm,bcm6328-timer", "syscon"; -- reg = <0x400 0x3c>; -+ twd: timer-mfd@400 { -+ compatible = "brcm,bcm4908-twd", "brcm,twd", "simple-mfd", "syscon"; -+ reg = <0x400 0x4c>; +@@ -276,6 +276,15 @@ + twd: timer-mfd@400 { + compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; + reg = <0x400 0x4c>; + ranges = <0x0 0x400 0x4c>; + + #address-cells = <1>; @@ -39,12 +33,3 @@ Signed-off-by: Rafał Miłecki }; gpio0: gpio-controller@500 { -@@ -330,7 +339,7 @@ - - reboot { - compatible = "syscon-reboot"; -- regmap = <&timer>; -+ regmap = <&twd>; - offset = <0x34>; - mask = <1>; - }; diff --git a/target/linux/bcm4908/patches-5.4/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch b/target/linux/bcm4908/patches-5.4/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch new file mode 100644 index 0000000000..420f790fdd --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/036-v5.18-0001-arm64-dts-broadcom-bcm4908-use-proper-TWD-binding.patch @@ -0,0 +1,47 @@ +From 33826e9c6ba76b265d4e26cb95493fa27ed78974 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 29 Dec 2021 11:23:14 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: use proper TWD binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Block at is a TWD that contains timers, watchdog and +reset. Actual timers happen to be at block beginning but they only span +across the first 0x28 registers. It means the old block description was +incorrect (size 0x3c). + +Drop timers binding for now and use documented TWD binding. Timers +should be properly documented and defined as TWD subnode. + +Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files") +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +@@ -273,9 +273,9 @@ + #size-cells = <1>; + ranges = <0x00 0x00 0xff800000 0x3000>; + +- timer: timer@400 { +- compatible = "brcm,bcm6328-timer", "syscon"; +- reg = <0x400 0x3c>; ++ twd: timer-mfd@400 { ++ compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; ++ reg = <0x400 0x4c>; + }; + + gpio0: gpio-controller@500 { +@@ -330,7 +330,7 @@ + + reboot { + compatible = "syscon-reboot"; +- regmap = <&timer>; ++ regmap = <&twd>; + offset = <0x34>; + mask = <1>; + }; diff --git a/target/linux/bcm4908/patches-5.4/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch b/target/linux/bcm4908/patches-5.4/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch new file mode 100644 index 0000000000..2f4baf80c6 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/036-v5.18-0002-arm64-dts-broadcom-bcm4908-add-pinctrl-binding.patch @@ -0,0 +1,160 @@ +From 72b1c5da796ec5266f2012c36470e226cb4f09c9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 30 Dec 2021 12:05:35 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcm4908: add pinctrl binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Describe pinmux block with its maps. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 135 ++++++++++++++++++ + 1 file changed, 135 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +@@ -287,6 +287,141 @@ + gpio-controller; + }; + ++ pinctrl@560 { ++ compatible = "brcm,bcm4908-pinctrl"; ++ reg = <0x560 0x10>; ++ ++ pins_led_0_a: led_0-a-pins { ++ function = "led_0"; ++ groups = "led_0_grp_a"; ++ }; ++ ++ pins_led_1_a: led_1-a-pins { ++ function = "led_1"; ++ groups = "led_1_grp_a"; ++ }; ++ ++ pins_led_2_a: led_2-a-pins { ++ function = "led_2"; ++ groups = "led_2_grp_a"; ++ }; ++ ++ pins_led_3_a: led_3-a-pins { ++ function = "led_3"; ++ groups = "led_3_grp_a"; ++ }; ++ ++ pins_led_4_a: led_4-a-pins { ++ function = "led_4"; ++ groups = "led_4_grp_a"; ++ }; ++ ++ pins_led_5_a: led_5-a-pins { ++ function = "led_5"; ++ groups = "led_5_grp_a"; ++ }; ++ ++ pins_led_6_a: led_6-a-pins { ++ function = "led_6"; ++ groups = "led_6_grp_a"; ++ }; ++ ++ pins_led_7_a: led_7-a-pins { ++ function = "led_7"; ++ groups = "led_7_grp_a"; ++ }; ++ ++ pins_led_8_a: led_8-a-pins { ++ function = "led_8"; ++ groups = "led_8_grp_a"; ++ }; ++ ++ pins_led_9_a: led_9-a-pins { ++ function = "led_9"; ++ groups = "led_9_grp_a"; ++ }; ++ ++ pins_led_21_a: led_21-a-pins { ++ function = "led_21"; ++ groups = "led_21_grp_a"; ++ }; ++ ++ pins_led_22_a: led_22-a-pins { ++ function = "led_22"; ++ groups = "led_22_grp_a"; ++ }; ++ ++ pins_led_26_a: led_26-a-pins { ++ function = "led_26"; ++ groups = "led_26_grp_a"; ++ }; ++ ++ pins_led_27_a: led_27-a-pins { ++ function = "led_27"; ++ groups = "led_27_grp_a"; ++ }; ++ ++ pins_led_28_a: led_28-a-pins { ++ function = "led_28"; ++ groups = "led_28_grp_a"; ++ }; ++ ++ pins_led_29_a: led_29-a-pins { ++ function = "led_29"; ++ groups = "led_29_grp_a"; ++ }; ++ ++ pins_led_30_a: led_30-a-pins { ++ function = "led_30"; ++ groups = "led_30_grp_a"; ++ }; ++ ++ pins_hs_uart: hs_uart-pins { ++ function = "hs_uart"; ++ groups = "hs_uart_grp"; ++ }; ++ ++ pins_i2c_a: i2c-a-pins { ++ function = "i2c"; ++ groups = "i2c_grp_a"; ++ }; ++ ++ pins_i2c_b: i2c-b-pins { ++ function = "i2c"; ++ groups = "i2c_grp_b"; ++ }; ++ ++ pins_i2s: i2s-pins { ++ function = "i2s"; ++ groups = "i2s_grp"; ++ }; ++ ++ pins_nand_ctrl: nand_ctrl-pins { ++ function = "nand_ctrl"; ++ groups = "nand_ctrl_grp"; ++ }; ++ ++ pins_nand_data: nand_data-pins { ++ function = "nand_data"; ++ groups = "nand_data_grp"; ++ }; ++ ++ pins_emmc_ctrl: emmc_ctrl-pins { ++ function = "emmc_ctrl"; ++ groups = "emmc_ctrl_grp"; ++ }; ++ ++ pins_usb0_pwr: usb0_pwr-pins { ++ function = "usb0_pwr"; ++ groups = "usb0_pwr_grp"; ++ }; ++ ++ pins_usb1_pwr: usb1_pwr-pins { ++ function = "usb1_pwr"; ++ groups = "usb1_pwr_grp"; ++ }; ++ }; ++ + uart0: serial@640 { + compatible = "brcm,bcm6345-uart"; + reg = <0x640 0x18>; diff --git a/target/linux/bcm4908/patches-5.4/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch b/target/linux/bcm4908/patches-5.4/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch index 41d731d8db..c505a46d46 100644 --- a/target/linux/bcm4908/patches-5.4/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch +++ b/target/linux/bcm4908/patches-5.4/301-arm64-dts-broadcom-bcm4908-add-TWD-block.patch @@ -17,16 +17,10 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -273,9 +273,18 @@ - #size-cells = <1>; - ranges = <0x00 0x00 0xff800000 0x3000>; - -- timer: timer@400 { -- compatible = "brcm,bcm6328-timer", "syscon"; -- reg = <0x400 0x3c>; -+ twd: timer-mfd@400 { -+ compatible = "brcm,bcm4908-twd", "brcm,twd", "simple-mfd", "syscon"; -+ reg = <0x400 0x4c>; +@@ -276,6 +276,15 @@ + twd: timer-mfd@400 { + compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; + reg = <0x400 0x4c>; + ranges = <0x0 0x400 0x4c>; + + #address-cells = <1>; @@ -39,12 +33,3 @@ Signed-off-by: Rafał Miłecki }; gpio0: gpio-controller@500 { -@@ -330,7 +339,7 @@ - - reboot { - compatible = "syscon-reboot"; -- regmap = <&timer>; -+ regmap = <&twd>; - offset = <0x34>; - mask = <1>; - }; From cd6a6e3030ff9b758469cc159c219bc7a49df5e8 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 1 Feb 2022 21:35:06 +0200 Subject: [PATCH 056/144] Revert "ramips: add support for ipTIME AX2004M" Commit f4a79148f8cb ("ramips: add support for ipTIME AX2004M") seems to leak KERNEL_LOADADDR 0x82000000 to other devices, causing the to no longer boot. The leak is visible in u-boot: Using 'config-1' configuration Trying 'kernel-1' kernel subimage Description: MIPS OpenWrt Linux-5.10.92 Type: Kernel Image Compression: lzma compressed Data Start: 0x840000e4 Data Size: 10750165 Bytes = 10.3 MiB Architecture: MIPS OS: Linux Load Address: 0x82000000 Entry Point: 0x82000000 Normally, it should look like this: Using 'config-1' configuration Trying 'kernel-1' kernel subimage Description: MIPS OpenWrt Linux-5.10.92 Type: Kernel Image Compression: lzma compressed Data Start: 0xbfca00e4 Data Size: 2652547 Bytes = 2.5 MiB Architecture: MIPS OS: Linux Load Address: 0x80001000 Entry Point: 0x80001000 Revert the commit to avoid more people soft-bricking their devices. This reverts commit f4a79148f8cbb7dfbcddfb0c1128caec45a01596. Signed-off-by: Stijn Tintel --- include/image-commands.mk | 5 - .../ramips/dts/mt7621_iptime_ax2004m.dts | 165 ------------------ target/linux/ramips/image/mt7621.mk | 20 --- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 6 - .../mt7621/base-files/lib/upgrade/platform.sh | 1 - 5 files changed, 197 deletions(-) delete mode 100644 target/linux/ramips/dts/mt7621_iptime_ax2004m.dts diff --git a/include/image-commands.mk b/include/image-commands.mk index 485d870f05..eda3fee94b 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -295,11 +295,6 @@ define Build/install-dtb ) endef -define Build/iptime-crc32 - $(STAGING_DIR_HOST)/bin/iptime-crc32 $(1) $@ $@.new - mv $@.new $@ -endef - define Build/iptime-naspkg $(STAGING_DIR_HOST)/bin/iptime-naspkg $(1) $@ $@.new mv $@.new $@ diff --git a/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts b/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts deleted file mode 100644 index 6da223689c..0000000000 --- a/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "mt7621.dtsi" - -#include -#include - -/ { - compatible = "iptime,ax2004m", "mediatek,mt7621-soc"; - model = "ipTIME AX2004M"; - - aliases { - led-boot = &led_cpu; - led-failsafe = &led_cpu; - led-running = &led_cpu; - led-upgrade = &led_cpu; - }; - - chosen { - bootargs = "console=ttyS0,115200"; - }; - - leds { - compatible = "gpio-leds"; - - led_cpu: cpu { - label = "amber:cpu"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - }; - - wlan2g { - label = "amber:wlan2g"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0radio"; - }; - - wlan5g { - label = "amber:wlan5g"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1radio"; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; -}; - -&nand { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x80000>; - read-only; - }; - - partition@80000 { - label = "config"; - reg = <0x80000 0x80000>; - read-only; - }; - - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x80000>; - read-only; - - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; - }; - }; - - partition@180000 { - label = "firmware"; - reg = <0x180000 0x7680000>; - - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "kernel"; - reg = <0x0 0x400000>; - }; - - partition@400000 { - label = "ubi"; - reg = <0x400000 0x7280000>; - }; - }; - }; -}; - -&state_default { - gpio { - groups = "i2c", "jtag", "wdt"; - function = "gpio"; - }; -}; - -&gmac0 { - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <3>; -}; - -&switch0 { - ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; - - port@1 { - status = "okay"; - label = "lan4"; - }; - - port@2 { - status = "okay"; - label = "lan3"; - }; - - port@3 { - status = "okay"; - label = "lan2"; - }; - - port@4 { - status = "okay"; - label = "lan1"; - }; - }; -}; - -&pcie { - status = "okay"; -}; - -&pcie1 { - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0>; - }; -}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index b125df48d9..a461c57f15 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -817,26 +817,6 @@ define Device/iptime_a8004t endef TARGET_DEVICES += iptime_a8004t -define Device/iptime_ax2004m - $(Device/dsa-migration) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - IMAGE_SIZE := 121344k - UBINIZE_OPTS := -E 5 - KERNEL_LOADADDR := 0x82000000 - KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - IMAGES += recovery.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - IMAGE/recovery.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ - check-size | iptime-crc32 ax2004m - DEVICE_VENDOR := ipTIME - DEVICE_MODEL := AX2004M - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 -endef -TARGET_DEVICES += iptime_ax2004m - define Device/iptime_t5004 $(Device/dsa-migration) BLOCKSIZE := 128k diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 6d7af90e80..242e1e6efe 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -25,12 +25,6 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress ;; - iptime,ax2004m) - if [ "$PHYNBR" = "1" ]; then - base_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 3) - macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress - fi - ;; jcg,q20) [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index afbba0a646..8e1bdc157f 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -59,7 +59,6 @@ platform_do_upgrade() { dlink,dir-853-a3|\ hiwifi,hc5962|\ iptime,a3004t|\ - iptime,ax2004m|\ iptime,t5004|\ jcg,q20|\ linksys,e5600|\ From 782a4e00b7c04662212b4fd18d8236fc436d28ee Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 11:55:03 +0100 Subject: [PATCH 057/144] toolchain: gdb: Update to version 11.2 This is a minor corrective release over GDB 11.1, fixing the following issues: * PR sim/28302 (gdb fails to build with glibc 2.34) * PR build/28318 (std::thread support configure check does not use CXX_DIALECT) * PR gdb/28405 (arm-none-eabi: internal-error: ptid_t remote_target::select_thread_for_ambiguous_stop_reply(const target_waitstatus*): Assertion `first_resumed_thread != nullptr' failed) * PR tui/28483 ([gdb/tui] breakpoint creation not displayed) * PR build/28555 (uclibc compile failure since commit 4655f8509fd44e6efabefa373650d9982ff37fd6) * PR rust/28637 (Rust characters will be encoded using DW_ATE_UTF) * PR gdb/28758 (GDB 11 doesn't work correctly on binaries with a SHT_RELR (.relr.dyn) section) * PR gdb/28785 (Support SHT_RELR (.relr.dyn) section) Signed-off-by: Hauke Mehrtens --- toolchain/gdb/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index 2adb7d165a..6ed3b190ce 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb -PKG_VERSION:=11.1 +PKG_VERSION:=11.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_HASH:=cccfcc407b20d343fb320d4a9a2110776dd3165118ffd41f4b1b162340333f94 +PKG_HASH:=1497c36a71881b8671a9a84a0ee40faab788ca30d7ba19d8463c3cc787152e32 GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION) HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GDB_DIR) From 5b96048de109f7004de9f975c998523c1b252a80 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 11:54:49 +0100 Subject: [PATCH 058/144] gdb: Update gdb to version 11.2 This is a minor corrective release over GDB 11.1, fixing the following issues: * PR sim/28302 (gdb fails to build with glibc 2.34) * PR build/28318 (std::thread support configure check does not use CXX_DIALECT) * PR gdb/28405 (arm-none-eabi: internal-error: ptid_t remote_target::select_thread_for_ambiguous_stop_reply(const target_waitstatus*): Assertion `first_resumed_thread != nullptr' failed) * PR tui/28483 ([gdb/tui] breakpoint creation not displayed) * PR build/28555 (uclibc compile failure since commit 4655f8509fd44e6efabefa373650d9982ff37fd6) * PR rust/28637 (Rust characters will be encoded using DW_ATE_UTF) * PR gdb/28758 (GDB 11 doesn't work correctly on binaries with a SHT_RELR (.relr.dyn) section) * PR gdb/28785 (Support SHT_RELR (.relr.dyn) section) The sizes of the ipk changed on mips 24Kc like this: 2285775 gdb_11.1-3_mips_24kc.ipk 2287441 gdb_11.2-4_mips_24kc.ipk 191828 gdbserver_11.1-3_mips_24kc.ipk 191811 gdbserver_11.2-4_mips_24kc.ipk Signed-off-by: Hauke Mehrtens --- package/devel/gdb/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile index 24569634a9..dd1df7af85 100644 --- a/package/devel/gdb/Makefile +++ b/package/devel/gdb/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb -PKG_VERSION:=11.1 +PKG_VERSION:=11.2 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_HASH:=cccfcc407b20d343fb320d4a9a2110776dd3165118ffd41f4b1b162340333f94 +PKG_HASH:=1497c36a71881b8671a9a84a0ee40faab788ca30d7ba19d8463c3cc787152e32 PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 From 57f38e2c827e3be71d8b1709073e366afe011985 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 11:56:27 +0100 Subject: [PATCH 059/144] mbedtls: Update to version 2.16.12 This fixes the following security problems: * Zeroize several intermediate variables used to calculate the expected value when verifying a MAC or AEAD tag. This hardens the library in case the value leaks through a memory disclosure vulnerability. For example, a memory disclosure vulnerability could have allowed a man-in-the-middle to inject fake ciphertext into a DTLS connection. * Fix a double-free that happened after mbedtls_ssl_set_session() or mbedtls_ssl_get_session() failed with MBEDTLS_ERR_SSL_ALLOC_FAILED (out of memory). After that, calling mbedtls_ssl_session_free() and mbedtls_ssl_free() would cause an internal session buffer to be free()'d twice. CVE-2021-44732 The sizes of the ipk changed on MIPS 24Kc like this: 182454 libmbedtls12_2.16.11-2_mips_24kc.ipk 182742 libmbedtls12_2.16.12-1_mips_24kc.ipk Signed-off-by: Hauke Mehrtens --- package/libs/mbedtls/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 6adf091c3c..d3f7d0cad2 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=2.16.11 +PKG_VERSION:=2.16.12 PKG_RELEASE:=$(AUTORELEASE) PKG_USE_MIPS16:=0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=c18e7e9abf95e69e425260493720470021384a1728417042060a35d0b7b18b41 +PKG_HASH:=294871ab1864a65d0b74325e9219d5bcd6e91c34a3c59270c357bb9ae4d5c393 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=gpl-2.0.txt From cec4614df8f8e8e8402f247f66e3f96b7e916a15 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 11:57:25 +0100 Subject: [PATCH 060/144] ethtool: Update to version 5.16 795f420 cmis: Rename CMIS parsing functions 369b43a cmis: Initialize CMIS memory map da16288 cmis: Use memory map during parsing 6acaeb9 cmis: Consolidate code between IOCTL and netlink paths d7d15f7 sff-8636: Rename SFF-8636 parsing functions 4230597 sff-8636: Initialize SFF-8636 memory map b74c040 sff-8636: Use memory map during parsing 799572f sff-8636: Consolidate code between IOCTL and netlink paths 9fdf45c sff-8079: Split SFF-8079 parsing function 2ccda25 netlink: eeprom: Export a function to request an EEPROM page 86792db cmis: Request specific pages for parsing in netlink path 6e2b32a sff-8636: Request specific pages for parsing in netlink path c2170d4 sff-8079: Request specific pages for parsing in netlink path 9538f38 netlink: eeprom: Defer page requests to individual parsers 664586e Merge branch 'review/next/module-mem-map' into master 50fdaec ethtool: Set mask correctly for dumping advertised FEC modes c5e7133 cable-test: Fix premature process termination 73091cd sff-8636: Use an SFF-8636 specific define for maximum number of channels 837c166 sff-common: Move OFFSET_TO_U16_PTR() to common header file 8658852 cmis: Initialize Page 02h in memory map 27b42a9 cmis: Initialize Banked Page 11h in memory map 340d88e cmis: Parse and print diagnostic information eae6a99 cmis: Print Module State and Fault Cause 82012f2 cmis: Print Module-Level Controls d7b1007 sff-8636: Print Power set and Power override bits 429f2fc Merge branch 'review/cmis-diag' into master 32457a9 monitor: do not show duplicate options in help text c01963e Release version 5.16. The sizes of the ipk changed on MIPS 24Kc like this: 34317 ethtool_5.15-1_mips_24kc.ipk 34311 ethtool_5.16-1_mips_24kc.ipk Signed-off-by: Hauke Mehrtens --- package/network/utils/ethtool/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index 6f51652575..5182c55331 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=5.15 +PKG_VERSION:=5.16 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=686fd6110389d49c2a120f00c3cd5dfe43debada8e021e4270d74bbe452a116d +PKG_HASH:=aa2fef1936dd4a11755dfa0bdb93f0ec5bea45208d27c9754bc3abe1aa42c1cb PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From 64866ba47412c8cb39f891b1861c25df22023694 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 11:59:19 +0100 Subject: [PATCH 061/144] strace: Update to version 5.16 The sizes of the ipk changed on MIPS 24Kc like this: 289764 strace_5.14-1_mips_24kc.ipk 310899 strace_5.16-1_mips_24kc.ipk Signed-off-by: Hauke Mehrtens --- package/devel/strace/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index 527b3e01d8..8f66ffbe47 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=5.14 +PKG_VERSION:=5.16 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=901bee6db5e17debad4530dd9ffb4dc9a96c4a656edbe1c3141b7cb307b11e73 +PKG_HASH:=dc7db230ff3e57c249830ba94acab2b862da1fcaac55417e9b85041a833ca285 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=LGPL-2.1-or-later From 693d7c12e8fcdf553cd46fb561c63786b45a585a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 17:35:19 +0100 Subject: [PATCH 062/144] util-linux: Do not build raw any more. The man page of the raw tool does not build because the disk-utils/raw.8 file is missing. It looks like it should be in the tar.xz file we download, but it is missing. We do not package the raw tool, so this is not a problem. This fixes the following build error: No rule to make target 'disk-utils/raw.8', needed by 'all-am'. Stop. Signed-off-by: Hauke Mehrtens --- package/utils/util-linux/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index bf8a67f074..a532aaf769 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -542,6 +542,7 @@ CONFIGURE_ARGS += \ --disable-lslogins \ --disable-runuser \ --disable-chfn-chsh \ + --disable-raw \ --without-python \ --without-udev \ --without-readline \ From 18c6b99666acc98238013b081b9cdaf2ab4d06d9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 12:01:19 +0100 Subject: [PATCH 063/144] util-linux: Update to version 2.37.3 This release fixes two security mount(8) and umount(8) issues: CVE-2021-3996 Improper UID check in libmount allows an unprivileged user to unmount FUSE filesystems of users with similar UID. CVE-2021-3995 This issue is related to parsing the /proc/self/mountinfo file allows an unprivileged user to unmount other user's filesystems that are either world-writable themselves or mounted in a world-writable directory. Signed-off-by: Hauke Mehrtens --- package/utils/util-linux/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index a532aaf769..f2d58b413f 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux -PKG_VERSION:=2.37 +PKG_VERSION:=2.37.3 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.37 -PKG_HASH:=bd07b7e98839e0359842110525a3032fdb8eaf3a90bedde3dd1652d32d15cce5 +PKG_HASH:=590c592e58cd6bf38519cb467af05ce6a1ab18040e3e3418f24bcfb2f55f9776 PKG_CPE_ID:=cpe:/a:kernel:util-linux PKG_LICENSE:=GPL-2.0-only From 8c2445a0e4f2f5b7bcccc5f7e47b8cc831cac86c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 12:15:20 +0100 Subject: [PATCH 064/144] e2fsprogs: Update to version 1.46.5 The sizes of the ipk changed on MIPS 24Kc like this: 8788 badblocks_1.45.6-2_mips_24kc.ipk 8861 badblocks_1.46.5-1_mips_24kc.ipk 3652 chattr_1.45.6-2_mips_24kc.ipk 3657 chattr_1.46.5-1_mips_24kc.ipk 58128 debugfs_1.45.6-2_mips_24kc.ipk 60279 debugfs_1.46.5-1_mips_24kc.ipk 8551 dumpe2fs_1.45.6-2_mips_24kc.ipk 8567 dumpe2fs_1.46.5-1_mips_24kc.ipk 4797 e2freefrag_1.45.6-2_mips_24kc.ipk 4791 e2freefrag_1.46.5-1_mips_24kc.ipk 159790 e2fsprogs_1.45.6-2_mips_24kc.ipk 168212 e2fsprogs_1.46.5-1_mips_24kc.ipk 7083 e4crypt_1.45.6-2_mips_24kc.ipk 7134 e4crypt_1.46.5-1_mips_24kc.ipk 5749 filefrag_1.45.6-2_mips_24kc.ipk 6233 filefrag_1.46.5-1_mips_24kc.ipk 4361 libcomerr0_1.45.6-2_mips_24kc.ipk 4355 libcomerr0_1.46.5-1_mips_24kc.ipk 168040 libext2fs2_1.45.6-2_mips_24kc.ipk 174209 libext2fs2_1.46.5-1_mips_24kc.ipk 8514 libss2_1.45.6-2_mips_24kc.ipk 8613 libss2_1.46.5-1_mips_24kc.ipk 3148 lsattr_1.45.6-2_mips_24kc.ipk 3227 lsattr_1.46.5-1_mips_24kc.ipk 22530 resize2fs_1.45.6-2_mips_24kc.ipk 22909 resize2fs_1.46.5-1_mips_24kc.ipk 33315 tune2fs_1.45.6-2_mips_24kc.ipk 34511 tune2fs_1.46.5-1_mips_24kc.ipk Signed-off-by: Hauke Mehrtens --- package/utils/e2fsprogs/Makefile | 6 ++-- .../patches/001-com_err_version.patch | 2 +- ...build-Add-SYSLIBS-to-e4crypt-linking.patch | 28 ------------------- 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 package/utils/e2fsprogs/patches/003-build-Add-SYSLIBS-to-e4crypt-linking.patch diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index 3d64fab587..b131cdccac 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs -PKG_VERSION:=1.45.6 -PKG_RELEASE:=2 +PKG_VERSION:=1.46.5 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ -PKG_HASH:=ffa7ae6954395abdc50d0f8605d8be84736465afc53b8938ef473fcf7ff44256 +PKG_HASH:=2f16c9176704cf645dc69d5b15ff704ae722d665df38b2ed3cfc249757d8d81e PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=NOTICE diff --git a/package/utils/e2fsprogs/patches/001-com_err_version.patch b/package/utils/e2fsprogs/patches/001-com_err_version.patch index 62f1e08e71..c80896344b 100644 --- a/package/utils/e2fsprogs/patches/001-com_err_version.patch +++ b/package/utils/e2fsprogs/patches/001-com_err_version.patch @@ -1,6 +1,6 @@ --- a/lib/et/Makefile.in +++ b/lib/et/Makefile.in -@@ -25,8 +25,8 @@ SHARE_FILES= et_c.awk et_h.awk +@@ -26,8 +26,8 @@ SHARE_FILES= et_c.awk et_h.awk LIBRARY= libcom_err LIBDIR= et diff --git a/package/utils/e2fsprogs/patches/003-build-Add-SYSLIBS-to-e4crypt-linking.patch b/package/utils/e2fsprogs/patches/003-build-Add-SYSLIBS-to-e4crypt-linking.patch deleted file mode 100644 index dad71cf0b3..0000000000 --- a/package/utils/e2fsprogs/patches/003-build-Add-SYSLIBS-to-e4crypt-linking.patch +++ /dev/null @@ -1,28 +0,0 @@ -From e33ecf1595e390b2657018442c68ae824b3e13b4 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Tue, 15 Dec 2020 23:58:53 +0100 -Subject: [PATCH e2fsprogs] build: Add SYSLIBS to e4crypt linking - -The $(SYSLIBS) was missing when linking the e4crypt application. This is -available in the e4crypt.profiled variant, so I assume this was just -missing in the normal variant and is not left out intentionally. - -This fixes building e2fsprogrs with -fsanitize=undefined in the global -CFLAGS nad LDFLAGS. - -Signed-off-by: Hauke Mehrtens ---- - misc/Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/misc/Makefile.in -+++ b/misc/Makefile.in -@@ -242,7 +242,7 @@ e4defrag: $(E4DEFRAG_OBJS) $(DEPLIBS) - e4crypt: $(E4CRYPT_OBJS) $(DEPLIBS) $(DEPSTATIC_LIBUUID) - $(E) " LD $@" - $(Q) $(CC) $(ALL_LDFLAGS) -o e4crypt $(E4CRYPT_OBJS) \ -- $(LIBUUID) $(LIBS) -+ $(LIBUUID) $(LIBS) $(SYSLIBS) - - e4defrag.profiled: $(E4DEFRAG_OBJS) $(PROFILED_DEPLIBS) - $(E) " LD $@" From 392609543d90bc3a9d050580fca39e34f52d6183 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 12:23:56 +0100 Subject: [PATCH 065/144] libcap: Update to version 2.63 The sizes of the ipk changed on MIPS 24Kc like this: 11248 libcap_2.51-1_mips_24kc.ipk 14461 libcap_2.63-1_mips_24kc.ipk 18864 libcap-bin_2.51-1_mips_24kc.ipk 20576 libcap-bin_2.63-1_mips_24kc.ipk Signed-off-by: Hauke Mehrtens --- package/libs/libcap/Makefile | 6 ++++-- package/libs/libcap/patches/300-disable-tests.patch | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package/libs/libcap/Makefile b/package/libs/libcap/Makefile index 53a577f1f9..dcd535becd 100644 --- a/package/libs/libcap/Makefile +++ b/package/libs/libcap/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libcap -PKG_VERSION:=2.51 +PKG_VERSION:=2.63 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2 -PKG_HASH:=6609f3ab7aebcc8f9277f53a577c657d9f3056d1352ea623da7fd7c0f00890f9 +PKG_HASH:=0c637b8f44fc7d8627787e9cf57f15ac06c1ddccb53e41feec5496be3466f77f PKG_MAINTAINER:=Paul Wassi PKG_LICENSE:=GPL-2.0-only @@ -74,6 +74,8 @@ MAKE_FLAGS += \ DYNAMIC="yes" \ lib="lib" +TARGET_CFLAGS += $(FPIC) + ifneq ($(CONFIG_PACKAGE_libcap-bin-capsh-shell),) TARGET_CFLAGS += -DSHELL='\"$(CONFIG_PACKAGE_libcap-bin-capsh-shell)\"' endif diff --git a/package/libs/libcap/patches/300-disable-tests.patch b/package/libs/libcap/patches/300-disable-tests.patch index c1779e28ec..1cf9cc4ea6 100644 --- a/package/libs/libcap/patches/300-disable-tests.patch +++ b/package/libs/libcap/patches/300-disable-tests.patch @@ -7,4 +7,4 @@ - $(MAKE) -C tests $@ $(MAKE) -C progs $@ $(MAKE) -C doc $@ - $(MAKE) -C kdebug $@ + From 8c1a84aada660021a2f346114671a214df29aadd Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 13:10:00 +0100 Subject: [PATCH 066/144] uboot-envtools: Update to version 2022.01 The sizes of the ipk changed on MIPS 24Kc like this: 13281 uboot-envtools_2021.01-54_mips_24kc.ipk 13308 uboot-envtools_2022.01-1_mips_24kc.ipk Signed-off-by: Hauke Mehrtens --- package/boot/uboot-envtools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 1ace390c40..8bbe1eb991 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot -PKG_VERSION:=2021.01 +PKG_VERSION:=2022.01 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 @@ -17,7 +17,7 @@ PKG_SOURCE_URL:= \ https://ftp.denx.de/pub/u-boot \ https://mirror.cyberbits.eu/u-boot \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454 +PKG_HASH:=81b4543227db228c03f8a1bf5ddbc813b0bb8f6555ce46064ef721a6fc680413 PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) From 6cab21bd6d23407fb2dc4cf68015c4998839b5f7 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 17:32:42 +0100 Subject: [PATCH 067/144] kernel: Make kmod-usb-net-lan78xx depend on kmod-of-mdio kmod-usb-net-lan78xx depends on kmod-of-mdio when this package is activated. Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/usb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 9671b80333..f74c02a99f 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -1203,7 +1203,7 @@ $(eval $(call KernelPackage,usb-net-kaweth)) define KernelPackage/usb-net-lan78xx TITLE:=USB-To-Ethernet Microchip LAN78XX convertors - DEPENDS:=+kmod-fixed-phy +kmod-phy-microchip + DEPENDS:=+kmod-fixed-phy +kmod-phy-microchip +PACKAGE_kmod-of-mdio:kmod-of-mdio KCONFIG:=CONFIG_USB_LAN78XX FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/lan78xx.ko AUTOLOAD:=$(call AutoProbe,lan78xx) From d438bdca5d04c168f8646f2091d180ee10febe2b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 13:37:23 +0100 Subject: [PATCH 068/144] toolchain: glibc: Remove patch for ARC700 The ARC700 target was renoved, this patch is not needed any more. Signed-off-by: Hauke Mehrtens --- toolchain/glibc/patches/300-arc.patch | 55 --------------------------- 1 file changed, 55 deletions(-) delete mode 100644 toolchain/glibc/patches/300-arc.patch diff --git a/toolchain/glibc/patches/300-arc.patch b/toolchain/glibc/patches/300-arc.patch deleted file mode 100644 index 66f7aeb3ef..0000000000 --- a/toolchain/glibc/patches/300-arc.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/sysdeps/arc/atomic-machine.h -+++ b/sysdeps/arc/atomic-machine.h -@@ -64,6 +64,10 @@ typedef uintmax_t uatomic_max_t; - __atomic_val_bysize (__arch_compare_and_exchange_val, int, \ - mem, new, old, __ATOMIC_ACQUIRE) - -+#ifdef __ARC700__ -+#define atomic_full_barrier() ({ asm volatile ("sync":::"memory"); }) -+#else - #define atomic_full_barrier() ({ asm volatile ("dmb 3":::"memory"); }) -+#endif - - #endif /* _ARC_BITS_ATOMIC_H */ ---- a/sysdeps/unix/sysv/linux/arc/syscall.S -+++ b/sysdeps/unix/sysv/linux/arc/syscall.S -@@ -24,8 +24,13 @@ ENTRY (syscall) - mov_s r1, r2 - mov_s r2, r3 - mov_s r3, r4 -+#ifdef __ARC700__ -+ mov r4, r5 -+ mov r5, r6 -+#else - mov_s r4, r5 - mov_s r5, r6 -+#endif - - ARC_TRAP_INSN - brhi r0, -4096, L (call_syscall_err) ---- a/sysdeps/unix/sysv/linux/arc/sysdep.h -+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h -@@ -128,7 +128,11 @@ L (call_syscall_err): ASM_LINE_SEP \ - mov r8, __NR_##syscall_name ASM_LINE_SEP \ - ARC_TRAP_INSN ASM_LINE_SEP - -+# ifdef __ARC700__ -+# define ARC_TRAP_INSN trap0 -+# else - # define ARC_TRAP_INSN trap_s 0 -+# endif - - #else /* !__ASSEMBLER__ */ - -@@ -139,7 +143,11 @@ extern long int __syscall_error (long in - hidden_proto (__syscall_error) - # endif - -+# ifdef __ARC700__ -+# define ARC_TRAP_INSN "trap0 \n\t" -+# else - # define ARC_TRAP_INSN "trap_s 0 \n\t" -+#endif - - # undef INTERNAL_SYSCALL_NCS - # define INTERNAL_SYSCALL_NCS(number, nr_args, args...) \ From aa8299ee4f75e90795e58b4cc548bb2f7fe0c391 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 29 Jan 2022 12:25:48 -0500 Subject: [PATCH 069/144] kernel: bump 5.4 to 5.4.175 All patches automatically rebased. Signed-off-by: John Audia --- include/kernel-5.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-5.4 b/include/kernel-5.4 index 4010387f25..c9833ef60e 100644 --- a/include/kernel-5.4 +++ b/include/kernel-5.4 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.4 = .174 -LINUX_KERNEL_HASH-5.4.174 = e8cd1be5aefaf9b44024b039e31b6cb21135ab67f322e8dff98be5a9998308a9 +LINUX_VERSION-5.4 = .175 +LINUX_KERNEL_HASH-5.4.175 = ac901bdffb1488d6c730ca7ab42322163dd331b240e2f06ad83d199e251a4840 From 45d541bb409355f090b971d96ebebd8610ef84a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 20 Jan 2022 14:21:36 +0100 Subject: [PATCH 070/144] kernel: add kmod-vrf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add option to compile kmod-vrf, support for Virtual Routing and Forwarding (Lite). This module depends on NET_L3_MASTER_DEV, which is a boolean kernel option, so we need to create a configuration option also for this, and make kmod-vrf depend on it. Signed-off-by: Marek Behún --- config/Config-kernel.in | 10 ++++++++++ package/kernel/linux/modules/netsupport.mk | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 98dab9b6fd..31d4e276fd 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1042,6 +1042,16 @@ if KERNEL_IPV6 endif +# +# Miscellaneous network configuration +# + +config KERNEL_NET_L3_MASTER_DEV + bool "L3 Master device support" + help + This module provides glue between core networking code and device + drivers to support L3 master devices like VRF. + # # NFS related symbols # diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 166172dbf3..e37ab59575 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -564,6 +564,23 @@ endef $(eval $(call KernelPackage,veth)) +define KernelPackage/vrf + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Virtual Routing and Forwarding (Lite) + DEPENDS:=@KERNEL_NET_L3_MASTER_DEV + KCONFIG:=CONFIG_NET_VRF + FILES:=$(LINUX_DIR)/drivers/net/vrf.ko + AUTOLOAD:=$(call AutoLoad,30,vrf) +endef + +define KernelPackage/vrf/description + This option enables the support for mapping interfaces into VRF's. The + support enables VRF devices. +endef + +$(eval $(call KernelPackage,vrf)) + + define KernelPackage/slhc SUBMENU:=$(NETWORK_SUPPORT_MENU) HIDDEN:=1 From 93d91197b98463277b601ec2653351666a4ca4bd Mon Sep 17 00:00:00 2001 From: "Sergey V. Lobanov" Date: Sat, 1 Jan 2022 22:37:13 +0300 Subject: [PATCH 071/144] wolfssl: update to 5.1.1-stable Bump from 4.8.1-stable to 5.1.1-stable Detailed release notes: https://github.com/wolfSSL/wolfssl/releases Upstreamed patches: 001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch - https://github.com/wolfSSL/wolfssl/commit/fa8f23284d4689c2a737204b337b58d966dcbd8c 002-Update-macro-guard-on-SHA256-transform-call.patch - https://github.com/wolfSSL/wolfssl/commit/f447e4c1fa4c932c0286fa0331966756e243db81 Refreshed patches: 100-disable-hardening-check.patch 200-ecc-rng.patch CFLAG -DWOLFSSL_ALT_CERT_CHAINS replaced to --enable-altcertchains configure option The size of the ipk changed on aarch64 like this: 491341 libwolfssl4.8.1.31258522_4.8.1-stable-7_aarch64_cortex-a53.ipk 520322 libwolfssl5.1.1.31258522_5.1.1-stable-1_aarch64_cortex-a53.ipk Tested-by: Alozxy Acked-by: Eneas U de Queiroz Signed-off-by: Sergey V. Lobanov --- package/libs/wolfssl/Makefile | 6 +- ...change-asm-snippets-to-get-compiling.patch | 116 ------------------ ...macro-guard-on-SHA256-transform-call.patch | 22 ---- .../patches/100-disable-hardening-check.patch | 2 +- .../libs/wolfssl/patches/200-ecc-rng.patch | 4 +- 5 files changed, 6 insertions(+), 144 deletions(-) delete mode 100644 package/libs/wolfssl/patches/001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch delete mode 100644 package/libs/wolfssl/patches/002-Update-macro-guard-on-SHA256-transform-call.patch diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 15cfd430eb..6417bc2745 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=4.8.1-stable +PKG_VERSION:=5.1.1-stable PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) -PKG_HASH:=50db45f348f47e00c93dd244c24108220120cb3cc9d01434789229c32937c444 +PKG_HASH:=d3e0544dbe7e9587c0f6538cdc671b6492663bb7a4281819538abe6c99cdbd92 PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 @@ -64,7 +64,6 @@ TARGET_CFLAGS += \ -fomit-frame-pointer \ -flto \ -DFP_MAX_BITS=8192 \ - -DWOLFSSL_ALT_CERT_CHAINS \ $(if $(CONFIG_WOLFSSL_ALT_NAMES),-DWOLFSSL_ALT_NAMES) TARGET_LDFLAGS += -flto @@ -77,6 +76,7 @@ CONFIGURE_ARGS += \ --enable-opensslextra \ --enable-sni \ --enable-stunnel \ + --enable-altcertchains \ --disable-crypttests \ --disable-examples \ --disable-jobserver \ diff --git a/package/libs/wolfssl/patches/001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch b/package/libs/wolfssl/patches/001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch deleted file mode 100644 index 763f9e8d06..0000000000 --- a/package/libs/wolfssl/patches/001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch +++ /dev/null @@ -1,116 +0,0 @@ -From fa8f23284d4689c2a737204b337b58d966dcbd8c Mon Sep 17 00:00:00 2001 -From: Sean Parkinson -Date: Fri, 20 Aug 2021 10:23:38 +1000 -Subject: [PATCH] Maths x86 asm: change asm snippets to get compiling - -TFM: - Use register or memory for c0, c1, c2 in SQRADD and SQRADD2. -SP: - Use register or memory for vl, vh, vo in SP_ASM_MUL_ADD, -SP_ASM_MUL_ADD2 and SP_ASM_SQR_ADD. ---- - wolfcrypt/src/asm.c | 29 ++++++++++++++++++++--------- - wolfcrypt/src/sp_int.c | 6 +++--- - 2 files changed, 23 insertions(+), 12 deletions(-) - ---- a/wolfcrypt/src/asm.c -+++ b/wolfcrypt/src/asm.c -@@ -698,33 +698,39 @@ __asm__( \ - - #define SQRADD(i, j) \ - __asm__( \ -- "movl %6,%%eax \n\t" \ -+ "movl %3,%%eax \n\t" \ - "mull %%eax \n\t" \ - "addl %%eax,%0 \n\t" \ - "adcl %%edx,%1 \n\t" \ - "adcl $0,%2 \n\t" \ -- :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i) :"%eax","%edx","cc"); -+ :"+rm"(c0), "+rm"(c1), "+rm"(c2) \ -+ : "m"(i) \ -+ :"%eax","%edx","cc"); - - #define SQRADD2(i, j) \ - __asm__( \ -- "movl %6,%%eax \n\t" \ -- "mull %7 \n\t" \ -+ "movl %3,%%eax \n\t" \ -+ "mull %4 \n\t" \ - "addl %%eax,%0 \n\t" \ - "adcl %%edx,%1 \n\t" \ - "adcl $0,%2 \n\t" \ - "addl %%eax,%0 \n\t" \ - "adcl %%edx,%1 \n\t" \ - "adcl $0,%2 \n\t" \ -- :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j) :"%eax","%edx", "cc"); -+ :"+rm"(c0), "+rm"(c1), "+rm"(c2) \ -+ : "m"(i), "m"(j) \ -+ :"%eax","%edx", "cc"); - - #define SQRADDSC(i, j) \ --__asm__( \ -+__asm__( \ - "movl %3,%%eax \n\t" \ - "mull %4 \n\t" \ - "movl %%eax,%0 \n\t" \ - "movl %%edx,%1 \n\t" \ - "xorl %2,%2 \n\t" \ -- :"=r"(sc0), "=r"(sc1), "=r"(sc2): "g"(i), "g"(j) :"%eax","%edx","cc"); -+ :"=r"(sc0), "=r"(sc1), "=r"(sc2) \ -+ : "g"(i), "g"(j) \ -+ :"%eax","%edx","cc"); - - #define SQRADDAC(i, j) \ - __asm__( \ -@@ -733,7 +739,9 @@ __asm__( - "addl %%eax,%0 \n\t" \ - "adcl %%edx,%1 \n\t" \ - "adcl $0,%2 \n\t" \ -- :"=r"(sc0), "=r"(sc1), "=r"(sc2): "0"(sc0), "1"(sc1), "2"(sc2), "g"(i), "g"(j) :"%eax","%edx","cc"); -+ :"=r"(sc0), "=r"(sc1), "=r"(sc2) \ -+ : "0"(sc0), "1"(sc1), "2"(sc2), "g"(i), "g"(j) \ -+ :"%eax","%edx","cc"); - - #define SQRADDDB \ - __asm__( \ -@@ -743,7 +751,10 @@ __asm__( - "addl %6,%0 \n\t" \ - "adcl %7,%1 \n\t" \ - "adcl %8,%2 \n\t" \ -- :"=r"(c0), "=r"(c1), "=r"(c2) : "0"(c0), "1"(c1), "2"(c2), "r"(sc0), "r"(sc1), "r"(sc2) : "cc"); -+ :"=r"(c0), "=r"(c1), "=r"(c2) \ -+ : "0"(c0), "1"(c1), "2"(c2), "r"(sc0), "r"(sc1), \ -+ "r"(sc2) \ -+ : "cc"); - - #elif defined(TFM_X86_64) - /* x86-64 optimized */ ---- a/wolfcrypt/src/sp_int.c -+++ b/wolfcrypt/src/sp_int.c -@@ -476,7 +476,7 @@ static WC_INLINE sp_int_digit sp_div_wor - "addl %%eax, %[l] \n\t" \ - "adcl %%edx, %[h] \n\t" \ - "adcl $0 , %[o] \n\t" \ -- : [l] "+r" (vl), [h] "+r" (vh), [o] "+r" (vo) \ -+ : [l] "+rm" (vl), [h] "+rm" (vh), [o] "+rm" (vo) \ - : [a] "r" (va), [b] "r" (vb) \ - : "eax", "edx", "cc" \ - ) -@@ -502,7 +502,7 @@ static WC_INLINE sp_int_digit sp_div_wor - "addl %%eax, %[l] \n\t" \ - "adcl %%edx, %[h] \n\t" \ - "adcl $0 , %[o] \n\t" \ -- : [l] "+r" (vl), [h] "+r" (vh), [o] "+r" (vo) \ -+ : [l] "+rm" (vl), [h] "+rm" (vh), [o] "+rm" (vo) \ - : [a] "r" (va), [b] "r" (vb) \ - : "eax", "edx", "cc" \ - ) -@@ -541,7 +541,7 @@ static WC_INLINE sp_int_digit sp_div_wor - "addl %%eax, %[l] \n\t" \ - "adcl %%edx, %[h] \n\t" \ - "adcl $0 , %[o] \n\t" \ -- : [l] "+r" (vl), [h] "+r" (vh), [o] "+r" (vo) \ -+ : [l] "+rm" (vl), [h] "+rm" (vh), [o] "+rm" (vo) \ - : [a] "m" (va) \ - : "eax", "edx", "cc" \ - ) diff --git a/package/libs/wolfssl/patches/002-Update-macro-guard-on-SHA256-transform-call.patch b/package/libs/wolfssl/patches/002-Update-macro-guard-on-SHA256-transform-call.patch deleted file mode 100644 index f986b72798..0000000000 --- a/package/libs/wolfssl/patches/002-Update-macro-guard-on-SHA256-transform-call.patch +++ /dev/null @@ -1,22 +0,0 @@ -From f447e4c1fa4c932c0286fa0331966756e243db81 Mon Sep 17 00:00:00 2001 -From: JacobBarthelmeh -Date: Fri, 17 Sep 2021 15:06:13 -0700 -Subject: [PATCH] update macro guard on SHA256 transform call - ---- - src/ssl.c | 3 ++- - tests/api.c | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - ---- a/src/ssl.c -+++ b/src/ssl.c -@@ -17639,7 +17639,8 @@ size_t wolfSSL_get_client_random(const W - - #if defined(OPENSSL_EXTRA) - #if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \ -- (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))) -+ (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))) && \ -+ !defined(WOLFSSL_DEVCRYPTO_HASH) && !defined(WOLFSSL_AFALG_HASH) - /* Apply SHA256 transformation to the data */ - int wolfSSL_SHA256_Transform(WOLFSSL_SHA256_CTX* sha256, - const unsigned char* data) diff --git a/package/libs/wolfssl/patches/100-disable-hardening-check.patch b/package/libs/wolfssl/patches/100-disable-hardening-check.patch index 4141e28750..79d0d6f759 100644 --- a/package/libs/wolfssl/patches/100-disable-hardening-check.patch +++ b/package/libs/wolfssl/patches/100-disable-hardening-check.patch @@ -1,6 +1,6 @@ --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h -@@ -2274,7 +2274,7 @@ extern void uITRON4_free(void *p) ; +@@ -2346,7 +2346,7 @@ extern void uITRON4_free(void *p) ; #endif /* warning for not using harden build options (default with ./configure) */ diff --git a/package/libs/wolfssl/patches/200-ecc-rng.patch b/package/libs/wolfssl/patches/200-ecc-rng.patch index d8581be7eb..78ff4b1f4a 100644 --- a/package/libs/wolfssl/patches/200-ecc-rng.patch +++ b/package/libs/wolfssl/patches/200-ecc-rng.patch @@ -11,7 +11,7 @@ RNG regardless of the built settings for wolfssl. --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c -@@ -10938,21 +10938,21 @@ void wc_ecc_fp_free(void) +@@ -11647,21 +11647,21 @@ void wc_ecc_fp_free(void) #endif /* FP_ECC */ @@ -37,7 +37,7 @@ RNG regardless of the built settings for wolfssl. --- a/wolfssl/wolfcrypt/ecc.h +++ b/wolfssl/wolfcrypt/ecc.h -@@ -616,10 +616,8 @@ WOLFSSL_API +@@ -647,10 +647,8 @@ WOLFSSL_API void wc_ecc_fp_free(void); WOLFSSL_LOCAL void wc_ecc_fp_init(void); From 70eedac9b30a06d0d1445bfa31743440ba535e51 Mon Sep 17 00:00:00 2001 From: Alar Aun Date: Tue, 6 Apr 2021 19:38:31 +0300 Subject: [PATCH 072/144] ipq40xx: add MikroTik cAP ac support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds support for the MikroTik RouterBOARD RBcAPGi-5acD2nD (cAP ac), a indoor dual band, dual-radio 802.11ac wireless AP, two 10/100/1000 Mbps Ethernet ports. See https://mikrotik.com/product/cap_ac for more info. Specifications: - SoC: Qualcomm Atheros IPQ4018 - RAM: 128 MB - Storage: 16 MB NOR - Wireless: · Built-in IPQ4018 (SoC) 802.11b/g/n 2x2:2, 2.5 dBi antennae · Built-in IPQ4018 (SoC) 802.11a/n/ac 2x2:2, 2.5 dBi antennae - Ethernet: Built-in IPQ4018 (SoC, QCA8075) , 2x 1000/100/10 port, PoE in and passive PoE out Unsupported: - PoE out Installation: Boot the initramfs image via TFTP and then flash the sysupgrade image using "sysupgrade -n" Signed-off-by: Alar Aun --- package/firmware/ipq-wifi/Makefile | 2 + .../ipq-wifi/board-mikrotik_cap-ac.qca4019 | Bin 0 -> 24324 bytes .../ipq40xx/base-files/etc/board.d/01_leds | 7 + .../ipq40xx/base-files/etc/board.d/02_network | 5 + .../base-files/etc/board.d/03_gpio_switches | 3 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 2 + .../base-files/lib/upgrade/platform.sh | 1 + .../arch/arm/boot/dts/qcom-ipq4018-cap-ac.dts | 250 ++++++++++++++++++ target/linux/ipq40xx/image/mikrotik.mk | 9 + .../901-arm-boot-add-dts-files.patch | 3 +- 10 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 package/firmware/ipq-wifi/board-mikrotik_cap-ac.qca4019 create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cap-ac.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 5d8c04b7d8..8e1dcec20f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -45,6 +45,7 @@ ALLWIFIBOARDS:= \ linksys_ea8300 \ linksys_mr8300-v0 \ luma_wrtq-329acn \ + mikrotik_cap-ac \ mikrotik_hap-ac2 \ mikrotik_hap-ac3 \ mikrotik_sxtsq-5-ac \ @@ -135,6 +136,7 @@ $(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300)) $(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300)) $(eval $(call generate-ipq-wifi-package,linksys_mr8300-v0,Linksys MR8300)) $(eval $(call generate-ipq-wifi-package,luma_wrtq-329acn,Luma WRTQ-329ACN)) +$(eval $(call generate-ipq-wifi-package,mikrotik_cap-ac,Mikrotik cAP ac)) $(eval $(call generate-ipq-wifi-package,mikrotik_hap-ac2,Mikrotik hAP ac2)) $(eval $(call generate-ipq-wifi-package,mikrotik_hap-ac3,Mikrotik hAP ac3)) $(eval $(call generate-ipq-wifi-package,mikrotik_sxtsq-5-ac,MikroTik SXTsq 5 ac)) diff --git a/package/firmware/ipq-wifi/board-mikrotik_cap-ac.qca4019 b/package/firmware/ipq-wifi/board-mikrotik_cap-ac.qca4019 new file mode 100644 index 0000000000000000000000000000000000000000..81da65d2257f345c501fdb62c4699350bfd922a3 GIT binary patch literal 24324 zcmeHP|5p>)6(7D+iz^cn1QLdj5Fj)O5U57J2!zN<$OtS&g`FZ@jGHGgxoG&iUE0sV^O-&FGbuzw%plncT&a`A#*VpiBnw0$7 zdZn7LtjkU@w`!WJHFbD1bq}w#TBEG~XNAOt7hfpdCS=1`-P1X`l`UFK5E#rs0QzptQ8KfBpC)ltm4MUj6-A zj-MhIU7=t$_{%DIj8=WE&T$&?f(IUnW9=|U`}BDT z#I(HDd=MIyV%y`~@1xfc-FDR5bbMyEg#p^O2^e;Bqz9PFMTw8+M*7>;ic(RE#UQ~xzIU|RfxKgg{ch609uMcO?SPW= znQg7!XA=#d7OGN?gy+nTwRG*R;~a{TKbk(JFSwkjiKx=gROG&6hIkxfOKuyF2Y)7GD;$MAv>j)22Uoh2O?F@oY@pQE;3k3(I&q)!bRw9DgWW za_gpYNZRwOHhTTyT#%7tqmsB!4*{mLqb398E*g zmeb%&BvX)y5+}iSYj#CIzu{Ya-Kx6{v$ln^PFcIMIM*CME9+@*hkH_T4(_Y~5+xEP z7YL9`!v!#Q-5(@Mb_kFS5&;qc5&;qc5&;qc5&;qc5&;r{%|^i841v4jHhVrE`bUq} z>*ilT5U9`UCgxu_*53KddkaM+Sj`@IrRL#sdGEs|5bTq*kCFG@9g_~XJp!-qhERR| z>p%tqWS4#YgTDmw6%gyh9{^cTA6gFnxK7Of;HplD=frJhAu@MFu8zpgp(SPIN2}`U zb$wq9jZRG6p1nK&;L)GI{o#e@J8bfJ*5uVTt08k96s2@oGoj`jC@Sugh!ZMU9!S9tsX|O1x+P=1tx`;2-2z%Q|@XHyzL9dU*FZ|J{*ykH?7nu#mMZ z?ws@A0q@>z{yT9Xf_IPWE_wGBk3{9%FW}v~FH|ZOvMme-1F|h4At8_l<>%$yJ5D2) zIzjy#^&hnV(3s&R;TOX1hC7aUdmHfg33>Z4%U*D&cO2#^Sn2y80^s;U%+3En-061tO^+E(Y?qgaebY%dk$KTKkR<=!shFRo$BoKV%ulxHa23YAyvmP zbr~Blxk0FlURp2=YEM-Zh&W64uqmBZRUu;F|C2j9l#mFS28`{P!jP-uo30zRSfxR% zOUC966Dn0jk%+hSCquussX{Db;syqNLIPwOHeSR|8cKB8rg398)@V4S#T1iEmY0`KN)94PV_G91Z^r}{=G?Bjaz;N9hQVbr_*l;57Fl78aR;%4FjRK}! zm{Kd2(y>1p##K$yJW;ao8*Eb7t~w%$!VSiUx$%%`(0Bo>(q>2_O?qP|R;SI9MuI@} z+A|e$5!bkY4eK2u>bOaV05xQKlPu*?-9FYhmn8roF( z(n!Jsn1d(cg}3@-Nba0K5+xEP7YJ;JrQu>~WcLS)z(RM&Zx5vM8IgfEx*Ct}6~;z? z6nuKHpp$zlswSl1$<*;>W2$x) zeRrp^KlcKsDe~C&!^)Dq3Gurj=<)cuMrpo)A07SR_Nl?#&$t@Op{LWzft(BM#)xCj z##^eydpL}UkcT%KPfDc-D>O_uQgku(H0{XF1B-WR`ZLZm8)%h}42?%iB)mA-e}1x6 zb3n>Uq($}Ui!Y_OMpT4I@6Y`1y6Cf*Cfc$2q0_ap{XBM9;IyH&MTQDRH2VCwrZ>NX z*A!m*{T~Xi@Y*9!gdVv&curL;;j$=!Q~KslO3L`@bk;4svTOgDq?2Lto41>XGdtND z>aknb)HRY!HiJPO{=Dw^fkK{;7In4v$fxNlRwX6(-gL`o(bdGZh~ppZ!XYP4BCrh* zc-OCR{L@a}oN$n>ytx}%`xOojCl0*9FK{r~v9YY!!vW;4a5%w>>>?5H3IyCGef-?x zykhd37lb>!`;C6)ZDpo25zn>v@l4+HsMajJJ-*FbdG2{;0^a?+U*ir2s7H&nk?vWM zqqYMAI4|BG@Z!sdZhyNGy!egA$Q9q-+P|5cd)zn4yEo^$e(Hwg-TzeNNIS1Zz@412 YE3Un5zt>K1oq>_O`;ES8zWw */ + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + model = "MikroTik cAP ac"; + compatible = "mikrotik,cap-ac"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x08000000>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-running = &led_user; + led-upgrade = &led_user; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + counter@4a1000 { + compatible = "qcom,qca-gcnt"; + reg = <0x4a1000 0x4>; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + qcom,poll_required = <0>; + qcom,num_gmac = <1>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + mode { + label = "mode"; + gpios = <&tlmm 5 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + power { + label = "blue:power"; + gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + + led_user: user { + label = "green:user"; + gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + wlan2g { + label = "green:wlan2g"; + gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; + }; + + wlan5g { + label = "green:wlan5g"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + }; + + eth1 { + label = "green:eth1"; + gpios = <ðphy4 1 GPIO_ACTIVE_HIGH>; + }; + + eth2 { + label = "green:eth2"; + gpios = <ðphy3 1 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pin { + function = "blsp_spi0"; + pins = "gpio55", "gpio56", "gpio57"; + drive-strength = <2>; + bias-disable; + }; + pin_cs { + function = "gpio"; + pins = "gpio54"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; + + flash@0 { + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Qualcomm"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + label = "RouterBoot"; + reg = <0x80000 0x80000>; + read-only; + + hard_config { + read-only; + }; + + dtb_config { + read-only; + }; + + soft_config { + }; + }; + + partition@100000 { + compatible = "mikrotik,minor"; + label = "firmware"; + reg = <0x100000 0xf00000>; + }; + }; + }; +}; + +&blsp1_uart1 { + status = "okay"; + + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; +}; + +&cryptobam { + status = "okay"; +}; + +&mdio { + status = "okay"; +}; + +&gmac0 { + vlan_tag = <0 0x3f>; +}; + +ðphy3 { + gpio-controller; + #gpio-cells = <2>; +}; + +ðphy4 { + gpio-controller; + #gpio-cells = <2>; +}; + +&wifi0 { + status = "okay"; + + qcom,ath10k-calibration-variant = "MikroTik-cAP-ac"; +}; + +&wifi1 { + status = "okay"; + + qcom,ath10k-calibration-variant = "MikroTik-cAP-ac"; +}; diff --git a/target/linux/ipq40xx/image/mikrotik.mk b/target/linux/ipq40xx/image/mikrotik.mk index 2fdaad60ab..037a042848 100644 --- a/target/linux/ipq40xx/image/mikrotik.mk +++ b/target/linux/ipq40xx/image/mikrotik.mk @@ -20,6 +20,15 @@ define Device/mikrotik_nand IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata endef +define Device/mikrotik_cap-ac + $(call Device/mikrotik_nor) + DEVICE_MODEL := cAP ac + SOC := qcom-ipq4018 + DEVICE_PACKAGES := ipq-wifi-mikrotik_cap-ac -kmod-ath10k-ct \ + kmod-ath10k-ct-smallbuffers +endef +TARGET_DEVICES += mikrotik_cap-ac + define Device/mikrotik_hap-ac2 $(call Device/mikrotik_nor) DEVICE_MODEL := hAP ac2 diff --git a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch index b76b1a30bb..09ea4efddd 100644 --- a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -902,11 +902,72 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -902,11 +902,73 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -31,6 +31,7 @@ Signed-off-by: John Crispin + qcom-ipq4018-gl-ap1300.dtb \ + qcom-ipq4018-jalapeno.dtb \ + qcom-ipq4018-meshpoint-one.dtb \ ++ qcom-ipq4018-cap-ac.dtb \ + qcom-ipq4018-hap-ac2.dtb \ + qcom-ipq4018-sxtsq-5-ac.dtb \ + qcom-ipq4018-nbg6617.dtb \ From f2232544b879affe4e84c13fdf38da80e07c7360 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Thu, 20 Jan 2022 10:45:31 +0000 Subject: [PATCH 073/144] kernel: bump 5.10 to 5.10.93 No patches required rebasing. Signed-off-by: Rui Salvaterra --- include/kernel-5.10 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-5.10 b/include/kernel-5.10 index 677a470e89..ce08f299c1 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .92 -LINUX_KERNEL_HASH-5.10.92 = d5750380a51d3f1d7ab1dd64451752e321c987e0b0099bcd452187d9a76ebb52 +LINUX_VERSION-5.10 = .93 +LINUX_KERNEL_HASH-5.10.93 = a6788c430bab7670c08888caa0969521f22d5976483ee9452c2c0363153bbbcb From 1343acc8cd9e5c4206c2f65f1897c7be5660f046 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Thu, 27 Jan 2022 12:08:41 +0000 Subject: [PATCH 074/144] kernel: bump 5.10 to 5.10.94 Deleted (upstreamed): bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch [1] bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch [1] gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch [2] Manually rebased: bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch Manually reverted: generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch [3] [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=55b10b88ac8654fc2f31518aa349a2e643b37f18 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=958a8819d41420d7a74ed922a09cacc0ba3a4218 [3] https://lore.kernel.org/all/trinity-2a727d96-0335-4d03-8f30-e22a0e10112d-1643363480085@3c-app-gmx-bap33/ Signed-off-by: Rui Salvaterra Signed-off-by: Daniel Golle --- include/kernel-5.10 | 4 +- ...cks-early-during-the-boot-process-so.patch | 4 +- ...Mark-used-PLLs-and-dividers-CRITICAL.patch | 2 +- ...lk-bcm2835-Add-claim-clocks-property.patch | 16 +++--- ...35-Read-max-core-clock-from-firmware.patch | 8 +-- ...-0028-mm-Remove-the-PFN-busy-warning.patch | 2 +- ...1-Don-t-use-DT-aliases-for-numbering.patch | 2 +- ...0032-amba_pl011-Round-input-clock-up.patch | 6 +-- ...Add-cts-event-workaround-DT-property.patch | 2 +- ...y-amba-pl011-Add-un-throttle-support.patch | 2 +- .../950-0040-Add-dwc_otg-driver.patch | 2 +- ...-bcm2835-Use-zd-when-printing-size_t.patch | 2 +- ...Better-coalescing-parameter-defaults.patch | 2 +- ...support-for-setting-leaf-clock-rates.patch | 4 +- ...w-reparenting-leaf-clocks-while-they.patch | 10 ++-- ...bcm2835-Avoid-null-pointer-exception.patch | 2 +- ...0-0178-clk-bcm2835-Disable-v3d-clock.patch | 4 +- ...lise-rpi-firmware-before-clk-bcm2835.patch | 2 +- ...cec_available-flag-as-always-support.patch | 4 +- .../950-0313-vc4_hdmi-Set-HDMI_MAI_FMT.patch | 6 +-- ...-vc4-add-iec958-controls-to-vc4_hdmi.patch | 6 +-- ...move-setup-from-hw_params-to-prepare.patch | 6 +-- ...enable-HBR-MAI-format-on-HBR-streams.patch | 2 +- ...firmware-logic-for-MAI-threshold-set.patch | 2 +- ...t-VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE.patch | 2 +- ...et-bcmgenet-Reset-RBUF-on-first-open.patch | 2 +- ...resent-but-empty-dmas-disables-audio.patch | 2 +- ...the-HDMI-registers-into-the-debugfs-.patch | 6 +-- ...dmi-Report-that-3d-stereo-is-allowed.patch | 2 +- ...nused-infoframe-packet-RAM-registers.patch | 4 +- ...the-full-state-to-CRTC-atomic-enable.patch | 4 +- ...-the-full-state-to-CRTC-atomic_check.patch | 6 +-- ...the-full-state-to-CRTC-atomic-begin-.patch | 4 +- ...ss-the-atomic-state-to-encoder-hooks.patch | 10 ++-- ...-t-access-the-connector-state-in-res.patch | 2 +- ...hdmi-Create-a-custom-connector-state.patch | 4 +- ...re-pixel-frequency-in-the-connector-.patch | 10 ++-- ...-the-connector-state-pixel-rate-for-.patch | 2 +- ...drm-vc4-hdmi-Enable-10-12-bpc-output.patch | 16 +++--- ...ate-the-CEC-clock-divider-on-HSM-rat.patch | 2 +- ...7-drm-vc4-hdmi-Introduce-a-CEC-clock.patch | 6 +-- ...c4-hdmi-Split-the-interrupt-handlers.patch | 6 +-- ...-Support-BCM2711-CEC-interrupt-setup.patch | 10 ++-- ...-t-register-the-CEC-adapter-if-there.patch | 2 +- ...metadata-property-to-the-VC5-HDMI-co.patch | 12 ++--- ...ector-check-to-trigger-mode_change-w.patch | 4 +- ...rm-Avoid-full-hdmi-audio-fifo-writes.patch | 2 +- ...eate-a-helper-to-attach-the-hdr_outp.patch | 4 +- ...r-Add-helper-to-compare-HDR-metadata.patch | 8 +-- ...950-0529-drm-vc4-Use-the-new-helpers.patch | 6 +-- ...nal-the-proper-colorimetry-info-in-t.patch | 6 +-- ...37-clk-Introduce-a-clock-request-API.patch | 2 +- ...Convert-to-the-new-clock-request-API.patch | 8 +-- ...-Properly-compute-the-BVB-clock-rate.patch | 8 +-- ...75-drm-vc4-hdmi-Enable-the-scrambler.patch | 6 +-- ...c4-hdmi-Raise-the-maximum-clock-rate.patch | 2 +- ...i-Handle-case-when-bvb-clock-is-null.patch | 6 +-- ...LCLK-modes-even-if-horz-timing-is-od.patch | 4 +- ...mplify-the-connector-state-retrieval.patch | 2 +- ...Rely-on-interrupts-to-handle-hotplug.patch | 4 +- ...mi-Add-a-workqueue-to-set-scrambling.patch | 10 ++-- ...vc4-drm-hdmi-Fix-missing-declaration.patch | 2 +- ...950-0636-drm-vc4-Register-HDMI-codec.patch | 32 ++++++------ ...-vc4-hdmi-Remove-redundant-variables.patch | 10 ++-- ...vc4-Fix-timings-for-interlaced-modes.patch | 4 +- ...x-pixel-wrap-issue-with-DVP-teardown.patch | 6 +-- ...-a-fixed-rate-for-the-HSM-clock-on-B.patch | 10 ++-- ...Enable-the-scrambler-on-reconnection.patch | 6 +-- ...-the-device-on-error-in-pre_crtc_con.patch | 10 ++-- ...it-the-CEC-disable-enable-functions-.patch | 4 +- ...e-sure-the-device-is-powered-with-CE.patch | 45 ---------------- ...-missing-clk_disable_unprepare-on-er.patch | 2 +- ...e-initial-register-read-after-pm_run.patch | 37 ------------- ...p-devm-interrupt-handler-for-CEC-int.patch | 7 ++- ...p-devm-interrupt-handler-for-hotplug.patch | 10 ++-- ...y-call-into-DRM-framework-if-registe.patch | 2 +- ...-t-poll-for-the-infoframes-status-on.patch | 8 +-- ...9-drm-automatic-legacy-gamma-support.patch | 4 +- ...e-sure-the-controller-is-powered-up-.patch | 12 ++--- ...IPS-BCM63XX-add-support-for-BCM63268.patch | 4 +- ...MIPS-BCM63XX-add-support-for-BCM6318.patch | 6 +-- ...X-add-clkdev-lookups-for-device-tree.patch | 20 +++---- .../430-MIPS-BCM63XX-add-nand-clocks.patch | 6 +-- ...AS4220-B-fis-index-block-with-128-Ki.patch | 52 ------------------- ...to-define-reg_update_bits-for-no-bus.patch | 2 +- ...CPU_MIPS64-for-remaining-MIPS64-CPUs.patch | 2 +- ...forwarding-path-for-bridge-pppoe-dev.patch | 2 +- ...phy-marvell-refactor-HWMON-OOP-style.patch | 28 +++++----- ...-marvell-add-SFP-support-for-88E1510.patch | 4 +- ...the-dst-buffer-to-of_get_mac_address.patch | 10 ++-- ...mul-Add-description-for-class_revisi.patch | 2 +- ...mul-Add-definitions-for-missing-capa.patch | 2 +- ...-support-for-DEVCAP2-DEVCTL2-LNKCAP2.patch | 8 +-- ...PCI-aardvark-Clear-all-MSIs-at-setup.patch | 2 +- ...ment-actions-in-driver-remove-method.patch | 2 +- ...able-bus-mastering-when-unbinding-dr.patch | 4 +- ...k-all-interrupts-when-unbinding-driv.patch | 2 +- ...ark-Fix-memory-leak-in-driver-unbind.patch | 2 +- ...k-Assert-PERST-when-unbinding-driver.patch | 2 +- ...able-link-training-when-unbinding-dr.patch | 2 +- ...able-common-PHY-when-unbinding-drive.patch | 2 +- .../hack-5.10/259-regmap_dynamic.patch | 2 +- ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 2 +- .../300-mips_expose_boot_raw.patch | 2 +- ...ng-with-source-address-failed-policy.patch | 2 +- ...lace-custom-PCIE_CORE_INT_-macros-wi.patch | 6 +-- ...ark-Fix-reading-MSI-interrupt-number.patch | 4 +- ...dvark-Fix-support-for-MSI-interrupts.patch | 6 +-- ...rite-IRQ-code-to-chained-IRQ-handler.patch | 10 ++-- ...ck-return-value-of-generic_handle_do.patch | 2 +- ...e-MSI-irq_chip-structures-static-dri.patch | 6 +-- ...e-msi_domain_info-structure-a-static.patch | 4 +- ...-dev_fwnode-instead-of-of_node_to_fw.patch | 4 +- ...d-support-for-masking-MSI-interrupts.patch | 6 +-- ...PCI-aardvark-Fix-setting-MSI-address.patch | 4 +- ...12-PCI-aardvark-Enable-MSI-X-support.patch | 2 +- ...-support-for-ERR-interrupt-on-emulat.patch | 2 +- ...imize-writing-PCI_EXP_RTCTL_PMEIE-an.patch | 2 +- ...dvark-Add-support-for-PME-interrupts.patch | 2 +- ...-support-for-PME-requester-on-emulat.patch | 6 +-- ...-separate-INTA-interrupt-for-emulate.patch | 12 ++--- ...ove-irq_mask_ack-callback-for-INTx-i.patch | 2 +- ...aardvark-Don-t-mask-irq-when-mapping.patch | 2 +- ...p-__maybe_unused-from-advk_pcie_disa.patch | 2 +- ...ate-comment-about-link-going-down-af.patch | 2 +- ...e-main-irq_chip-structure-a-static-d.patch | 6 +-- ...ark-Fix-initialization-with-old-Marv.patch | 2 +- ...mediatek-Check-for-error-clk-pointer.patch | 52 +++++++++++++++++++ ...d-set-ipq40xx-watchdog-to-allow-boot.patch | 2 +- .../lantiq/patches-5.10/0152-lantiq-VPE.patch | 2 +- ...-pci-mvebu-time-out-reset-on-link-up.patch | 6 +-- .../130-itus_shield_support.patch | 2 +- ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 2 +- 133 files changed, 382 insertions(+), 461 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch delete mode 100644 target/linux/bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch delete mode 100644 target/linux/gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch create mode 100644 target/linux/generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch diff --git a/include/kernel-5.10 b/include/kernel-5.10 index ce08f299c1..46fe028757 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .93 -LINUX_KERNEL_HASH-5.10.93 = a6788c430bab7670c08888caa0969521f22d5976483ee9452c2c0363153bbbcb +LINUX_VERSION-5.10 = .94 +LINUX_KERNEL_HASH-5.10.94 = 28ff44aa4a9a8a1ea52ae74e448da6174ca4ff042ddc202e36b157c951cd7508 diff --git a/target/linux/bcm27xx/patches-5.10/950-0020-Register-the-clocks-early-during-the-boot-process-so.patch b/target/linux/bcm27xx/patches-5.10/950-0020-Register-the-clocks-early-during-the-boot-process-so.patch index 4c83d165c6..e00351d27e 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0020-Register-the-clocks-early-during-the-boot-process-so.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0020-Register-the-clocks-early-during-the-boot-process-so.patch @@ -13,7 +13,7 @@ Signed-off-by: Martin Sperl --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -2295,8 +2295,15 @@ static int bcm2835_clk_probe(struct plat +@@ -2290,8 +2290,15 @@ static int bcm2835_clk_probe(struct plat if (ret) return ret; @@ -30,7 +30,7 @@ Signed-off-by: Martin Sperl } static const struct cprman_plat_data cprman_bcm2835_plat_data = { -@@ -2322,7 +2329,11 @@ static struct platform_driver bcm2835_cl +@@ -2317,7 +2324,11 @@ static struct platform_driver bcm2835_cl .probe = bcm2835_clk_probe, }; diff --git a/target/linux/bcm27xx/patches-5.10/950-0022-clk-bcm2835-Mark-used-PLLs-and-dividers-CRITICAL.patch b/target/linux/bcm27xx/patches-5.10/950-0022-clk-bcm2835-Mark-used-PLLs-and-dividers-CRITICAL.patch index 4a0f1c5ad6..f5b135fc51 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0022-clk-bcm2835-Mark-used-PLLs-and-dividers-CRITICAL.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0022-clk-bcm2835-Mark-used-PLLs-and-dividers-CRITICAL.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1384,6 +1384,11 @@ bcm2835_register_pll_divider(struct bcm2 +@@ -1379,6 +1379,11 @@ bcm2835_register_pll_divider(struct bcm2 divider->div.hw.init = &init; divider->div.table = NULL; diff --git a/target/linux/bcm27xx/patches-5.10/950-0023-clk-bcm2835-Add-claim-clocks-property.patch b/target/linux/bcm27xx/patches-5.10/950-0023-clk-bcm2835-Add-claim-clocks-property.patch index efd1ccd268..9a56a262fa 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0023-clk-bcm2835-Add-claim-clocks-property.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0023-clk-bcm2835-Add-claim-clocks-property.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1312,6 +1312,8 @@ static const struct clk_ops bcm2835_vpu_ +@@ -1307,6 +1307,8 @@ static const struct clk_ops bcm2835_vpu_ .debug_init = bcm2835_clock_debug_init, }; @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman, const void *data) { -@@ -1329,6 +1331,9 @@ static struct clk_hw *bcm2835_register_p +@@ -1324,6 +1326,9 @@ static struct clk_hw *bcm2835_register_p init.ops = &bcm2835_pll_clk_ops; init.flags = pll_data->flags | CLK_IGNORE_UNUSED; @@ -36,7 +36,7 @@ Signed-off-by: Phil Elwell pll = kzalloc(sizeof(*pll), GFP_KERNEL); if (!pll) return NULL; -@@ -1384,9 +1389,11 @@ bcm2835_register_pll_divider(struct bcm2 +@@ -1379,9 +1384,11 @@ bcm2835_register_pll_divider(struct bcm2 divider->div.hw.init = &init; divider->div.table = NULL; @@ -51,7 +51,7 @@ Signed-off-by: Phil Elwell } divider->cprman = cprman; -@@ -1443,6 +1450,15 @@ static struct clk_hw *bcm2835_register_c +@@ -1438,6 +1445,15 @@ static struct clk_hw *bcm2835_register_c init.flags = clock_data->flags | CLK_IGNORE_UNUSED; /* @@ -67,7 +67,7 @@ Signed-off-by: Phil Elwell * Pass the CLK_SET_RATE_PARENT flag if we are allowed to propagate * rate changes on at least of the parents. */ -@@ -2221,6 +2237,8 @@ static const struct bcm2835_clk_desc clk +@@ -2216,6 +2232,8 @@ static const struct bcm2835_clk_desc clk .ctl_reg = CM_PERIICTL), }; @@ -76,7 +76,7 @@ Signed-off-by: Phil Elwell /* * Permanently take a reference on the parent of the SDRAM clock. * -@@ -2240,6 +2258,19 @@ static int bcm2835_mark_sdc_parent_criti +@@ -2235,6 +2253,19 @@ static int bcm2835_mark_sdc_parent_criti return clk_prepare_enable(parent); } @@ -96,7 +96,7 @@ Signed-off-by: Phil Elwell static int bcm2835_clk_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; -@@ -2249,6 +2280,7 @@ static int bcm2835_clk_probe(struct plat +@@ -2244,6 +2275,7 @@ static int bcm2835_clk_probe(struct plat const size_t asize = ARRAY_SIZE(clk_desc_array); const struct cprman_plat_data *pdata; size_t i; @@ -104,7 +104,7 @@ Signed-off-by: Phil Elwell int ret; pdata = of_device_get_match_data(&pdev->dev); -@@ -2267,6 +2299,13 @@ static int bcm2835_clk_probe(struct plat +@@ -2262,6 +2294,13 @@ static int bcm2835_clk_probe(struct plat if (IS_ERR(cprman->regs)) return PTR_ERR(cprman->regs); diff --git a/target/linux/bcm27xx/patches-5.10/950-0024-clk-bcm2835-Read-max-core-clock-from-firmware.patch b/target/linux/bcm27xx/patches-5.10/950-0024-clk-bcm2835-Read-max-core-clock-from-firmware.patch index 8ad9a6edc7..c04f081b9c 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0024-clk-bcm2835-Read-max-core-clock-from-firmware.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0024-clk-bcm2835-Read-max-core-clock-from-firmware.patch @@ -50,7 +50,7 @@ Signed-off-by: Phil Elwell spinlock_t regs_lock; /* spinlock for all clocks */ unsigned int soc; -@@ -1016,6 +1020,30 @@ static unsigned long bcm2835_clock_get_r +@@ -1011,6 +1015,30 @@ static unsigned long bcm2835_clock_get_r return bcm2835_clock_rate_from_divisor(clock, parent_rate, div); } @@ -81,7 +81,7 @@ Signed-off-by: Phil Elwell static void bcm2835_clock_wait_busy(struct bcm2835_clock *clock) { struct bcm2835_cprman *cprman = clock->cprman; -@@ -1304,7 +1332,7 @@ static int bcm2835_vpu_clock_is_on(struc +@@ -1299,7 +1327,7 @@ static int bcm2835_vpu_clock_is_on(struc */ static const struct clk_ops bcm2835_vpu_clock_clk_ops = { .is_prepared = bcm2835_vpu_clock_is_on, @@ -90,7 +90,7 @@ Signed-off-by: Phil Elwell .set_rate = bcm2835_clock_set_rate, .determine_rate = bcm2835_clock_determine_rate, .set_parent = bcm2835_clock_set_parent, -@@ -2279,6 +2307,7 @@ static int bcm2835_clk_probe(struct plat +@@ -2274,6 +2302,7 @@ static int bcm2835_clk_probe(struct plat const struct bcm2835_clk_desc *desc; const size_t asize = ARRAY_SIZE(clk_desc_array); const struct cprman_plat_data *pdata; @@ -98,7 +98,7 @@ Signed-off-by: Phil Elwell size_t i; u32 clk_id; int ret; -@@ -2299,6 +2328,14 @@ static int bcm2835_clk_probe(struct plat +@@ -2294,6 +2323,14 @@ static int bcm2835_clk_probe(struct plat if (IS_ERR(cprman->regs)) return PTR_ERR(cprman->regs); diff --git a/target/linux/bcm27xx/patches-5.10/950-0028-mm-Remove-the-PFN-busy-warning.patch b/target/linux/bcm27xx/patches-5.10/950-0028-mm-Remove-the-PFN-busy-warning.patch index 6d12c3f308..a73afa80f1 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0028-mm-Remove-the-PFN-busy-warning.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0028-mm-Remove-the-PFN-busy-warning.patch @@ -14,7 +14,7 @@ Signed-off-by: Eric Anholt --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -8594,8 +8594,6 @@ int alloc_contig_range(unsigned long sta +@@ -8596,8 +8596,6 @@ int alloc_contig_range(unsigned long sta /* Make sure the range is really isolated. */ if (test_pages_isolated(outer_start, end, 0)) { diff --git a/target/linux/bcm27xx/patches-5.10/950-0031-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch b/target/linux/bcm27xx/patches-5.10/950-0031-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch index ffd59bc969..20f4d8b218 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0031-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0031-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch @@ -14,7 +14,7 @@ use the same logic. --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -2599,7 +2599,12 @@ static int pl011_setup_port(struct devic +@@ -2578,7 +2578,12 @@ static int pl011_setup_port(struct devic if (IS_ERR(base)) return PTR_ERR(base); diff --git a/target/linux/bcm27xx/patches-5.10/950-0032-amba_pl011-Round-input-clock-up.patch b/target/linux/bcm27xx/patches-5.10/950-0032-amba_pl011-Round-input-clock-up.patch index 9a9b345b67..fe2fc62139 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0032-amba_pl011-Round-input-clock-up.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0032-amba_pl011-Round-input-clock-up.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell /* Clear pending error and receive interrupts */ pl011_write(UART011_OEIS | UART011_BEIS | UART011_PEIS | -@@ -2313,7 +2330,7 @@ static int pl011_console_setup(struct co +@@ -2292,7 +2309,7 @@ static int pl011_console_setup(struct co plat->init(); } @@ -68,7 +68,7 @@ Signed-off-by: Phil Elwell if (uap->vendor->fixed_options) { baud = uap->fixed_baud; -@@ -2530,6 +2547,7 @@ static struct uart_driver amba_reg = { +@@ -2509,6 +2526,7 @@ static struct uart_driver amba_reg = { .cons = AMBA_CONSOLE, }; @@ -76,7 +76,7 @@ Signed-off-by: Phil Elwell static int pl011_probe_dt_alias(int index, struct device *dev) { struct device_node *np; -@@ -2561,6 +2579,7 @@ static int pl011_probe_dt_alias(int inde +@@ -2540,6 +2558,7 @@ static int pl011_probe_dt_alias(int inde return ret; } diff --git a/target/linux/bcm27xx/patches-5.10/950-0034-amba_pl011-Add-cts-event-workaround-DT-property.patch b/target/linux/bcm27xx/patches-5.10/950-0034-amba_pl011-Add-cts-event-workaround-DT-property.patch index 08ce5b4bf6..07b9784068 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0034-amba_pl011-Add-cts-event-workaround-DT-property.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0034-amba_pl011-Add-cts-event-workaround-DT-property.patch @@ -36,7 +36,7 @@ Signed-off-by: Phil Elwell - reg --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -2686,6 +2686,11 @@ static int pl011_probe(struct amba_devic +@@ -2665,6 +2665,11 @@ static int pl011_probe(struct amba_devic if (IS_ERR(uap->clk)) return PTR_ERR(uap->clk); diff --git a/target/linux/bcm27xx/patches-5.10/950-0036-tty-amba-pl011-Add-un-throttle-support.patch b/target/linux/bcm27xx/patches-5.10/950-0036-tty-amba-pl011-Add-un-throttle-support.patch index 35d0aba042..c7ab6931f7 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0036-tty-amba-pl011-Add-un-throttle-support.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0036-tty-amba-pl011-Add-un-throttle-support.patch @@ -50,7 +50,7 @@ Signed-off-by: Phil Elwell static void pl011_stop_rx(struct uart_port *port) { struct uart_amba_port *uap = -@@ -2156,6 +2182,8 @@ static const struct uart_ops amba_pl011_ +@@ -2139,6 +2165,8 @@ static const struct uart_ops amba_pl011_ .stop_tx = pl011_stop_tx, .start_tx = pl011_start_tx, .stop_rx = pl011_stop_rx, diff --git a/target/linux/bcm27xx/patches-5.10/950-0040-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-5.10/950-0040-Add-dwc_otg-driver.patch index c0a315042a..0339ca6956 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0040-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0040-Add-dwc_otg-driver.patch @@ -1123,7 +1123,7 @@ Signed-off-by: Jonathan Bell } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5503,7 +5503,7 @@ static void port_event(struct usb_hub *h +@@ -5506,7 +5506,7 @@ static void port_event(struct usb_hub *h port_dev->over_current_count++; port_over_current_notify(port_dev); diff --git a/target/linux/bcm27xx/patches-5.10/950-0117-clk-clk-bcm2835-Use-zd-when-printing-size_t.patch b/target/linux/bcm27xx/patches-5.10/950-0117-clk-clk-bcm2835-Use-zd-when-printing-size_t.patch index 0a984fb404..779c1a9e8e 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0117-clk-clk-bcm2835-Use-zd-when-printing-size_t.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0117-clk-clk-bcm2835-Use-zd-when-printing-size_t.patch @@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -2382,7 +2382,7 @@ static int bcm2835_clk_probe(struct plat +@@ -2377,7 +2377,7 @@ static int bcm2835_clk_probe(struct plat return ret; /* note that we have registered all the clocks */ diff --git a/target/linux/bcm27xx/patches-5.10/950-0131-bcmgenet-Better-coalescing-parameter-defaults.patch b/target/linux/bcm27xx/patches-5.10/950-0131-bcmgenet-Better-coalescing-parameter-defaults.patch index 09164c714d..5a37f84e17 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0131-bcmgenet-Better-coalescing-parameter-defaults.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0131-bcmgenet-Better-coalescing-parameter-defaults.patch @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /* Disable rate control for now */ bcmgenet_tdma_ring_writel(priv, index, flow_period_val, TDMA_FLOW_PERIOD); -@@ -4058,9 +4058,12 @@ static int bcmgenet_probe(struct platfor +@@ -4060,9 +4060,12 @@ static int bcmgenet_probe(struct platfor netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); /* Set default coalescing parameters */ diff --git a/target/linux/bcm27xx/patches-5.10/950-0136-clk-bcm2835-Add-support-for-setting-leaf-clock-rates.patch b/target/linux/bcm27xx/patches-5.10/950-0136-clk-bcm2835-Add-support-for-setting-leaf-clock-rates.patch index 4ad140bbbb..83df1fd0f2 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0136-clk-bcm2835-Add-support-for-setting-leaf-clock-rates.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0136-clk-bcm2835-Add-support-for-setting-leaf-clock-rates.patch @@ -14,7 +14,7 @@ Signed-off-by: Eric Anholt --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1115,15 +1115,19 @@ static int bcm2835_clock_set_rate(struct +@@ -1110,15 +1110,19 @@ static int bcm2835_clock_set_rate(struct spin_lock(&cprman->regs_lock); @@ -42,7 +42,7 @@ Signed-off-by: Eric Anholt ctl |= (div & CM_DIV_FRAC_MASK) ? CM_FRAC : 0; cprman_write(cprman, data->ctl_reg, ctl); -@@ -1499,7 +1503,7 @@ static struct clk_hw *bcm2835_register_c +@@ -1494,7 +1498,7 @@ static struct clk_hw *bcm2835_register_c init.ops = &bcm2835_vpu_clock_clk_ops; } else { init.ops = &bcm2835_clock_clk_ops; diff --git a/target/linux/bcm27xx/patches-5.10/950-0137-clk-bcm2835-Allow-reparenting-leaf-clocks-while-they.patch b/target/linux/bcm27xx/patches-5.10/950-0137-clk-bcm2835-Allow-reparenting-leaf-clocks-while-they.patch index 093548898d..4d93d72437 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0137-clk-bcm2835-Allow-reparenting-leaf-clocks-while-they.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0137-clk-bcm2835-Allow-reparenting-leaf-clocks-while-they.patch @@ -15,7 +15,7 @@ Signed-off-by: Eric Anholt --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1104,8 +1104,10 @@ static int bcm2835_clock_on(struct clk_h +@@ -1099,8 +1099,10 @@ static int bcm2835_clock_on(struct clk_h return 0; } @@ -28,7 +28,7 @@ Signed-off-by: Eric Anholt { struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); struct bcm2835_cprman *cprman = clock->cprman; -@@ -1127,6 +1129,11 @@ static int bcm2835_clock_set_rate(struct +@@ -1122,6 +1124,11 @@ static int bcm2835_clock_set_rate(struct bcm2835_clock_wait_busy(clock); } @@ -40,7 +40,7 @@ Signed-off-by: Eric Anholt ctl &= ~CM_FRAC; ctl |= (div & CM_DIV_FRAC_MASK) ? CM_FRAC : 0; cprman_write(cprman, data->ctl_reg, ctl); -@@ -1138,6 +1145,12 @@ static int bcm2835_clock_set_rate(struct +@@ -1133,6 +1140,12 @@ static int bcm2835_clock_set_rate(struct return 0; } @@ -53,7 +53,7 @@ Signed-off-by: Eric Anholt static bool bcm2835_clk_is_pllc(struct clk_hw *hw) { -@@ -1321,6 +1334,7 @@ static const struct clk_ops bcm2835_cloc +@@ -1316,6 +1329,7 @@ static const struct clk_ops bcm2835_cloc .unprepare = bcm2835_clock_off, .recalc_rate = bcm2835_clock_get_rate, .set_rate = bcm2835_clock_set_rate, @@ -61,7 +61,7 @@ Signed-off-by: Eric Anholt .determine_rate = bcm2835_clock_determine_rate, .set_parent = bcm2835_clock_set_parent, .get_parent = bcm2835_clock_get_parent, -@@ -1503,7 +1517,6 @@ static struct clk_hw *bcm2835_register_c +@@ -1498,7 +1512,6 @@ static struct clk_hw *bcm2835_register_c init.ops = &bcm2835_vpu_clock_clk_ops; } else { init.ops = &bcm2835_clock_clk_ops; diff --git a/target/linux/bcm27xx/patches-5.10/950-0147-clk-bcm2835-Avoid-null-pointer-exception.patch b/target/linux/bcm27xx/patches-5.10/950-0147-clk-bcm2835-Avoid-null-pointer-exception.patch index 29613d1a40..6bb90962d4 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0147-clk-bcm2835-Avoid-null-pointer-exception.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0147-clk-bcm2835-Avoid-null-pointer-exception.patch @@ -12,7 +12,7 @@ Signed-off-by: popcornmix --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -2310,9 +2310,11 @@ static bool bcm2835_clk_is_claimed(const +@@ -2305,9 +2305,11 @@ static bool bcm2835_clk_is_claimed(const int i; for (i = 0; i < ARRAY_SIZE(clk_desc_array); i++) { diff --git a/target/linux/bcm27xx/patches-5.10/950-0178-clk-bcm2835-Disable-v3d-clock.patch b/target/linux/bcm27xx/patches-5.10/950-0178-clk-bcm2835-Disable-v3d-clock.patch index b1e46d95cb..076cdf3f3e 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0178-clk-bcm2835-Disable-v3d-clock.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0178-clk-bcm2835-Disable-v3d-clock.patch @@ -12,7 +12,7 @@ Signed-off-by: popcornmix --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1741,16 +1741,12 @@ static const struct bcm2835_clk_desc clk +@@ -1736,16 +1736,12 @@ static const struct bcm2835_clk_desc clk .hold_mask = CM_PLLA_HOLDCORE, .fixed_divider = 1, .flags = CLK_SET_RATE_PARENT), @@ -35,7 +35,7 @@ Signed-off-by: popcornmix [BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV( SOC_ALL, .name = "plla_dsi0", -@@ -2051,14 +2047,12 @@ static const struct bcm2835_clk_desc clk +@@ -2046,14 +2042,12 @@ static const struct bcm2835_clk_desc clk .int_bits = 6, .frac_bits = 0, .tcnt_mux = 3), diff --git a/target/linux/bcm27xx/patches-5.10/950-0183-Initialise-rpi-firmware-before-clk-bcm2835.patch b/target/linux/bcm27xx/patches-5.10/950-0183-Initialise-rpi-firmware-before-clk-bcm2835.patch index 0caa234fd4..33a9c56dec 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0183-Initialise-rpi-firmware-before-clk-bcm2835.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0183-Initialise-rpi-firmware-before-clk-bcm2835.patch @@ -25,7 +25,7 @@ Co-authored-by: Phil Elwell --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -2429,7 +2429,7 @@ static int __init __bcm2835_clk_driver_i +@@ -2424,7 +2424,7 @@ static int __init __bcm2835_clk_driver_i { return platform_driver_register(&bcm2835_clk_driver); } diff --git a/target/linux/bcm27xx/patches-5.10/950-0310-vc4_hdmi-Remove-cec_available-flag-as-always-support.patch b/target/linux/bcm27xx/patches-5.10/950-0310-vc4_hdmi-Remove-cec_available-flag-as-always-support.patch index f3eaa06825..2f2199e722 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0310-vc4_hdmi-Remove-cec_available-flag-as-always-support.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0310-vc4_hdmi-Remove-cec_available-flag-as-always-support.patch @@ -12,7 +12,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1490,9 +1490,6 @@ static int vc4_hdmi_cec_init(struct vc4_ +@@ -1497,9 +1497,6 @@ static int vc4_hdmi_cec_init(struct vc4_ u32 value; int ret; @@ -22,7 +22,7 @@ Signed-off-by: Dom Cobley vc4_hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops, vc4_hdmi, "vc4", CEC_CAP_DEFAULTS | -@@ -1912,7 +1909,6 @@ static const struct vc4_hdmi_variant bcm +@@ -1934,7 +1931,6 @@ static const struct vc4_hdmi_variant bcm .debugfs_name = "hdmi_regs", .card_name = "vc4-hdmi", .max_pixel_clock = 162000000, diff --git a/target/linux/bcm27xx/patches-5.10/950-0313-vc4_hdmi-Set-HDMI_MAI_FMT.patch b/target/linux/bcm27xx/patches-5.10/950-0313-vc4_hdmi-Set-HDMI_MAI_FMT.patch index a1f423cefb..3cebccc100 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0313-vc4_hdmi-Set-HDMI_MAI_FMT.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0313-vc4_hdmi-Set-HDMI_MAI_FMT.patch @@ -14,7 +14,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -988,6 +988,44 @@ static void vc4_hdmi_audio_shutdown(stru +@@ -989,6 +989,44 @@ static void vc4_hdmi_audio_shutdown(stru vc4_hdmi->audio.substream = NULL; } @@ -59,7 +59,7 @@ Signed-off-by: Dom Cobley /* HDMI audio codec callbacks */ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, -@@ -998,6 +1036,8 @@ static int vc4_hdmi_audio_hw_params(stru +@@ -999,6 +1037,8 @@ static int vc4_hdmi_audio_hw_params(stru struct device *dev = &vc4_hdmi->pdev->dev; u32 audio_packet_config, channel_mask; u32 channel_map; @@ -68,7 +68,7 @@ Signed-off-by: Dom Cobley if (substream != vc4_hdmi->audio.substream) return -EINVAL; -@@ -1018,6 +1058,14 @@ static int vc4_hdmi_audio_hw_params(stru +@@ -1019,6 +1059,14 @@ static int vc4_hdmi_audio_hw_params(stru vc4_hdmi_audio_set_mai_clock(vc4_hdmi); diff --git a/target/linux/bcm27xx/patches-5.10/950-0314-drm-vc4-add-iec958-controls-to-vc4_hdmi.patch b/target/linux/bcm27xx/patches-5.10/950-0314-drm-vc4-add-iec958-controls-to-vc4_hdmi.patch index 9369658500..c5caa739b2 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0314-drm-vc4-add-iec958-controls-to-vc4_hdmi.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0314-drm-vc4-add-iec958-controls-to-vc4_hdmi.patch @@ -26,7 +26,7 @@ Signed-off-by: Matthias Reichl #include #include #include -@@ -1179,6 +1180,47 @@ static int vc4_hdmi_audio_eld_ctl_get(st +@@ -1180,6 +1181,47 @@ static int vc4_hdmi_audio_eld_ctl_get(st return 0; } @@ -74,7 +74,7 @@ Signed-off-by: Matthias Reichl static const struct snd_kcontrol_new vc4_hdmi_audio_controls[] = { { .access = SNDRV_CTL_ELEM_ACCESS_READ | -@@ -1188,6 +1230,19 @@ static const struct snd_kcontrol_new vc4 +@@ -1189,6 +1231,19 @@ static const struct snd_kcontrol_new vc4 .info = vc4_hdmi_audio_eld_ctl_info, .get = vc4_hdmi_audio_eld_ctl_get, }, @@ -94,7 +94,7 @@ Signed-off-by: Matthias Reichl }; static const struct snd_soc_dapm_widget vc4_hdmi_audio_widgets[] = { -@@ -1308,6 +1363,11 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1309,6 +1364,11 @@ static int vc4_hdmi_audio_init(struct vc vc4_hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; vc4_hdmi->audio.dma_data.maxburst = 2; diff --git a/target/linux/bcm27xx/patches-5.10/950-0315-drm-vc4-move-setup-from-hw_params-to-prepare.patch b/target/linux/bcm27xx/patches-5.10/950-0315-drm-vc4-move-setup-from-hw_params-to-prepare.patch index cfe27b866a..1097180176 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0315-drm-vc4-move-setup-from-hw_params-to-prepare.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0315-drm-vc4-move-setup-from-hw_params-to-prepare.patch @@ -14,7 +14,7 @@ Signed-off-by: Matthias Reichl --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1028,9 +1028,8 @@ static int sample_rate_to_mai_fmt(int sa +@@ -1029,9 +1029,8 @@ static int sample_rate_to_mai_fmt(int sa } /* HDMI audio codec callbacks */ @@ -26,7 +26,7 @@ Signed-off-by: Matthias Reichl { struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai); struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base; -@@ -1043,12 +1042,15 @@ static int vc4_hdmi_audio_hw_params(stru +@@ -1044,12 +1043,15 @@ static int vc4_hdmi_audio_hw_params(stru if (substream != vc4_hdmi->audio.substream) return -EINVAL; @@ -47,7 +47,7 @@ Signed-off-by: Matthias Reichl HDMI_WRITE(HDMI_MAI_CTL, VC4_HD_MAI_CTL_RESET | -@@ -1270,7 +1272,7 @@ static const struct snd_soc_component_dr +@@ -1271,7 +1273,7 @@ static const struct snd_soc_component_dr static const struct snd_soc_dai_ops vc4_hdmi_audio_dai_ops = { .startup = vc4_hdmi_audio_startup, .shutdown = vc4_hdmi_audio_shutdown, diff --git a/target/linux/bcm27xx/patches-5.10/950-0316-drm-vc4-enable-HBR-MAI-format-on-HBR-streams.patch b/target/linux/bcm27xx/patches-5.10/950-0316-drm-vc4-enable-HBR-MAI-format-on-HBR-streams.patch index f48a12bd6e..b700930c81 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0316-drm-vc4-enable-HBR-MAI-format-on-HBR-streams.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0316-drm-vc4-enable-HBR-MAI-format-on-HBR-streams.patch @@ -10,7 +10,7 @@ Signed-off-by: Matthias Reichl --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1062,7 +1062,11 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1063,7 +1063,11 @@ static int vc4_hdmi_audio_prepare(struct vc4_hdmi_audio_set_mai_clock(vc4_hdmi); mai_sample_rate = sample_rate_to_mai_fmt(vc4_hdmi->audio.samplerate); diff --git a/target/linux/bcm27xx/patches-5.10/950-0317-vc4_hdmi-Remove-firmware-logic-for-MAI-threshold-set.patch b/target/linux/bcm27xx/patches-5.10/950-0317-vc4_hdmi-Remove-firmware-logic-for-MAI-threshold-set.patch index 96b5456d4b..8f16329b04 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0317-vc4_hdmi-Remove-firmware-logic-for-MAI-threshold-set.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0317-vc4_hdmi-Remove-firmware-logic-for-MAI-threshold-set.patch @@ -16,7 +16,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1083,22 +1083,12 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1084,22 +1084,12 @@ static int vc4_hdmi_audio_prepare(struct audio_packet_config |= VC4_SET_FIELD(channel_mask, VC4_HDMI_AUDIO_PACKET_CEA_MASK); diff --git a/target/linux/bcm27xx/patches-5.10/950-0318-vc_hdmi-Set-VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE.patch b/target/linux/bcm27xx/patches-5.10/950-0318-vc_hdmi-Set-VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE.patch index c5e1baa02b..6f09dac588 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0318-vc_hdmi-Set-VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0318-vc_hdmi-Set-VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE.patch @@ -14,7 +14,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1092,6 +1092,7 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1093,6 +1093,7 @@ static int vc4_hdmi_audio_prepare(struct HDMI_WRITE(HDMI_MAI_CONFIG, VC4_HDMI_MAI_CONFIG_BIT_REVERSE | diff --git a/target/linux/bcm27xx/patches-5.10/950-0334-net-bcmgenet-Reset-RBUF-on-first-open.patch b/target/linux/bcm27xx/patches-5.10/950-0334-net-bcmgenet-Reset-RBUF-on-first-open.patch index 7a6cc54f4c..78bbc10649 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0334-net-bcmgenet-Reset-RBUF-on-first-open.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0334-net-bcmgenet-Reset-RBUF-on-first-open.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell /* Reinitialize TDMA and RDMA and SW housekeeping */ ret = bcmgenet_init_dma(priv); -@@ -4187,7 +4195,7 @@ static int bcmgenet_resume(struct device +@@ -4189,7 +4197,7 @@ static int bcmgenet_resume(struct device bcmgenet_hfb_create_rxnfc_filter(priv, rule); /* Disable RX/TX DMA and flush TX queues */ diff --git a/target/linux/bcm27xx/patches-5.10/950-0346-drm-vc4-A-present-but-empty-dmas-disables-audio.patch b/target/linux/bcm27xx/patches-5.10/950-0346-drm-vc4-A-present-but-empty-dmas-disables-audio.patch index 9e32fc4b4c..0c104b1788 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0346-drm-vc4-A-present-but-empty-dmas-disables-audio.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0346-drm-vc4-A-present-but-empty-dmas-disables-audio.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1330,10 +1330,12 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1331,10 +1331,12 @@ static int vc4_hdmi_audio_init(struct vc const __be32 *addr; int index; int ret; diff --git a/target/linux/bcm27xx/patches-5.10/950-0349-drm-vc4-Add-all-the-HDMI-registers-into-the-debugfs-.patch b/target/linux/bcm27xx/patches-5.10/950-0349-drm-vc4-Add-all-the-HDMI-registers-into-the-debugfs-.patch index ecbefd2546..0aa1d2e48e 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0349-drm-vc4-Add-all-the-HDMI-registers-into-the-debugfs-.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0349-drm-vc4-Add-all-the-HDMI-registers-into-the-debugfs-.patch @@ -16,7 +16,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -91,6 +91,12 @@ static int vc4_hdmi_debugfs_regs(struct +@@ -92,6 +92,12 @@ static int vc4_hdmi_debugfs_regs(struct drm_print_regset32(&p, &vc4_hdmi->hdmi_regset); drm_print_regset32(&p, &vc4_hdmi->hd_regset); @@ -29,7 +29,7 @@ Signed-off-by: Dave Stevenson return 0; } -@@ -1731,6 +1737,7 @@ static int vc5_hdmi_init_resources(struc +@@ -1740,6 +1746,7 @@ static int vc5_hdmi_init_resources(struc struct platform_device *pdev = vc4_hdmi->pdev; struct device *dev = &pdev->dev; struct resource *res; @@ -37,7 +37,7 @@ Signed-off-by: Dave Stevenson res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi"); if (!res) -@@ -1821,6 +1828,38 @@ static int vc5_hdmi_init_resources(struc +@@ -1830,6 +1837,38 @@ static int vc5_hdmi_init_resources(struc return PTR_ERR(vc4_hdmi->reset); } diff --git a/target/linux/bcm27xx/patches-5.10/950-0377-vc4_hdmi-Report-that-3d-stereo-is-allowed.patch b/target/linux/bcm27xx/patches-5.10/950-0377-vc4_hdmi-Report-that-3d-stereo-is-allowed.patch index 1fdc3a0123..67f2bf3582 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0377-vc4_hdmi-Report-that-3d-stereo-is-allowed.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0377-vc4_hdmi-Report-that-3d-stereo-is-allowed.patch @@ -10,7 +10,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -256,6 +256,7 @@ static int vc4_hdmi_connector_init(struc +@@ -257,6 +257,7 @@ static int vc4_hdmi_connector_init(struc connector->interlace_allowed = 1; connector->doublescan_allowed = 0; diff --git a/target/linux/bcm27xx/patches-5.10/950-0379-vc4-Clear-unused-infoframe-packet-RAM-registers.patch b/target/linux/bcm27xx/patches-5.10/950-0379-vc4-Clear-unused-infoframe-packet-RAM-registers.patch index 93ec210795..fdc29cf586 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0379-vc4-Clear-unused-infoframe-packet-RAM-registers.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0379-vc4-Clear-unused-infoframe-packet-RAM-registers.patch @@ -16,7 +16,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -284,9 +284,11 @@ static void vc4_hdmi_write_infoframe(str +@@ -285,9 +285,11 @@ static void vc4_hdmi_write_infoframe(str const struct vc4_hdmi_register *ram_packet_start = &vc4_hdmi->variant->registers[HDMI_RAM_PACKET_START]; u32 packet_reg = ram_packet_start->offset + VC4_HDMI_PACKET_STRIDE * packet_id; @@ -29,7 +29,7 @@ Signed-off-by: Dom Cobley ssize_t len, i; int ret; -@@ -319,6 +321,13 @@ static void vc4_hdmi_write_infoframe(str +@@ -320,6 +322,13 @@ static void vc4_hdmi_write_infoframe(str packet_reg += 4; } diff --git a/target/linux/bcm27xx/patches-5.10/950-0408-drm-atomic-Pass-the-full-state-to-CRTC-atomic-enable.patch b/target/linux/bcm27xx/patches-5.10/950-0408-drm-atomic-Pass-the-full-state-to-CRTC-atomic-enable.patch index a1697f4b44..28bd9095d0 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0408-drm-atomic-Pass-the-full-state-to-CRTC-atomic-enable.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0408-drm-atomic-Pass-the-full-state-to-CRTC-atomic-enable.patch @@ -756,7 +756,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef1 } --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c -@@ -710,7 +710,7 @@ static int rcar_du_crtc_atomic_check(str +@@ -716,7 +716,7 @@ static int rcar_du_crtc_atomic_check(str } static void rcar_du_crtc_atomic_enable(struct drm_crtc *crtc, @@ -765,7 +765,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef1 { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); struct rcar_du_crtc_state *rstate = to_rcar_crtc_state(crtc->state); -@@ -745,8 +745,10 @@ static void rcar_du_crtc_atomic_enable(s +@@ -751,8 +751,10 @@ static void rcar_du_crtc_atomic_enable(s } static void rcar_du_crtc_atomic_disable(struct drm_crtc *crtc, diff --git a/target/linux/bcm27xx/patches-5.10/950-0409-drm-atomic-Pass-the-full-state-to-CRTC-atomic_check.patch b/target/linux/bcm27xx/patches-5.10/950-0409-drm-atomic-Pass-the-full-state-to-CRTC-atomic_check.patch index df4209f047..27e44d9074 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0409-drm-atomic-Pass-the-full-state-to-CRTC-atomic_check.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0409-drm-atomic-Pass-the-full-state-to-CRTC-atomic_check.patch @@ -201,7 +201,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-max --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -5602,17 +5602,19 @@ static void dm_update_crtc_active_planes +@@ -5605,17 +5605,19 @@ static void dm_update_crtc_active_planes } static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc, @@ -225,7 +225,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-max WARN_ON(1); return ret; } -@@ -5623,8 +5625,8 @@ static int dm_crtc_helper_atomic_check(s +@@ -5626,8 +5628,8 @@ static int dm_crtc_helper_atomic_check(s * planes are disabled, which is not supported by the hardware. And there is legacy * userspace which stops using the HW cursor altogether in response to the resulting EINVAL. */ @@ -724,7 +724,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-max omap_crtc_state->zpos = pri_state->zpos; --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c -@@ -682,20 +682,23 @@ static void rcar_du_crtc_stop(struct rca +@@ -688,20 +688,23 @@ static void rcar_du_crtc_stop(struct rca */ static int rcar_du_crtc_atomic_check(struct drm_crtc *crtc, diff --git a/target/linux/bcm27xx/patches-5.10/950-0410-drm-atomic-Pass-the-full-state-to-CRTC-atomic-begin-.patch b/target/linux/bcm27xx/patches-5.10/950-0410-drm-atomic-Pass-the-full-state-to-CRTC-atomic-begin-.patch index 48fe8da760..31aadcb31a 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0410-drm-atomic-Pass-the-full-state-to-CRTC-atomic-begin-.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0410-drm-atomic-Pass-the-full-state-to-CRTC-atomic-begin-.patch @@ -719,7 +719,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-max } --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c -@@ -779,7 +779,7 @@ static void rcar_du_crtc_atomic_disable( +@@ -785,7 +785,7 @@ static void rcar_du_crtc_atomic_disable( } static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc, @@ -728,7 +728,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-max { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); -@@ -808,7 +808,7 @@ static void rcar_du_crtc_atomic_begin(st +@@ -814,7 +814,7 @@ static void rcar_du_crtc_atomic_begin(st } static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc, diff --git a/target/linux/bcm27xx/patches-5.10/950-0412-drm-vc4-Pass-the-atomic-state-to-encoder-hooks.patch b/target/linux/bcm27xx/patches-5.10/950-0412-drm-vc4-Pass-the-atomic-state-to-encoder-hooks.patch index a887097301..38f354f963 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0412-drm-vc4-Pass-the-atomic-state-to-encoder-hooks.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0412-drm-vc4-Pass-the-atomic-state-to-encoder-hooks.patch @@ -109,7 +109,7 @@ Signed-off-by: Maxime Ripard static inline struct vc4_encoder * --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -411,7 +411,8 @@ static void vc4_hdmi_set_infoframes(stru +@@ -412,7 +412,8 @@ static void vc4_hdmi_set_infoframes(stru vc4_hdmi_set_audio_infoframe(encoder); } @@ -119,7 +119,7 @@ Signed-off-by: Maxime Ripard { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); -@@ -424,7 +425,8 @@ static void vc4_hdmi_encoder_post_crtc_d +@@ -425,7 +426,8 @@ static void vc4_hdmi_encoder_post_crtc_d HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_BLANKPIX); } @@ -129,7 +129,7 @@ Signed-off-by: Maxime Ripard { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); int ret; -@@ -637,7 +639,8 @@ static void vc4_hdmi_recenter_fifo(struc +@@ -638,7 +640,8 @@ static void vc4_hdmi_recenter_fifo(struc "VC4_HDMI_FIFO_CTL_RECENTER_DONE"); } @@ -139,7 +139,7 @@ Signed-off-by: Maxime Ripard { struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); -@@ -719,7 +722,8 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -720,7 +723,8 @@ static void vc4_hdmi_encoder_pre_crtc_co vc4_hdmi->variant->set_timings(vc4_hdmi, mode); } @@ -149,7 +149,7 @@ Signed-off-by: Maxime Ripard { struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); -@@ -741,7 +745,8 @@ static void vc4_hdmi_encoder_pre_crtc_en +@@ -742,7 +746,8 @@ static void vc4_hdmi_encoder_pre_crtc_en HDMI_WRITE(HDMI_FIFO_CTL, VC4_HDMI_FIFO_CTL_MASTER_SLAVE_N); } diff --git a/target/linux/bcm27xx/patches-5.10/950-0413-drm-vc4-hdmi-Don-t-access-the-connector-state-in-res.patch b/target/linux/bcm27xx/patches-5.10/950-0413-drm-vc4-hdmi-Don-t-access-the-connector-state-in-res.patch index 4d0a4e056e..b524ba277e 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0413-drm-vc4-hdmi-Don-t-access-the-connector-state-in-res.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0413-drm-vc4-hdmi-Don-t-access-the-connector-state-in-res.patch @@ -22,7 +22,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -215,7 +215,9 @@ static int vc4_hdmi_connector_get_modes( +@@ -216,7 +216,9 @@ static int vc4_hdmi_connector_get_modes( static void vc4_hdmi_connector_reset(struct drm_connector *connector) { drm_atomic_helper_connector_reset(connector); diff --git a/target/linux/bcm27xx/patches-5.10/950-0414-drm-vc4-hdmi-Create-a-custom-connector-state.patch b/target/linux/bcm27xx/patches-5.10/950-0414-drm-vc4-hdmi-Create-a-custom-connector-state.patch index 31ffe4d5d4..941730e1c8 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0414-drm-vc4-hdmi-Create-a-custom-connector-state.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0414-drm-vc4-hdmi-Create-a-custom-connector-state.patch @@ -18,7 +18,7 @@ Reviewed-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -214,10 +214,37 @@ static int vc4_hdmi_connector_get_modes( +@@ -215,10 +215,37 @@ static int vc4_hdmi_connector_get_modes( static void vc4_hdmi_connector_reset(struct drm_connector *connector) { @@ -58,7 +58,7 @@ Reviewed-by: Dave Stevenson } static const struct drm_connector_funcs vc4_hdmi_connector_funcs = { -@@ -225,7 +252,7 @@ static const struct drm_connector_funcs +@@ -226,7 +253,7 @@ static const struct drm_connector_funcs .fill_modes = drm_helper_probe_single_connector_modes, .destroy = vc4_hdmi_connector_destroy, .reset = vc4_hdmi_connector_reset, diff --git a/target/linux/bcm27xx/patches-5.10/950-0415-drm-vc4-hdmi-Store-pixel-frequency-in-the-connector-.patch b/target/linux/bcm27xx/patches-5.10/950-0415-drm-vc4-hdmi-Store-pixel-frequency-in-the-connector-.patch index ebeadd64f6..5e51b008f3 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0415-drm-vc4-hdmi-Store-pixel-frequency-in-the-connector-.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0415-drm-vc4-hdmi-Store-pixel-frequency-in-the-connector-.patch @@ -21,7 +21,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -242,6 +242,7 @@ vc4_hdmi_connector_duplicate_state(struc +@@ -243,6 +243,7 @@ vc4_hdmi_connector_duplicate_state(struc if (!new_state) return NULL; @@ -29,7 +29,7 @@ Signed-off-by: Maxime Ripard __drm_atomic_helper_connector_duplicate_state(connector, &new_state->base); return &new_state->base; -@@ -668,9 +669,29 @@ static void vc4_hdmi_recenter_fifo(struc +@@ -669,9 +670,29 @@ static void vc4_hdmi_recenter_fifo(struc "VC4_HDMI_FIFO_CTL_RECENTER_DONE"); } @@ -59,7 +59,7 @@ Signed-off-by: Maxime Ripard struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); unsigned long pixel_rate, hsm_rate; -@@ -682,7 +703,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -683,7 +704,7 @@ static void vc4_hdmi_encoder_pre_crtc_co return; } @@ -68,7 +68,7 @@ Signed-off-by: Maxime Ripard ret = clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate); if (ret) { DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); -@@ -844,6 +865,7 @@ static int vc4_hdmi_encoder_atomic_check +@@ -845,6 +866,7 @@ static int vc4_hdmi_encoder_atomic_check struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { @@ -76,7 +76,7 @@ Signed-off-by: Maxime Ripard struct drm_display_mode *mode = &crtc_state->adjusted_mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); unsigned long long pixel_rate = mode->clock * 1000; -@@ -874,6 +896,8 @@ static int vc4_hdmi_encoder_atomic_check +@@ -875,6 +897,8 @@ static int vc4_hdmi_encoder_atomic_check if (pixel_rate > vc4_hdmi->variant->max_pixel_clock) return -EINVAL; diff --git a/target/linux/bcm27xx/patches-5.10/950-0416-drm-vc4-hdmi-Use-the-connector-state-pixel-rate-for-.patch b/target/linux/bcm27xx/patches-5.10/950-0416-drm-vc4-hdmi-Use-the-connector-state-pixel-rate-for-.patch index b1de0c29ee..a4ca7cb6fd 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0416-drm-vc4-hdmi-Use-the-connector-state-pixel-rate-for-.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0416-drm-vc4-hdmi-Use-the-connector-state-pixel-rate-for-.patch @@ -22,7 +22,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -761,7 +761,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -762,7 +762,7 @@ static void vc4_hdmi_encoder_pre_crtc_co } if (vc4_hdmi->variant->phy_init) diff --git a/target/linux/bcm27xx/patches-5.10/950-0417-drm-vc4-hdmi-Enable-10-12-bpc-output.patch b/target/linux/bcm27xx/patches-5.10/950-0417-drm-vc4-hdmi-Enable-10-12-bpc-output.patch index ac821dd45a..69f255627f 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0417-drm-vc4-hdmi-Enable-10-12-bpc-output.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0417-drm-vc4-hdmi-Enable-10-12-bpc-output.patch @@ -34,7 +34,7 @@ Reviewed-by: Dave Stevenson # define VC4_HD_M_SW_RST BIT(2) # define VC4_HD_M_ENABLE BIT(0) -@@ -228,6 +239,8 @@ static void vc4_hdmi_connector_reset(str +@@ -229,6 +240,8 @@ static void vc4_hdmi_connector_reset(str if (!new_state) return; @@ -43,7 +43,7 @@ Reviewed-by: Dave Stevenson drm_atomic_helper_connector_tv_reset(connector); } -@@ -274,12 +287,20 @@ static int vc4_hdmi_connector_init(struc +@@ -275,12 +288,20 @@ static int vc4_hdmi_connector_init(struc vc4_hdmi->ddc); drm_connector_helper_add(connector, &vc4_hdmi_connector_helper_funcs); @@ -64,7 +64,7 @@ Reviewed-by: Dave Stevenson connector->polled = (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT); -@@ -554,6 +575,7 @@ static void vc5_hdmi_csc_setup(struct vc +@@ -555,6 +576,7 @@ static void vc5_hdmi_csc_setup(struct vc } static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, @@ -72,7 +72,7 @@ Reviewed-by: Dave Stevenson struct drm_display_mode *mode) { bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC; -@@ -597,7 +619,9 @@ static void vc4_hdmi_set_timings(struct +@@ -598,7 +620,9 @@ static void vc4_hdmi_set_timings(struct HDMI_WRITE(HDMI_VERTB0, vertb_even); HDMI_WRITE(HDMI_VERTB1, vertb); } @@ -82,7 +82,7 @@ Reviewed-by: Dave Stevenson struct drm_display_mode *mode) { bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC; -@@ -617,6 +641,9 @@ static void vc5_hdmi_set_timings(struct +@@ -618,6 +642,9 @@ static void vc5_hdmi_set_timings(struct mode->crtc_vsync_end - interlaced, VC4_HDMI_VERTB_VBP)); @@ -92,7 +92,7 @@ Reviewed-by: Dave Stevenson HDMI_WRITE(HDMI_VEC_INTERFACE_XBAR, 0x354021); HDMI_WRITE(HDMI_HORZA, -@@ -642,6 +669,39 @@ static void vc5_hdmi_set_timings(struct +@@ -643,6 +670,39 @@ static void vc5_hdmi_set_timings(struct HDMI_WRITE(HDMI_VERTB0, vertb_even); HDMI_WRITE(HDMI_VERTB1, vertb); @@ -132,7 +132,7 @@ Reviewed-by: Dave Stevenson HDMI_WRITE(HDMI_CLOCK_STOP, 0); } -@@ -769,7 +829,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -770,7 +830,7 @@ static void vc4_hdmi_encoder_pre_crtc_co VC4_HDMI_SCHEDULER_CONTROL_IGNORE_VSYNC_PREDICTS); if (vc4_hdmi->variant->set_timings) @@ -141,7 +141,7 @@ Reviewed-by: Dave Stevenson } static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder, -@@ -890,6 +950,14 @@ static int vc4_hdmi_encoder_atomic_check +@@ -891,6 +951,14 @@ static int vc4_hdmi_encoder_atomic_check pixel_rate = mode->clock * 1000; } diff --git a/target/linux/bcm27xx/patches-5.10/950-0456-drm-vc4-hdmi-Update-the-CEC-clock-divider-on-HSM-rat.patch b/target/linux/bcm27xx/patches-5.10/950-0456-drm-vc4-hdmi-Update-the-CEC-clock-divider-on-HSM-rat.patch index 8c64066094..5da8a32528 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0456-drm-vc4-hdmi-Update-the-CEC-clock-divider-on-HSM-rat.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0456-drm-vc4-hdmi-Update-the-CEC-clock-divider-on-HSM-rat.patch @@ -20,7 +20,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -801,6 +801,8 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -802,6 +802,8 @@ static void vc4_hdmi_encoder_pre_crtc_co vc4_hdmi_cec_update_clk_div(vc4_hdmi); diff --git a/target/linux/bcm27xx/patches-5.10/950-0457-drm-vc4-hdmi-Introduce-a-CEC-clock.patch b/target/linux/bcm27xx/patches-5.10/950-0457-drm-vc4-hdmi-Introduce-a-CEC-clock.patch index 52117eec29..a5b127ded7 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0457-drm-vc4-hdmi-Introduce-a-CEC-clock.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0457-drm-vc4-hdmi-Introduce-a-CEC-clock.patch @@ -18,7 +18,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -150,7 +150,7 @@ static void vc4_hdmi_cec_update_clk_div( +@@ -151,7 +151,7 @@ static void vc4_hdmi_cec_update_clk_div( * Set the clock divider: the hsm_clock rate and this divider * setting will give a 40 kHz CEC clock. */ @@ -27,7 +27,7 @@ Signed-off-by: Maxime Ripard value |= clk_cnt << VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT; HDMI_WRITE(HDMI_CEC_CNTRL_1, value); } -@@ -1866,6 +1866,7 @@ static int vc4_hdmi_init_resources(struc +@@ -1875,6 +1875,7 @@ static int vc4_hdmi_init_resources(struc return PTR_ERR(vc4_hdmi->hsm_clock); } vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock; @@ -35,7 +35,7 @@ Signed-off-by: Maxime Ripard return 0; } -@@ -1960,6 +1961,12 @@ static int vc5_hdmi_init_resources(struc +@@ -1969,6 +1970,12 @@ static int vc5_hdmi_init_resources(struc return PTR_ERR(vc4_hdmi->audio_clock); } diff --git a/target/linux/bcm27xx/patches-5.10/950-0458-drm-vc4-hdmi-Split-the-interrupt-handlers.patch b/target/linux/bcm27xx/patches-5.10/950-0458-drm-vc4-hdmi-Split-the-interrupt-handlers.patch index edc67eaae2..7e16acfacc 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0458-drm-vc4-hdmi-Split-the-interrupt-handlers.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0458-drm-vc4-hdmi-Split-the-interrupt-handlers.patch @@ -19,7 +19,7 @@ Reviewed-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1571,15 +1571,22 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1572,15 +1572,22 @@ static int vc4_hdmi_audio_init(struct vc } #ifdef CONFIG_DRM_VC4_HDMI_CEC @@ -48,7 +48,7 @@ Reviewed-by: Dave Stevenson cec_transmit_done(vc4_hdmi->cec_adap, CEC_TX_STATUS_OK, 0, 0, 0, 0); } else { -@@ -1593,6 +1600,19 @@ static irqreturn_t vc4_cec_irq_handler_t +@@ -1594,6 +1601,19 @@ static irqreturn_t vc4_cec_irq_handler_t return IRQ_HANDLED; } @@ -68,7 +68,7 @@ Reviewed-by: Dave Stevenson static void vc4_cec_read_msg(struct vc4_hdmi *vc4_hdmi, u32 cntrl1) { struct drm_device *dev = vc4_hdmi->connector.dev; -@@ -1617,31 +1637,55 @@ static void vc4_cec_read_msg(struct vc4_ +@@ -1618,31 +1638,55 @@ static void vc4_cec_read_msg(struct vc4_ } } diff --git a/target/linux/bcm27xx/patches-5.10/950-0459-drm-vc4-hdmi-Support-BCM2711-CEC-interrupt-setup.patch b/target/linux/bcm27xx/patches-5.10/950-0459-drm-vc4-hdmi-Support-BCM2711-CEC-interrupt-setup.patch index 1e6f1d4c0d..dc7896978f 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0459-drm-vc4-hdmi-Support-BCM2711-CEC-interrupt-setup.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0459-drm-vc4-hdmi-Support-BCM2711-CEC-interrupt-setup.patch @@ -20,7 +20,7 @@ Reviewed-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1722,9 +1722,11 @@ static int vc4_hdmi_cec_adap_enable(stru +@@ -1729,9 +1729,11 @@ static int vc4_hdmi_cec_adap_enable(stru ((3600 / usecs) << VC4_HDMI_CEC_CNT_TO_3600_US_SHIFT) | ((3500 / usecs) << VC4_HDMI_CEC_CNT_TO_3500_US_SHIFT)); @@ -34,7 +34,7 @@ Reviewed-by: Dave Stevenson HDMI_WRITE(HDMI_CEC_CNTRL_5, val | VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET); } -@@ -1796,8 +1798,6 @@ static int vc4_hdmi_cec_init(struct vc4_ +@@ -1803,8 +1805,6 @@ static int vc4_hdmi_cec_init(struct vc4_ cec_fill_conn_info_from_drm(&conn_info, &vc4_hdmi->connector); cec_s_conn_info(vc4_hdmi->cec_adap, &conn_info); @@ -43,7 +43,7 @@ Reviewed-by: Dave Stevenson value = HDMI_READ(HDMI_CEC_CNTRL_1); /* Set the logical address to Unregistered */ value |= VC4_HDMI_CEC_ADDR_MASK; -@@ -1805,12 +1805,32 @@ static int vc4_hdmi_cec_init(struct vc4_ +@@ -1812,12 +1812,32 @@ static int vc4_hdmi_cec_init(struct vc4_ vc4_hdmi_cec_update_clk_div(vc4_hdmi); @@ -82,7 +82,7 @@ Reviewed-by: Dave Stevenson ret = cec_register_adapter(vc4_hdmi->cec_adap, &pdev->dev); if (ret < 0) -@@ -2272,6 +2292,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2294,6 +2314,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_CK, }, .unsupported_odd_h_timings = true, @@ -90,7 +90,7 @@ Reviewed-by: Dave Stevenson .init_resources = vc5_hdmi_init_resources, .csc_setup = vc5_hdmi_csc_setup, -@@ -2298,6 +2319,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2320,6 +2341,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_2, }, .unsupported_odd_h_timings = true, diff --git a/target/linux/bcm27xx/patches-5.10/950-0460-drm-vc4-hdmi-Don-t-register-the-CEC-adapter-if-there.patch b/target/linux/bcm27xx/patches-5.10/950-0460-drm-vc4-hdmi-Don-t-register-the-CEC-adapter-if-there.patch index e20e0be9c3..8b82f7719d 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0460-drm-vc4-hdmi-Don-t-register-the-CEC-adapter-if-there.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0460-drm-vc4-hdmi-Don-t-register-the-CEC-adapter-if-there.patch @@ -19,7 +19,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1784,9 +1784,15 @@ static int vc4_hdmi_cec_init(struct vc4_ +@@ -1791,9 +1791,15 @@ static int vc4_hdmi_cec_init(struct vc4_ { struct cec_connector_info conn_info; struct platform_device *pdev = vc4_hdmi->pdev; diff --git a/target/linux/bcm27xx/patches-5.10/950-0475-drm-vc4-Add-HDR-metadata-property-to-the-VC5-HDMI-co.patch b/target/linux/bcm27xx/patches-5.10/950-0475-drm-vc4-Add-HDR-metadata-property-to-the-VC5-HDMI-co.patch index 3a4d39b612..a70c3bda1e 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0475-drm-vc4-Add-HDR-metadata-property-to-the-VC5-HDMI-co.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0475-drm-vc4-Add-HDR-metadata-property-to-the-VC5-HDMI-co.patch @@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -309,6 +309,10 @@ static int vc4_hdmi_connector_init(struc +@@ -310,6 +310,10 @@ static int vc4_hdmi_connector_init(struc connector->doublescan_allowed = 0; connector->stereo_allowed = 1; @@ -26,7 +26,7 @@ Signed-off-by: Dave Stevenson drm_connector_attach_encoder(connector, encoder); return 0; -@@ -448,6 +452,25 @@ static void vc4_hdmi_set_audio_infoframe +@@ -449,6 +453,25 @@ static void vc4_hdmi_set_audio_infoframe vc4_hdmi_write_infoframe(encoder, &frame); } @@ -52,7 +52,7 @@ Signed-off-by: Dave Stevenson static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); -@@ -460,6 +483,8 @@ static void vc4_hdmi_set_infoframes(stru +@@ -461,6 +484,8 @@ static void vc4_hdmi_set_infoframes(stru */ if (vc4_hdmi->audio.streaming) vc4_hdmi_set_audio_infoframe(encoder); @@ -61,7 +61,7 @@ Signed-off-by: Dave Stevenson } static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder, -@@ -2282,6 +2307,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2304,6 +2329,7 @@ static const struct vc4_hdmi_variant bcm .phy_rng_enable = vc4_hdmi_phy_rng_enable, .phy_rng_disable = vc4_hdmi_phy_rng_disable, .channel_map = vc4_hdmi_channel_map, @@ -69,7 +69,7 @@ Signed-off-by: Dave Stevenson }; static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = { -@@ -2309,6 +2335,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2331,6 +2357,7 @@ static const struct vc4_hdmi_variant bcm .phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_disable = vc5_hdmi_phy_rng_disable, .channel_map = vc5_hdmi_channel_map, @@ -77,7 +77,7 @@ Signed-off-by: Dave Stevenson }; static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { -@@ -2336,6 +2363,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2358,6 +2385,7 @@ static const struct vc4_hdmi_variant bcm .phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_disable = vc5_hdmi_phy_rng_disable, .channel_map = vc5_hdmi_channel_map, diff --git a/target/linux/bcm27xx/patches-5.10/950-0476-drm-vc4-Add-connector-check-to-trigger-mode_change-w.patch b/target/linux/bcm27xx/patches-5.10/950-0476-drm-vc4-Add-connector-check-to-trigger-mode_change-w.patch index 7a200aca3d..e7c85ee125 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0476-drm-vc4-Add-connector-check-to-trigger-mode_change-w.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0476-drm-vc4-Add-connector-check-to-trigger-mode_change-w.patch @@ -11,7 +11,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -223,6 +223,45 @@ static int vc4_hdmi_connector_get_modes( +@@ -224,6 +224,45 @@ static int vc4_hdmi_connector_get_modes( return ret; } @@ -57,7 +57,7 @@ Signed-off-by: Dom Cobley static void vc4_hdmi_connector_reset(struct drm_connector *connector) { struct vc4_hdmi_connector_state *old_state = -@@ -272,6 +311,7 @@ static const struct drm_connector_funcs +@@ -273,6 +312,7 @@ static const struct drm_connector_funcs static const struct drm_connector_helper_funcs vc4_hdmi_connector_helper_funcs = { .get_modes = vc4_hdmi_connector_get_modes, diff --git a/target/linux/bcm27xx/patches-5.10/950-0505-vc4-drm-Avoid-full-hdmi-audio-fifo-writes.patch b/target/linux/bcm27xx/patches-5.10/950-0505-vc4-drm-Avoid-full-hdmi-audio-fifo-writes.patch index 7f9df9b0ff..98e477aecc 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0505-vc4-drm-Avoid-full-hdmi-audio-fifo-writes.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0505-vc4-drm-Avoid-full-hdmi-audio-fifo-writes.patch @@ -15,7 +15,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1294,10 +1294,10 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1295,10 +1295,10 @@ static int vc4_hdmi_audio_prepare(struct /* Set the MAI threshold */ HDMI_WRITE(HDMI_MAI_THR, diff --git a/target/linux/bcm27xx/patches-5.10/950-0527-drm-connector-Create-a-helper-to-attach-the-hdr_outp.patch b/target/linux/bcm27xx/patches-5.10/950-0527-drm-connector-Create-a-helper-to-attach-the-hdr_outp.patch index ea71da185f..bf5df6afc1 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0527-drm-connector-Create-a-helper-to-attach-the-hdr_outp.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0527-drm-connector-Create-a-helper-to-attach-the-hdr_outp.patch @@ -22,7 +22,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -6525,9 +6525,7 @@ void amdgpu_dm_connector_init_helper(str +@@ -6528,9 +6528,7 @@ void amdgpu_dm_connector_init_helper(str if (connector_type == DRM_MODE_CONNECTOR_HDMIA || connector_type == DRM_MODE_CONNECTOR_DisplayPort || connector_type == DRM_MODE_CONNECTOR_eDP) { @@ -35,7 +35,7 @@ Signed-off-by: Maxime Ripard drm_connector_attach_vrr_capable_property(&aconnector->base); --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2492,8 +2492,7 @@ static int dw_hdmi_connector_create(stru +@@ -2500,8 +2500,7 @@ static int dw_hdmi_connector_create(stru drm_connector_attach_max_bpc_property(connector, 8, 16); if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) diff --git a/target/linux/bcm27xx/patches-5.10/950-0528-drm-connector-Add-helper-to-compare-HDR-metadata.patch b/target/linux/bcm27xx/patches-5.10/950-0528-drm-connector-Add-helper-to-compare-HDR-metadata.patch index 00e8200e53..3e61bb486e 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0528-drm-connector-Add-helper-to-compare-HDR-metadata.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0528-drm-connector-Add-helper-to-compare-HDR-metadata.patch @@ -21,7 +21,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -5473,25 +5473,6 @@ static int fill_hdr_info_packet(const st +@@ -5476,25 +5476,6 @@ static int fill_hdr_info_packet(const st return 0; } @@ -47,7 +47,7 @@ Signed-off-by: Maxime Ripard static int amdgpu_dm_connector_atomic_check(struct drm_connector *conn, struct drm_atomic_state *state) -@@ -5507,7 +5488,7 @@ amdgpu_dm_connector_atomic_check(struct +@@ -5510,7 +5491,7 @@ amdgpu_dm_connector_atomic_check(struct if (!crtc) return 0; @@ -58,7 +58,7 @@ Signed-off-by: Maxime Ripard ret = fill_hdr_info_packet(new_con_state, &hdr_infopacket); --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2395,21 +2395,6 @@ static int dw_hdmi_connector_get_modes(s +@@ -2403,21 +2403,6 @@ static int dw_hdmi_connector_get_modes(s return ret; } @@ -80,7 +80,7 @@ Signed-off-by: Maxime Ripard static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, struct drm_atomic_state *state) { -@@ -2423,7 +2408,7 @@ static int dw_hdmi_connector_atomic_chec +@@ -2431,7 +2416,7 @@ static int dw_hdmi_connector_atomic_chec if (!crtc) return 0; diff --git a/target/linux/bcm27xx/patches-5.10/950-0529-drm-vc4-Use-the-new-helpers.patch b/target/linux/bcm27xx/patches-5.10/950-0529-drm-vc4-Use-the-new-helpers.patch index 16412f8efe..db7e7a56ab 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0529-drm-vc4-Use-the-new-helpers.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0529-drm-vc4-Use-the-new-helpers.patch @@ -12,7 +12,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -223,21 +223,6 @@ static int vc4_hdmi_connector_get_modes( +@@ -224,21 +224,6 @@ static int vc4_hdmi_connector_get_modes( return ret; } @@ -34,7 +34,7 @@ Signed-off-by: Maxime Ripard static int vc4_hdmi_connector_atomic_check(struct drm_connector *connector, struct drm_atomic_state *state) { -@@ -246,12 +231,13 @@ static int vc4_hdmi_connector_atomic_che +@@ -247,12 +232,13 @@ static int vc4_hdmi_connector_atomic_che struct drm_connector_state *new_state = drm_atomic_get_new_connector_state(state, connector); struct drm_crtc *crtc = new_state->crtc; @@ -50,7 +50,7 @@ Signed-off-by: Maxime Ripard crtc_state = drm_atomic_get_crtc_state(state, crtc); if (IS_ERR(crtc_state)) return PTR_ERR(crtc_state); -@@ -350,8 +336,7 @@ static int vc4_hdmi_connector_init(struc +@@ -351,8 +337,7 @@ static int vc4_hdmi_connector_init(struc connector->stereo_allowed = 1; if (vc4_hdmi->variant->supports_hdr) diff --git a/target/linux/bcm27xx/patches-5.10/950-0531-drm-vc4-hdmi-Signal-the-proper-colorimetry-info-in-t.patch b/target/linux/bcm27xx/patches-5.10/950-0531-drm-vc4-hdmi-Signal-the-proper-colorimetry-info-in-t.patch index 25ad2a2bb0..3c346a2b8f 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0531-drm-vc4-hdmi-Signal-the-proper-colorimetry-info-in-t.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0531-drm-vc4-hdmi-Signal-the-proper-colorimetry-info-in-t.patch @@ -17,7 +17,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -235,7 +235,8 @@ static int vc4_hdmi_connector_atomic_che +@@ -236,7 +236,8 @@ static int vc4_hdmi_connector_atomic_che if (!crtc) return 0; @@ -27,7 +27,7 @@ Signed-off-by: Maxime Ripard struct drm_crtc_state *crtc_state; crtc_state = drm_atomic_get_crtc_state(state, crtc); -@@ -325,6 +326,11 @@ static int vc4_hdmi_connector_init(struc +@@ -326,6 +327,11 @@ static int vc4_hdmi_connector_init(struc if (ret) return ret; @@ -39,7 +39,7 @@ Signed-off-by: Maxime Ripard drm_connector_attach_tv_margin_properties(connector); drm_connector_attach_max_bpc_property(connector, 8, 12); -@@ -439,7 +445,7 @@ static void vc4_hdmi_set_avi_infoframe(s +@@ -440,7 +446,7 @@ static void vc4_hdmi_set_avi_infoframe(s vc4_encoder->limited_rgb_range ? HDMI_QUANTIZATION_RANGE_LIMITED : HDMI_QUANTIZATION_RANGE_FULL); diff --git a/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch b/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch index a73c9ca823..a430307248 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch @@ -254,7 +254,7 @@ Signed-off-by: Maxime Ripard * clk_get_parent - return the parent of a clk * @clk: the clk whose parent gets returned * -@@ -3820,6 +3940,7 @@ __clk_register(struct device *dev, struc +@@ -3838,6 +3958,7 @@ __clk_register(struct device *dev, struc goto fail_parents; INIT_HLIST_HEAD(&core->clks); diff --git a/target/linux/bcm27xx/patches-5.10/950-0538-drm-vc4-hdmi-Convert-to-the-new-clock-request-API.patch b/target/linux/bcm27xx/patches-5.10/950-0538-drm-vc4-hdmi-Convert-to-the-new-clock-request-API.patch index 227c27f01d..7208b02835 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0538-drm-vc4-hdmi-Convert-to-the-new-clock-request-API.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0538-drm-vc4-hdmi-Convert-to-the-new-clock-request-API.patch @@ -15,7 +15,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -545,6 +545,9 @@ static void vc4_hdmi_encoder_post_crtc_p +@@ -546,6 +546,9 @@ static void vc4_hdmi_encoder_post_crtc_p HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); @@ -25,7 +25,7 @@ Signed-off-by: Maxime Ripard clk_disable_unprepare(vc4_hdmi->pixel_clock); ret = pm_runtime_put(&vc4_hdmi->pdev->dev); -@@ -849,9 +852,9 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -850,9 +853,9 @@ static void vc4_hdmi_encoder_pre_crtc_co * pixel clock, but HSM ends up being the limiting factor. */ hsm_rate = max_t(unsigned long, 120000000, (pixel_rate / 100) * 101); @@ -38,7 +38,7 @@ Signed-off-by: Maxime Ripard return; } -@@ -863,10 +866,12 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -864,10 +867,12 @@ static void vc4_hdmi_encoder_pre_crtc_co * FIXME: When the pixel freq is 594MHz (4k60), this needs to be setup * at 300MHz. */ @@ -55,7 +55,7 @@ Signed-off-by: Maxime Ripard clk_disable_unprepare(vc4_hdmi->pixel_clock); return; } -@@ -874,6 +879,9 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -875,6 +880,9 @@ static void vc4_hdmi_encoder_pre_crtc_co ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); if (ret) { DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); diff --git a/target/linux/bcm27xx/patches-5.10/950-0574-drm-vc4-hdmi-Properly-compute-the-BVB-clock-rate.patch b/target/linux/bcm27xx/patches-5.10/950-0574-drm-vc4-hdmi-Properly-compute-the-BVB-clock-rate.patch index 7a25bbe22b..d816abfecd 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0574-drm-vc4-hdmi-Properly-compute-the-BVB-clock-rate.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0574-drm-vc4-hdmi-Properly-compute-the-BVB-clock-rate.patch @@ -15,15 +15,15 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -92,7 +92,6 @@ - # define VC4_HD_M_ENABLE BIT(0) +@@ -93,7 +93,6 @@ + #define HSM_MIN_CLOCK_FREQ 120000000 #define CEC_CLOCK_FREQ 40000 -#define VC4_HSM_MID_CLOCK 149985000 static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) { -@@ -813,7 +812,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -814,7 +813,7 @@ static void vc4_hdmi_encoder_pre_crtc_co conn_state_to_vc4_hdmi_conn_state(conn_state); struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); @@ -32,7 +32,7 @@ Signed-off-by: Maxime Ripard int ret; ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); -@@ -862,12 +861,14 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -863,12 +862,14 @@ static void vc4_hdmi_encoder_pre_crtc_co vc4_hdmi_cec_update_clk_div(vc4_hdmi); diff --git a/target/linux/bcm27xx/patches-5.10/950-0575-drm-vc4-hdmi-Enable-the-scrambler.patch b/target/linux/bcm27xx/patches-5.10/950-0575-drm-vc4-hdmi-Enable-the-scrambler.patch index 0b00614ab8..d4efa11c40 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0575-drm-vc4-hdmi-Enable-the-scrambler.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0575-drm-vc4-hdmi-Enable-the-scrambler.patch @@ -32,7 +32,7 @@ Signed-off-by: Maxime Ripard #define VC5_HDMI_DEEP_COLOR_CONFIG_1_INIT_PACK_PHASE_SHIFT 8 #define VC5_HDMI_DEEP_COLOR_CONFIG_1_INIT_PACK_PHASE_MASK VC4_MASK(10, 8) -@@ -517,6 +520,64 @@ static void vc4_hdmi_set_infoframes(stru +@@ -518,6 +521,64 @@ static void vc4_hdmi_set_infoframes(stru vc4_hdmi_set_hdr_infoframe(encoder); } @@ -97,7 +97,7 @@ Signed-off-by: Maxime Ripard static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder, struct drm_atomic_state *state) { -@@ -529,6 +590,8 @@ static void vc4_hdmi_encoder_post_crtc_d +@@ -530,6 +591,8 @@ static void vc4_hdmi_encoder_post_crtc_d HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_BLANKPIX); @@ -106,7 +106,7 @@ Signed-off-by: Maxime Ripard } static void vc4_hdmi_encoder_post_crtc_powerdown(struct drm_encoder *encoder, -@@ -979,6 +1042,7 @@ static void vc4_hdmi_encoder_post_crtc_e +@@ -980,6 +1043,7 @@ static void vc4_hdmi_encoder_post_crtc_e } vc4_hdmi_recenter_fifo(vc4_hdmi); diff --git a/target/linux/bcm27xx/patches-5.10/950-0576-drm-vc4-hdmi-Raise-the-maximum-clock-rate.patch b/target/linux/bcm27xx/patches-5.10/950-0576-drm-vc4-hdmi-Raise-the-maximum-clock-rate.patch index 29ce1abe3d..657fc46ff1 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0576-drm-vc4-hdmi-Raise-the-maximum-clock-rate.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0576-drm-vc4-hdmi-Raise-the-maximum-clock-rate.patch @@ -19,7 +19,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2418,7 +2418,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2440,7 +2440,7 @@ static const struct vc4_hdmi_variant bcm .encoder_type = VC4_ENCODER_TYPE_HDMI0, .debugfs_name = "hdmi0_regs", .card_name = "vc4-hdmi-0", diff --git a/target/linux/bcm27xx/patches-5.10/950-0577-vc4-drm-hdmi-Handle-case-when-bvb-clock-is-null.patch b/target/linux/bcm27xx/patches-5.10/950-0577-vc4-drm-hdmi-Handle-case-when-bvb-clock-is-null.patch index 93f4524a6f..aaa67ae4ff 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0577-vc4-drm-hdmi-Handle-case-when-bvb-clock-is-null.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0577-vc4-drm-hdmi-Handle-case-when-bvb-clock-is-null.patch @@ -13,7 +13,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -607,7 +607,8 @@ static void vc4_hdmi_encoder_post_crtc_p +@@ -608,7 +608,8 @@ static void vc4_hdmi_encoder_post_crtc_p HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); @@ -23,7 +23,7 @@ Signed-off-by: Dom Cobley clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_request_done(vc4_hdmi->hsm_req); clk_disable_unprepare(vc4_hdmi->pixel_clock); -@@ -931,7 +932,8 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -932,7 +933,8 @@ static void vc4_hdmi_encoder_pre_crtc_co else bvb_rate = 75000000; @@ -33,7 +33,7 @@ Signed-off-by: Dom Cobley if (IS_ERR(vc4_hdmi->bvb_req)) { DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req)); clk_request_done(vc4_hdmi->hsm_req); -@@ -943,7 +945,8 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -944,7 +946,8 @@ static void vc4_hdmi_encoder_pre_crtc_co ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); if (ret) { DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); diff --git a/target/linux/bcm27xx/patches-5.10/950-0592-drm-vc4-Allow-DBLCLK-modes-even-if-horz-timing-is-od.patch b/target/linux/bcm27xx/patches-5.10/950-0592-drm-vc4-Allow-DBLCLK-modes-even-if-horz-timing-is-od.patch index 455042783a..459f228c15 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0592-drm-vc4-Allow-DBLCLK-modes-even-if-horz-timing-is-od.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0592-drm-vc4-Allow-DBLCLK-modes-even-if-horz-timing-is-od.patch @@ -24,7 +24,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1066,6 +1066,7 @@ static int vc4_hdmi_encoder_atomic_check +@@ -1067,6 +1067,7 @@ static int vc4_hdmi_encoder_atomic_check unsigned long long tmds_rate; if (vc4_hdmi->variant->unsupported_odd_h_timings && @@ -32,7 +32,7 @@ Signed-off-by: Dave Stevenson ((mode->hdisplay % 2) || (mode->hsync_start % 2) || (mode->hsync_end % 2) || (mode->htotal % 2))) return -EINVAL; -@@ -1110,6 +1111,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_e +@@ -1111,6 +1112,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_e struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); if (vc4_hdmi->variant->unsupported_odd_h_timings && diff --git a/target/linux/bcm27xx/patches-5.10/950-0600-drm-vc4-hdmi-Simplify-the-connector-state-retrieval.patch b/target/linux/bcm27xx/patches-5.10/950-0600-drm-vc4-hdmi-Simplify-the-connector-state-retrieval.patch index 46d373b22a..dc80cb416a 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0600-drm-vc4-hdmi-Simplify-the-connector-state-retrieval.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0600-drm-vc4-hdmi-Simplify-the-connector-state-retrieval.patch @@ -15,7 +15,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -851,31 +851,16 @@ static void vc4_hdmi_recenter_fifo(struc +@@ -852,31 +852,16 @@ static void vc4_hdmi_recenter_fifo(struc "VC4_HDMI_FIFO_CTL_RECENTER_DONE"); } diff --git a/target/linux/bcm27xx/patches-5.10/950-0601-drm-vc4-hdmi-Rely-on-interrupts-to-handle-hotplug.patch b/target/linux/bcm27xx/patches-5.10/950-0601-drm-vc4-hdmi-Rely-on-interrupts-to-handle-hotplug.patch index 6f0c4fa930..a15af69948 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0601-drm-vc4-hdmi-Rely-on-interrupts-to-handle-hotplug.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0601-drm-vc4-hdmi-Rely-on-interrupts-to-handle-hotplug.patch @@ -18,7 +18,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1689,6 +1689,46 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1690,6 +1690,46 @@ static int vc4_hdmi_audio_init(struct vc } @@ -65,7 +65,7 @@ Signed-off-by: Maxime Ripard #ifdef CONFIG_DRM_VC4_HDMI_CEC static irqreturn_t vc4_cec_irq_handler_rx_thread(int irq, void *priv) { -@@ -2303,6 +2343,10 @@ static int vc4_hdmi_bind(struct device * +@@ -2325,6 +2365,10 @@ static int vc4_hdmi_bind(struct device * if (ret) goto err_destroy_encoder; diff --git a/target/linux/bcm27xx/patches-5.10/950-0602-drm-vc4-hdmi-Add-a-workqueue-to-set-scrambling.patch b/target/linux/bcm27xx/patches-5.10/950-0602-drm-vc4-hdmi-Add-a-workqueue-to-set-scrambling.patch index ab461f383c..dbc29f6049 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0602-drm-vc4-hdmi-Add-a-workqueue-to-set-scrambling.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0602-drm-vc4-hdmi-Add-a-workqueue-to-set-scrambling.patch @@ -18,7 +18,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -537,6 +537,8 @@ static bool vc4_hdmi_supports_scrambling +@@ -538,6 +538,8 @@ static bool vc4_hdmi_supports_scrambling return true; } @@ -27,7 +27,7 @@ Signed-off-by: Maxime Ripard static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder) { struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; -@@ -553,6 +555,9 @@ static void vc4_hdmi_enable_scrambling(s +@@ -554,6 +556,9 @@ static void vc4_hdmi_enable_scrambling(s HDMI_WRITE(HDMI_SCRAMBLER_CTL, HDMI_READ(HDMI_SCRAMBLER_CTL) | VC5_HDMI_SCRAMBLER_CTL_ENABLE); @@ -37,7 +37,7 @@ Signed-off-by: Maxime Ripard } static void vc4_hdmi_disable_scrambling(struct drm_encoder *encoder) -@@ -571,6 +576,9 @@ static void vc4_hdmi_disable_scrambling( +@@ -572,6 +577,9 @@ static void vc4_hdmi_disable_scrambling( if (crtc && !vc4_hdmi_mode_needs_scrambling(&crtc->mode)) return; @@ -47,7 +47,7 @@ Signed-off-by: Maxime Ripard HDMI_WRITE(HDMI_SCRAMBLER_CTL, HDMI_READ(HDMI_SCRAMBLER_CTL) & ~VC5_HDMI_SCRAMBLER_CTL_ENABLE); -@@ -578,6 +586,22 @@ static void vc4_hdmi_disable_scrambling( +@@ -579,6 +587,22 @@ static void vc4_hdmi_disable_scrambling( drm_scdc_set_high_tmds_clock_ratio(vc4_hdmi->ddc, false); } @@ -70,7 +70,7 @@ Signed-off-by: Maxime Ripard static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder, struct drm_atomic_state *state) { -@@ -2274,6 +2298,7 @@ static int vc4_hdmi_bind(struct device * +@@ -2283,6 +2307,7 @@ static int vc4_hdmi_bind(struct device * vc4_hdmi = devm_kzalloc(dev, sizeof(*vc4_hdmi), GFP_KERNEL); if (!vc4_hdmi) return -ENOMEM; diff --git a/target/linux/bcm27xx/patches-5.10/950-0603-vc4-drm-hdmi-Fix-missing-declaration.patch b/target/linux/bcm27xx/patches-5.10/950-0603-vc4-drm-hdmi-Fix-missing-declaration.patch index 7b271c3280..b4a815f412 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0603-vc4-drm-hdmi-Fix-missing-declaration.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0603-vc4-drm-hdmi-Fix-missing-declaration.patch @@ -11,7 +11,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1728,6 +1728,7 @@ static int vc4_hdmi_hotplug_init(struct +@@ -1729,6 +1729,7 @@ static int vc4_hdmi_hotplug_init(struct { struct platform_device *pdev = vc4_hdmi->pdev; struct device *dev = &pdev->dev; diff --git a/target/linux/bcm27xx/patches-5.10/950-0636-drm-vc4-Register-HDMI-codec.patch b/target/linux/bcm27xx/patches-5.10/950-0636-drm-vc4-Register-HDMI-codec.patch index 9a294b3f31..67ac4214f5 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0636-drm-vc4-Register-HDMI-codec.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0636-drm-vc4-Register-HDMI-codec.patch @@ -33,9 +33,9 @@ Signed-off-by: Maxime Ripard #include #include #include -@@ -95,6 +96,12 @@ - # define VC4_HD_M_ENABLE BIT(0) +@@ -96,6 +97,12 @@ + #define HSM_MIN_CLOCK_FREQ 120000000 #define CEC_CLOCK_FREQ 40000 +#define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) + @@ -46,7 +46,7 @@ Signed-off-by: Maxime Ripard static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) { -@@ -472,16 +479,10 @@ static void vc4_hdmi_set_spd_infoframe(s +@@ -473,16 +480,10 @@ static void vc4_hdmi_set_spd_infoframe(s static void vc4_hdmi_set_audio_infoframe(struct drm_encoder *encoder) { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); @@ -65,7 +65,7 @@ Signed-off-by: Maxime Ripard vc4_hdmi_write_infoframe(encoder, &frame); } -@@ -1214,18 +1215,10 @@ static inline struct vc4_hdmi *dai_to_hd +@@ -1215,18 +1216,10 @@ static inline struct vc4_hdmi *dai_to_hd return snd_soc_card_get_drvdata(card); } @@ -86,7 +86,7 @@ Signed-off-by: Maxime Ripard /* * If the HDMI encoder hasn't probed, or the encoder is -@@ -1235,15 +1228,18 @@ static int vc4_hdmi_audio_startup(struct +@@ -1236,15 +1229,18 @@ static int vc4_hdmi_audio_startup(struct VC4_HDMI_RAM_PACKET_ENABLE)) return -ENODEV; @@ -112,7 +112,7 @@ Signed-off-by: Maxime Ripard return 0; } -@@ -1263,17 +1259,20 @@ static void vc4_hdmi_audio_reset(struct +@@ -1264,17 +1260,20 @@ static void vc4_hdmi_audio_reset(struct HDMI_WRITE(HDMI_MAI_CTL, VC4_HD_MAI_CTL_FLUSH); } @@ -140,7 +140,7 @@ Signed-off-by: Maxime Ripard } static int sample_rate_to_mai_fmt(int samplerate) -@@ -1315,42 +1314,35 @@ static int sample_rate_to_mai_fmt(int sa +@@ -1316,42 +1315,35 @@ static int sample_rate_to_mai_fmt(int sa } /* HDMI audio codec callbacks */ @@ -198,7 +198,7 @@ Signed-off-by: Maxime Ripard mai_audio_format = VC4_HDMI_MAI_FORMAT_HBR; else mai_audio_format = VC4_HDMI_MAI_FORMAT_PCM; -@@ -1387,148 +1379,12 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1388,148 +1380,12 @@ static int vc4_hdmi_audio_prepare(struct HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config); vc4_hdmi_set_n_cts(vc4_hdmi); @@ -348,7 +348,7 @@ Signed-off-by: Maxime Ripard static const struct snd_soc_dapm_widget vc4_hdmi_audio_widgets[] = { SND_SOC_DAPM_OUTPUT("TX"), }; -@@ -1539,8 +1395,6 @@ static const struct snd_soc_dapm_route v +@@ -1540,8 +1396,6 @@ static const struct snd_soc_dapm_route v static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = { .name = "vc4-hdmi-codec-dai-component", @@ -357,7 +357,7 @@ Signed-off-by: Maxime Ripard .dapm_widgets = vc4_hdmi_audio_widgets, .num_dapm_widgets = ARRAY_SIZE(vc4_hdmi_audio_widgets), .dapm_routes = vc4_hdmi_audio_routes, -@@ -1551,28 +1405,6 @@ static const struct snd_soc_component_dr +@@ -1552,28 +1406,6 @@ static const struct snd_soc_component_dr .non_legacy_dai_naming = 1, }; @@ -386,7 +386,7 @@ Signed-off-by: Maxime Ripard static const struct snd_soc_component_driver vc4_hdmi_audio_cpu_dai_comp = { .name = "vc4-hdmi-cpu-dai-component", }; -@@ -1599,7 +1431,6 @@ static struct snd_soc_dai_driver vc4_hdm +@@ -1600,7 +1432,6 @@ static struct snd_soc_dai_driver vc4_hdm SNDRV_PCM_RATE_192000, .formats = SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE, }, @@ -394,7 +394,7 @@ Signed-off-by: Maxime Ripard }; static const struct snd_dmaengine_pcm_config pcm_conf = { -@@ -1607,6 +1438,31 @@ static const struct snd_dmaengine_pcm_co +@@ -1608,6 +1439,31 @@ static const struct snd_dmaengine_pcm_co .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, }; @@ -426,7 +426,7 @@ Signed-off-by: Maxime Ripard static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) { const struct vc4_hdmi_register *mai_data = -@@ -1614,6 +1470,7 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1615,6 +1471,7 @@ static int vc4_hdmi_audio_init(struct vc struct snd_soc_dai_link *dai_link = &vc4_hdmi->audio.link; struct snd_soc_card *card = &vc4_hdmi->audio.card; struct device *dev = &vc4_hdmi->pdev->dev; @@ -434,7 +434,7 @@ Signed-off-by: Maxime Ripard const __be32 *addr; int index; int ret; -@@ -1649,11 +1506,6 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1650,11 +1507,6 @@ static int vc4_hdmi_audio_init(struct vc vc4_hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; vc4_hdmi->audio.dma_data.maxburst = 2; @@ -446,7 +446,7 @@ Signed-off-by: Maxime Ripard ret = devm_snd_dmaengine_pcm_register(dev, &pcm_conf, 0); if (ret) { dev_err(dev, "Could not register PCM component: %d\n", ret); -@@ -1667,12 +1519,13 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1668,12 +1520,13 @@ static int vc4_hdmi_audio_init(struct vc return ret; } @@ -466,7 +466,7 @@ Signed-off-by: Maxime Ripard } dai_link->cpus = &vc4_hdmi->audio.cpu; -@@ -1685,9 +1538,9 @@ static int vc4_hdmi_audio_init(struct vc +@@ -1686,9 +1539,9 @@ static int vc4_hdmi_audio_init(struct vc dai_link->name = "MAI"; dai_link->stream_name = "MAI PCM"; diff --git a/target/linux/bcm27xx/patches-5.10/950-0637-drm-vc4-hdmi-Remove-redundant-variables.patch b/target/linux/bcm27xx/patches-5.10/950-0637-drm-vc4-hdmi-Remove-redundant-variables.patch index c147ed2708..46d306db5a 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0637-drm-vc4-hdmi-Remove-redundant-variables.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0637-drm-vc4-hdmi-Remove-redundant-variables.patch @@ -11,7 +11,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1164,12 +1164,13 @@ static u32 vc5_hdmi_channel_map(struct v +@@ -1165,12 +1165,13 @@ static u32 vc5_hdmi_channel_map(struct v } /* HDMI audio codec callbacks */ @@ -27,7 +27,7 @@ Signed-off-by: Maxime Ripard VC4_HD_MAI_SMP_N_MASK >> VC4_HD_MAI_SMP_N_SHIFT, (VC4_HD_MAI_SMP_M_MASK >> -@@ -1181,12 +1182,11 @@ static void vc4_hdmi_audio_set_mai_clock +@@ -1182,12 +1183,11 @@ static void vc4_hdmi_audio_set_mai_clock VC4_SET_FIELD(m - 1, VC4_HD_MAI_SMP_M)); } @@ -41,7 +41,7 @@ Signed-off-by: Maxime Ripard u32 n, cts; u64 tmp; -@@ -1320,27 +1320,25 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1321,27 +1321,25 @@ static int vc4_hdmi_audio_prepare(struct { struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base; @@ -75,7 +75,7 @@ Signed-off-by: Maxime Ripard if (params->iec.status[0] & IEC958_AES0_NONAUDIO && params->channels == 8) mai_audio_format = VC4_HDMI_MAI_FORMAT_HBR; -@@ -1358,7 +1356,7 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1359,7 +1357,7 @@ static int vc4_hdmi_audio_prepare(struct VC4_HDMI_AUDIO_PACKET_ZERO_DATA_ON_INACTIVE_CHANNELS | VC4_SET_FIELD(0x8, VC4_HDMI_AUDIO_PACKET_B_FRAME_IDENTIFIER); @@ -84,7 +84,7 @@ Signed-off-by: Maxime Ripard audio_packet_config |= VC4_SET_FIELD(channel_mask, VC4_HDMI_AUDIO_PACKET_CEA_MASK); -@@ -1377,7 +1375,7 @@ static int vc4_hdmi_audio_prepare(struct +@@ -1378,7 +1376,7 @@ static int vc4_hdmi_audio_prepare(struct channel_map = vc4_hdmi->variant->channel_map(vc4_hdmi, channel_mask); HDMI_WRITE(HDMI_MAI_CHANNEL_MAP, channel_map); HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config); diff --git a/target/linux/bcm27xx/patches-5.10/950-0647-drm-vc4-Fix-timings-for-interlaced-modes.patch b/target/linux/bcm27xx/patches-5.10/950-0647-drm-vc4-Fix-timings-for-interlaced-modes.patch index 8d11e66169..62a4ea3d37 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0647-drm-vc4-Fix-timings-for-interlaced-modes.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0647-drm-vc4-Fix-timings-for-interlaced-modes.patch @@ -49,7 +49,7 @@ Signed-off-by: Mateusz Kwiatkowski } else { --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -735,12 +735,12 @@ static void vc4_hdmi_set_timings(struct +@@ -736,12 +736,12 @@ static void vc4_hdmi_set_timings(struct VC4_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC4_HDMI_VERTA_VAL)); u32 vertb = (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | @@ -65,7 +65,7 @@ Signed-off-by: Mateusz Kwiatkowski VC4_HDMI_VERTB_VBP)); HDMI_WRITE(HDMI_HORZA, -@@ -781,12 +781,12 @@ static void vc5_hdmi_set_timings(struct +@@ -782,12 +782,12 @@ static void vc5_hdmi_set_timings(struct VC5_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); u32 vertb = (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | diff --git a/target/linux/bcm27xx/patches-5.10/950-0652-drm-vc4-Fix-pixel-wrap-issue-with-DVP-teardown.patch b/target/linux/bcm27xx/patches-5.10/950-0652-drm-vc4-Fix-pixel-wrap-issue-with-DVP-teardown.patch index 9f4d700c70..a260479072 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0652-drm-vc4-Fix-pixel-wrap-issue-with-DVP-teardown.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0652-drm-vc4-Fix-pixel-wrap-issue-with-DVP-teardown.patch @@ -19,7 +19,7 @@ Signed-off-by: Tim Gover --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -610,12 +610,12 @@ static void vc4_hdmi_encoder_post_crtc_d +@@ -611,12 +611,12 @@ static void vc4_hdmi_encoder_post_crtc_d HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0); @@ -36,7 +36,7 @@ Signed-off-by: Tim Gover vc4_hdmi_disable_scrambling(encoder); } -@@ -625,12 +625,12 @@ static void vc4_hdmi_encoder_post_crtc_p +@@ -626,12 +626,12 @@ static void vc4_hdmi_encoder_post_crtc_p struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); int ret; @@ -52,7 +52,7 @@ Signed-off-by: Tim Gover clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); if (vc4_hdmi->bvb_req) clk_request_done(vc4_hdmi->bvb_req); -@@ -1010,6 +1010,7 @@ static void vc4_hdmi_encoder_post_crtc_e +@@ -1011,6 +1011,7 @@ static void vc4_hdmi_encoder_post_crtc_e HDMI_WRITE(HDMI_VID_CTL, VC4_HD_VID_CTL_ENABLE | diff --git a/target/linux/bcm27xx/patches-5.10/950-0654-drm-vc4-hdmi-Use-a-fixed-rate-for-the-HSM-clock-on-B.patch b/target/linux/bcm27xx/patches-5.10/950-0654-drm-vc4-hdmi-Use-a-fixed-rate-for-the-HSM-clock-on-B.patch index c9d5f3f0a2..e08ad7d320 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0654-drm-vc4-hdmi-Use-a-fixed-rate-for-the-HSM-clock-on-B.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0654-drm-vc4-hdmi-Use-a-fixed-rate-for-the-HSM-clock-on-B.patch @@ -37,7 +37,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -908,23 +908,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -909,23 +909,7 @@ static void vc4_hdmi_encoder_pre_crtc_co return; } @@ -62,7 +62,7 @@ Signed-off-by: Maxime Ripard vc4_hdmi->hsm_req = clk_request_start(vc4_hdmi->hsm_clock, hsm_rate); if (IS_ERR(vc4_hdmi->hsm_req)) { DRM_ERROR("Failed to set HSM clock rate: %ld\n", PTR_ERR(vc4_hdmi->hsm_req)); -@@ -1140,6 +1124,39 @@ static const struct drm_encoder_helper_f +@@ -1141,6 +1125,39 @@ static const struct drm_encoder_helper_f .enable = vc4_hdmi_encoder_enable, }; @@ -102,7 +102,7 @@ Signed-off-by: Maxime Ripard static u32 vc4_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask) { int i; -@@ -2322,6 +2339,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2344,6 +2361,7 @@ static const struct vc4_hdmi_variant bcm .phy_disable = vc4_hdmi_phy_disable, .phy_rng_enable = vc4_hdmi_phy_rng_enable, .phy_rng_disable = vc4_hdmi_phy_rng_disable, @@ -110,7 +110,7 @@ Signed-off-by: Maxime Ripard .channel_map = vc4_hdmi_channel_map, .supports_hdr = false, }; -@@ -2350,6 +2368,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2372,6 +2390,7 @@ static const struct vc4_hdmi_variant bcm .phy_disable = vc5_hdmi_phy_disable, .phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_disable = vc5_hdmi_phy_rng_disable, @@ -118,7 +118,7 @@ Signed-off-by: Maxime Ripard .channel_map = vc5_hdmi_channel_map, .supports_hdr = true, }; -@@ -2378,6 +2397,7 @@ static const struct vc4_hdmi_variant bcm +@@ -2400,6 +2419,7 @@ static const struct vc4_hdmi_variant bcm .phy_disable = vc5_hdmi_phy_disable, .phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_disable = vc5_hdmi_phy_rng_disable, diff --git a/target/linux/bcm27xx/patches-5.10/950-0655-drm-vc4-hdmi-Enable-the-scrambler-on-reconnection.patch b/target/linux/bcm27xx/patches-5.10/950-0655-drm-vc4-hdmi-Enable-the-scrambler-on-reconnection.patch index ebaf3e240b..17e9caf6c3 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0655-drm-vc4-hdmi-Enable-the-scrambler-on-reconnection.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0655-drm-vc4-hdmi-Enable-the-scrambler-on-reconnection.patch @@ -19,7 +19,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -167,6 +167,8 @@ static void vc4_hdmi_cec_update_clk_div( +@@ -168,6 +168,8 @@ static void vc4_hdmi_cec_update_clk_div( static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) {} #endif @@ -28,7 +28,7 @@ Signed-off-by: Maxime Ripard static enum drm_connector_status vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) { -@@ -196,6 +198,8 @@ vc4_hdmi_connector_detect(struct drm_con +@@ -197,6 +199,8 @@ vc4_hdmi_connector_detect(struct drm_con } } @@ -37,7 +37,7 @@ Signed-off-by: Maxime Ripard pm_runtime_put(&vc4_hdmi->pdev->dev); return connector_status_connected; } -@@ -542,9 +546,13 @@ static bool vc4_hdmi_supports_scrambling +@@ -543,9 +547,13 @@ static bool vc4_hdmi_supports_scrambling static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder) { diff --git a/target/linux/bcm27xx/patches-5.10/950-0667-drm-vc4-hdmi-Put-the-device-on-error-in-pre_crtc_con.patch b/target/linux/bcm27xx/patches-5.10/950-0667-drm-vc4-hdmi-Put-the-device-on-error-in-pre_crtc_con.patch index ec225841b4..6be52cb43b 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0667-drm-vc4-hdmi-Put-the-device-on-error-in-pre_crtc_con.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0667-drm-vc4-hdmi-Put-the-device-on-error-in-pre_crtc_con.patch @@ -16,7 +16,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -900,6 +900,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -901,6 +901,7 @@ static void vc4_hdmi_encoder_pre_crtc_co ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); if (ret < 0) { DRM_ERROR("Failed to retain power domain: %d\n", ret); @@ -24,7 +24,7 @@ Signed-off-by: Maxime Ripard return; } -@@ -907,12 +908,14 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -908,12 +909,14 @@ static void vc4_hdmi_encoder_pre_crtc_co ret = clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate); if (ret) { DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); @@ -39,7 +39,7 @@ Signed-off-by: Maxime Ripard return; } -@@ -920,6 +923,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -921,6 +924,7 @@ static void vc4_hdmi_encoder_pre_crtc_co vc4_hdmi->hsm_req = clk_request_start(vc4_hdmi->hsm_clock, hsm_rate); if (IS_ERR(vc4_hdmi->hsm_req)) { DRM_ERROR("Failed to set HSM clock rate: %ld\n", PTR_ERR(vc4_hdmi->hsm_req)); @@ -47,7 +47,7 @@ Signed-off-by: Maxime Ripard return; } -@@ -941,6 +945,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -942,6 +946,7 @@ static void vc4_hdmi_encoder_pre_crtc_co clk_request_done(vc4_hdmi->hsm_req); clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); @@ -55,7 +55,7 @@ Signed-off-by: Maxime Ripard return; } -@@ -952,6 +957,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -953,6 +958,7 @@ static void vc4_hdmi_encoder_pre_crtc_co clk_request_done(vc4_hdmi->hsm_req); clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); diff --git a/target/linux/bcm27xx/patches-5.10/950-0668-drm-vc4-hdmi-Split-the-CEC-disable-enable-functions-.patch b/target/linux/bcm27xx/patches-5.10/950-0668-drm-vc4-hdmi-Split-the-CEC-disable-enable-functions-.patch index 82b85bca78..2c12f57d2a 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0668-drm-vc4-hdmi-Split-the-CEC-disable-enable-functions-.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0668-drm-vc4-hdmi-Split-the-CEC-disable-enable-functions-.patch @@ -15,7 +15,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1755,7 +1755,7 @@ static irqreturn_t vc4_cec_irq_handler(i +@@ -1756,7 +1756,7 @@ static irqreturn_t vc4_cec_irq_handler(i return ret; } @@ -24,7 +24,7 @@ Signed-off-by: Maxime Ripard { struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap); /* clock period in microseconds */ -@@ -1768,38 +1768,53 @@ static int vc4_hdmi_cec_adap_enable(stru +@@ -1775,38 +1775,53 @@ static int vc4_hdmi_cec_adap_enable(stru val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) | ((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT); diff --git a/target/linux/bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch b/target/linux/bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch deleted file mode 100644 index cacb29d17a..0000000000 --- a/target/linux/bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch +++ /dev/null @@ -1,45 +0,0 @@ -From ea4d08578d2e002ce01a2f6913c78fbff8195985 Mon Sep 17 00:00:00 2001 -From: Maxime Ripard -Date: Tue, 29 Jun 2021 11:41:57 +0200 -Subject: [PATCH] drm/vc4: hdmi: Make sure the device is powered with - CEC - -Similarly to what we encountered with the detect hook with DRM, nothing -actually prevents any of the CEC callback from being run while the HDMI -output is disabled. - -However, this is an issue since any register access to the controller -when it's powered down will result in a silent hang. - -Let's make sure we run the runtime_pm hooks when the CEC adapter is -opened and closed by the userspace to avoid that issue. - -Fixes: 15b4511a4af6 ("drm/vc4: add HDMI CEC support") -Signed-off-by: Maxime Ripard ---- - drivers/gpu/drm/vc4/vc4_hdmi.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1761,6 +1761,11 @@ static int vc4_hdmi_cec_enable(struct ce - /* clock period in microseconds */ - const u32 usecs = 1000000 / CEC_CLOCK_FREQ; - u32 val = HDMI_READ(HDMI_CEC_CNTRL_5); -+ int ret; -+ -+ ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); -+ if (ret) -+ return ret; - - val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET | - VC4_HDMI_CEC_CNT_TO_4700_US_MASK | -@@ -1804,6 +1809,8 @@ static int vc4_hdmi_cec_disable(struct c - HDMI_WRITE(HDMI_CEC_CNTRL_5, HDMI_READ(HDMI_CEC_CNTRL_5) | - VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET); - -+ pm_runtime_put(&vc4_hdmi->pdev->dev); -+ - return 0; - } - diff --git a/target/linux/bcm27xx/patches-5.10/950-0670-drm-vc4-hdmi-Add-missing-clk_disable_unprepare-on-er.patch b/target/linux/bcm27xx/patches-5.10/950-0670-drm-vc4-hdmi-Add-missing-clk_disable_unprepare-on-er.patch index 03590ba735..71ef2c42fb 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0670-drm-vc4-hdmi-Add-missing-clk_disable_unprepare-on-er.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0670-drm-vc4-hdmi-Add-missing-clk_disable_unprepare-on-er.patch @@ -18,7 +18,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -923,6 +923,7 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -924,6 +924,7 @@ static void vc4_hdmi_encoder_pre_crtc_co vc4_hdmi->hsm_req = clk_request_start(vc4_hdmi->hsm_clock, hsm_rate); if (IS_ERR(vc4_hdmi->hsm_req)) { DRM_ERROR("Failed to set HSM clock rate: %ld\n", PTR_ERR(vc4_hdmi->hsm_req)); diff --git a/target/linux/bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch b/target/linux/bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch deleted file mode 100644 index 0aaec235d4..0000000000 --- a/target/linux/bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 9f2c0bf1e2f3784e1f991ab30bba83ffd79b8a19 Mon Sep 17 00:00:00 2001 -From: Maxime Ripard -Date: Mon, 5 Jul 2021 10:48:07 +0200 -Subject: [PATCH] drm/vc4: hdmi: Move initial register read after - pm_runtime_get - -Commit ecdd08fd9bba ("drm/vc4: hdmi: Make sure the device is powered -with CEC") made sure that the device is powered while there is -CEC-related accesses but missed one register read in the variable -declaration. - -Move the variable assignment after the pm_runtime_resume_and_get. - -Fixes: ecdd08fd9bba ("drm/vc4: hdmi: Make sure the device is powered with CEC") -Signed-off-by: Maxime Ripard ---- - drivers/gpu/drm/vc4/vc4_hdmi.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1761,13 +1761,14 @@ static int vc4_hdmi_cec_enable(struct ce - struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap); - /* clock period in microseconds */ - const u32 usecs = 1000000 / CEC_CLOCK_FREQ; -- u32 val = HDMI_READ(HDMI_CEC_CNTRL_5); -+ u32 val; - int ret; - - ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); - if (ret) - return ret; - -+ val = HDMI_READ(HDMI_CEC_CNTRL_5); - val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET | - VC4_HDMI_CEC_CNT_TO_4700_US_MASK | - VC4_HDMI_CEC_CNT_TO_4500_US_MASK); diff --git a/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch b/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch index e436a0e54b..a4b9df85dc 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch @@ -25,7 +25,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1903,38 +1903,46 @@ static int vc4_hdmi_cec_init(struct vc4_ +@@ -1902,40 +1902,49 @@ static int vc4_hdmi_cec_init(struct vc4_ vc4_hdmi_cec_update_clk_div(vc4_hdmi); if (vc4_hdmi->variant->external_irq_controller) { @@ -53,6 +53,7 @@ Signed-off-by: Maxime Ripard if (ret) - goto err_delete_cec_adap; + goto err_remove_cec_rx_handler; ++ } else { HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, 0xffffffff); @@ -73,6 +74,8 @@ Signed-off-by: Maxime Ripard - goto err_delete_cec_adap; + goto err_remove_handlers; + pm_runtime_put(&vc4_hdmi->pdev->dev); + return 0; +err_remove_handlers: @@ -88,7 +91,7 @@ Signed-off-by: Maxime Ripard err_delete_cec_adap: cec_delete_adapter(vc4_hdmi->cec_adap); -@@ -1943,6 +1951,15 @@ err_delete_cec_adap: +@@ -1944,6 +1953,15 @@ err_delete_cec_adap: static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) { diff --git a/target/linux/bcm27xx/patches-5.10/950-0676-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-hotplug.patch b/target/linux/bcm27xx/patches-5.10/950-0676-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-hotplug.patch index 0594e35dbe..062804814c 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0676-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-hotplug.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0676-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-hotplug.patch @@ -25,7 +25,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1611,26 +1611,28 @@ static irqreturn_t vc4_hdmi_hpd_irq_thre +@@ -1612,26 +1612,28 @@ static irqreturn_t vc4_hdmi_hpd_irq_thre static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi) { struct platform_device *pdev = vc4_hdmi->pdev; @@ -66,7 +66,7 @@ Signed-off-by: Maxime Ripard connector->polled = DRM_CONNECTOR_POLL_HPD; } -@@ -1638,6 +1640,16 @@ static int vc4_hdmi_hotplug_init(struct +@@ -1639,6 +1641,16 @@ static int vc4_hdmi_hotplug_init(struct return 0; } @@ -83,7 +83,7 @@ Signed-off-by: Maxime Ripard #ifdef CONFIG_DRM_VC4_HDMI_CEC static irqreturn_t vc4_cec_irq_handler_rx_thread(int irq, void *priv) { -@@ -2299,7 +2311,7 @@ static int vc4_hdmi_bind(struct device * +@@ -2314,7 +2326,7 @@ static int vc4_hdmi_bind(struct device * ret = vc4_hdmi_cec_init(vc4_hdmi); if (ret) @@ -92,7 +92,7 @@ Signed-off-by: Maxime Ripard ret = vc4_hdmi_audio_init(vc4_hdmi); if (ret) -@@ -2313,6 +2325,8 @@ static int vc4_hdmi_bind(struct device * +@@ -2328,6 +2340,8 @@ static int vc4_hdmi_bind(struct device * err_free_cec: vc4_hdmi_cec_exit(vc4_hdmi); @@ -101,7 +101,7 @@ Signed-off-by: Maxime Ripard err_destroy_conn: vc4_hdmi_connector_destroy(&vc4_hdmi->connector); err_destroy_encoder: -@@ -2354,6 +2368,7 @@ static void vc4_hdmi_unbind(struct devic +@@ -2369,6 +2383,7 @@ static void vc4_hdmi_unbind(struct devic kfree(vc4_hdmi->hd_regset.regs); vc4_hdmi_cec_exit(vc4_hdmi); diff --git a/target/linux/bcm27xx/patches-5.10/950-0677-drm-vc4-hdmi-Only-call-into-DRM-framework-if-registe.patch b/target/linux/bcm27xx/patches-5.10/950-0677-drm-vc4-hdmi-Only-call-into-DRM-framework-if-registe.patch index bac5466509..6297691d57 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0677-drm-vc4-hdmi-Only-call-into-DRM-framework-if-registe.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0677-drm-vc4-hdmi-Only-call-into-DRM-framework-if-registe.patch @@ -24,7 +24,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1602,7 +1602,7 @@ static irqreturn_t vc4_hdmi_hpd_irq_thre +@@ -1603,7 +1603,7 @@ static irqreturn_t vc4_hdmi_hpd_irq_thre struct vc4_hdmi *vc4_hdmi = priv; struct drm_device *dev = vc4_hdmi->connector.dev; diff --git a/target/linux/bcm27xx/patches-5.10/950-0684-drm-vc4-hdmi-Don-t-poll-for-the-infoframes-status-on.patch b/target/linux/bcm27xx/patches-5.10/950-0684-drm-vc4-hdmi-Don-t-poll-for-the-infoframes-status-on.patch index baade60d69..b613e9a730 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0684-drm-vc4-hdmi-Don-t-poll-for-the-infoframes-status-on.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0684-drm-vc4-hdmi-Don-t-poll-for-the-infoframes-status-on.patch @@ -23,7 +23,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201203074624.721559-1-maxi --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -363,7 +363,8 @@ static int vc4_hdmi_connector_init(struc +@@ -364,7 +364,8 @@ static int vc4_hdmi_connector_init(struc } static int vc4_hdmi_stop_packet(struct drm_encoder *encoder, @@ -33,7 +33,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201203074624.721559-1-maxi { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); u32 packet_id = type - 0x80; -@@ -371,6 +372,9 @@ static int vc4_hdmi_stop_packet(struct d +@@ -372,6 +373,9 @@ static int vc4_hdmi_stop_packet(struct d HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, HDMI_READ(HDMI_RAM_PACKET_CONFIG) & ~BIT(packet_id)); @@ -43,7 +43,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201203074624.721559-1-maxi return wait_for(!(HDMI_READ(HDMI_RAM_PACKET_STATUS) & BIT(packet_id)), 100); } -@@ -399,7 +403,7 @@ static void vc4_hdmi_write_infoframe(str +@@ -400,7 +404,7 @@ static void vc4_hdmi_write_infoframe(str if (len < 0) return; @@ -52,7 +52,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201203074624.721559-1-maxi if (ret) { DRM_ERROR("Failed to wait for infoframe to go idle: %d\n", ret); return; -@@ -1283,7 +1287,7 @@ static void vc4_hdmi_audio_reset(struct +@@ -1284,7 +1288,7 @@ static void vc4_hdmi_audio_reset(struct int ret; vc4_hdmi->audio.streaming = false; diff --git a/target/linux/bcm27xx/patches-5.10/950-0689-drm-automatic-legacy-gamma-support.patch b/target/linux/bcm27xx/patches-5.10/950-0689-drm-automatic-legacy-gamma-support.patch index 50c0f71318..d536e6722c 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0689-drm-automatic-legacy-gamma-support.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0689-drm-automatic-legacy-gamma-support.patch @@ -42,7 +42,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201211114237.213288-2-tomi --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -4989,7 +4989,6 @@ static void dm_disable_vblank(struct drm +@@ -4992,7 +4992,6 @@ static void dm_disable_vblank(struct drm static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { .reset = dm_crtc_reset_state, .destroy = amdgpu_dm_crtc_destroy, @@ -395,7 +395,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20201211114237.213288-2-tomi .atomic_set_property = omap_crtc_atomic_set_property, --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c -@@ -1138,7 +1138,6 @@ static const struct drm_crtc_funcs crtc_ +@@ -1150,7 +1150,6 @@ static const struct drm_crtc_funcs crtc_ .set_crc_source = rcar_du_crtc_set_crc_source, .verify_crc_source = rcar_du_crtc_verify_crc_source, .get_crc_sources = rcar_du_crtc_get_crc_sources, diff --git a/target/linux/bcm27xx/patches-5.10/950-0717-drm-vc4-hdmi-Make-sure-the-controller-is-powered-up-.patch b/target/linux/bcm27xx/patches-5.10/950-0717-drm-vc4-hdmi-Make-sure-the-controller-is-powered-up-.patch index fdfc35d0ab..f2424cbfac 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0717-drm-vc4-hdmi-Make-sure-the-controller-is-powered-up-.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0717-drm-vc4-hdmi-Make-sure-the-controller-is-powered-up-.patch @@ -18,9 +18,9 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2289,6 +2289,18 @@ static int vc4_hdmi_bind(struct device * - vc4_hdmi->disable_wifi_frequencies = - of_property_read_bool(dev->of_node, "wifi-2.4ghz-coexistence"); +@@ -2304,6 +2304,18 @@ static int vc4_hdmi_bind(struct device * + if (ret) + goto err_put_ddc; + /* + * We need to have the device powered up at this point to call @@ -37,7 +37,7 @@ Signed-off-by: Maxime Ripard if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); -@@ -2300,8 +2312,6 @@ static int vc4_hdmi_bind(struct device * +@@ -2315,8 +2327,6 @@ static int vc4_hdmi_bind(struct device * clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); } @@ -46,7 +46,7 @@ Signed-off-by: Maxime Ripard drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); drm_encoder_helper_add(encoder, &vc4_hdmi_encoder_helper_funcs); -@@ -2325,6 +2335,8 @@ static int vc4_hdmi_bind(struct device * +@@ -2340,6 +2350,8 @@ static int vc4_hdmi_bind(struct device * vc4_hdmi_debugfs_regs, vc4_hdmi); @@ -55,7 +55,7 @@ Signed-off-by: Maxime Ripard return 0; err_free_cec: -@@ -2335,6 +2347,7 @@ err_destroy_conn: +@@ -2350,6 +2362,7 @@ err_destroy_conn: vc4_hdmi_connector_destroy(&vc4_hdmi->connector); err_destroy_encoder: drm_encoder_cleanup(encoder); diff --git a/target/linux/bcm63xx/patches-5.10/339-MIPS-BCM63XX-add-support-for-BCM63268.patch b/target/linux/bcm63xx/patches-5.10/339-MIPS-BCM63XX-add-support-for-BCM63268.patch index 7b8d75f9a2..84209d6e3b 100644 --- a/target/linux/bcm63xx/patches-5.10/339-MIPS-BCM63XX-add-support-for-BCM63268.patch +++ b/target/linux/bcm63xx/patches-5.10/339-MIPS-BCM63XX-add-support-for-BCM63268.patch @@ -107,7 +107,7 @@ Signed-off-by: Jonas Gorski } static struct clk clk_pcie = { -@@ -542,6 +556,21 @@ static struct clk_lookup bcm6368_clks[] +@@ -548,6 +562,21 @@ static struct clk_lookup bcm6368_clks[] CLKDEV_INIT(NULL, "ipsec", &clk_ipsec), }; @@ -129,7 +129,7 @@ Signed-off-by: Jonas Gorski #define HSSPI_PLL_HZ_6328 133333333 #define HSSPI_PLL_HZ_6362 400000000 -@@ -574,6 +603,10 @@ static int __init bcm63xx_clk_init(void) +@@ -580,6 +609,10 @@ static int __init bcm63xx_clk_init(void) case BCM6368_CPU_ID: clkdev_add_table(bcm6368_clks, ARRAY_SIZE(bcm6368_clks)); break; diff --git a/target/linux/bcm63xx/patches-5.10/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/bcm63xx/patches-5.10/341-MIPS-BCM63XX-add-support-for-BCM6318.patch index 341ca6e721..cb0f8f3e1b 100644 --- a/target/linux/bcm63xx/patches-5.10/341-MIPS-BCM63XX-add-support-for-BCM6318.patch +++ b/target/linux/bcm63xx/patches-5.10/341-MIPS-BCM63XX-add-support-for-BCM6318.patch @@ -57,7 +57,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 mask = CKCTL_6328_HSSPI_EN; else if (BCMCPU_IS_6362()) mask = CKCTL_6362_HSSPI_EN; -@@ -450,6 +452,19 @@ static struct clk_lookup bcm3368_clks[] +@@ -456,6 +458,19 @@ static struct clk_lookup bcm3368_clks[] CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), }; @@ -77,7 +77,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 static struct clk_lookup bcm6328_clks[] = { /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), -@@ -571,6 +586,7 @@ static struct clk_lookup bcm63268_clks[] +@@ -577,6 +592,7 @@ static struct clk_lookup bcm63268_clks[] CLKDEV_INIT(NULL, "pcie", &clk_pcie), }; @@ -85,7 +85,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 #define HSSPI_PLL_HZ_6328 133333333 #define HSSPI_PLL_HZ_6362 400000000 -@@ -580,6 +596,10 @@ static int __init bcm63xx_clk_init(void) +@@ -586,6 +602,10 @@ static int __init bcm63xx_clk_init(void) case BCM3368_CPU_ID: clkdev_add_table(bcm3368_clks, ARRAY_SIZE(bcm3368_clks)); break; diff --git a/target/linux/bcm63xx/patches-5.10/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch b/target/linux/bcm63xx/patches-5.10/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch index 45d4b8487c..d6b1190b9d 100644 --- a/target/linux/bcm63xx/patches-5.10/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch +++ b/target/linux/bcm63xx/patches-5.10/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch @@ -9,7 +9,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c -@@ -495,6 +495,8 @@ static struct clk_lookup bcm3368_clks[] +@@ -501,6 +501,8 @@ static struct clk_lookup bcm3368_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -18,7 +18,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -511,7 +513,9 @@ static struct clk_lookup bcm6318_clks[] +@@ -517,7 +519,9 @@ static struct clk_lookup bcm6318_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -28,7 +28,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -525,7 +529,10 @@ static struct clk_lookup bcm6328_clks[] +@@ -531,7 +535,10 @@ static struct clk_lookup bcm6328_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -39,7 +39,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -538,6 +545,7 @@ static struct clk_lookup bcm6338_clks[] +@@ -544,6 +551,7 @@ static struct clk_lookup bcm6338_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -47,7 +47,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -552,6 +560,7 @@ static struct clk_lookup bcm6345_clks[] +@@ -558,6 +566,7 @@ static struct clk_lookup bcm6345_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -55,7 +55,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -566,6 +575,7 @@ static struct clk_lookup bcm6348_clks[] +@@ -572,6 +581,7 @@ static struct clk_lookup bcm6348_clks[] /* fixed rate clocks */ CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), @@ -63,7 +63,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -582,6 +592,8 @@ static struct clk_lookup bcm6358_clks[] +@@ -588,6 +598,8 @@ static struct clk_lookup bcm6358_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -72,7 +72,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enet0", &clk_enet0), CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -601,7 +613,10 @@ static struct clk_lookup bcm6362_clks[] +@@ -607,7 +619,10 @@ static struct clk_lookup bcm6362_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -83,7 +83,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -617,6 +632,8 @@ static struct clk_lookup bcm6368_clks[] +@@ -623,6 +638,8 @@ static struct clk_lookup bcm6368_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), @@ -92,7 +92,7 @@ Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree /* gated clocks */ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -631,7 +648,10 @@ static struct clk_lookup bcm63268_clks[] +@@ -637,7 +654,10 @@ static struct clk_lookup bcm63268_clks[] CLKDEV_INIT(NULL, "periph", &clk_periph), CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), diff --git a/target/linux/bcm63xx/patches-5.10/430-MIPS-BCM63XX-add-nand-clocks.patch b/target/linux/bcm63xx/patches-5.10/430-MIPS-BCM63XX-add-nand-clocks.patch index a8f70e3db3..a29c3b780b 100644 --- a/target/linux/bcm63xx/patches-5.10/430-MIPS-BCM63XX-add-nand-clocks.patch +++ b/target/linux/bcm63xx/patches-5.10/430-MIPS-BCM63XX-add-nand-clocks.patch @@ -24,7 +24,7 @@ * Internal peripheral clock */ static struct clk clk_periph = { -@@ -618,6 +635,7 @@ static struct clk_lookup bcm6362_clks[] +@@ -624,6 +641,7 @@ static struct clk_lookup bcm6362_clks[] CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), /* gated clocks */ @@ -32,7 +32,7 @@ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), CLKDEV_INIT(NULL, "usbd", &clk_usbd), -@@ -635,6 +653,7 @@ static struct clk_lookup bcm6368_clks[] +@@ -641,6 +659,7 @@ static struct clk_lookup bcm6368_clks[] CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), /* gated clocks */ @@ -40,7 +40,7 @@ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), CLKDEV_INIT(NULL, "usbh", &clk_usbh), CLKDEV_INIT(NULL, "usbd", &clk_usbd), -@@ -653,6 +672,7 @@ static struct clk_lookup bcm63268_clks[] +@@ -659,6 +678,7 @@ static struct clk_lookup bcm63268_clks[] CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), /* gated clocks */ diff --git a/target/linux/gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch b/target/linux/gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch deleted file mode 100644 index 8170917a49..0000000000 --- a/target/linux/gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 447fd4347f06af3a369045149ba74f9b914cd99e Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Tue, 23 Nov 2021 21:42:21 +0100 -Subject: [PATCH] ARM: dts: gemini: NAS4220-B: fis-index-block with 128 KiB - sectors - -Steven Maddox reported in the OpenWrt bugzilla, that his -RaidSonic IB-NAS4220-B was no longer booting with the new -OpenWrt 21.02 (uses linux 5.10's device-tree). However, it was -working with the previous OpenWrt 19.07 series (uses 4.14). - -|[ 5.548038] No RedBoot partition table detected in 30000000.flash -|[ 5.618553] Searching for RedBoot partition table in 30000000.flash at offset 0x0 -|[ 5.739093] No RedBoot partition table detected in 30000000.flash -|... -|[ 7.039504] Waiting for root device /dev/mtdblock3... - -The provided bootlog shows that the RedBoot partition parser was -looking for the partition table "at offset 0x0". Which is strange -since the comment in the device-tree says it should be at 0xfe0000. - -Further digging on the internet led to a review site that took -some useful PCB pictures of their review unit back in February 2009. -Their picture shows a Spansion S29GL128N11TFI01 flash chip. - -From Spansion's Datasheet: -"S29GL128N: One hundred twenty-eight 64 Kword (128 Kbyte) sectors" -The reported also provided a "cat /sys/class/mtd/mtd0/erasesize", -which returned "131072". - -With the 128 KiB Sector/Erasesize in mind. This patch changes the -fis-index-block property to (0xfe0000 / 0x20000) = 0x7f. - -Note: -Let's hope the vendor stuck to the 128 KiB sector size flash chip -for all units still out there. - -Fixes: b5a923f8c739 ("ARM: dts: gemini: Switch to redboot partition parsing") -Bugzilla: https://bugs.openwrt.org/index.php?do=details&task_id=4137 -Reported-by: Steven Maddox -Signed-off-by: Christian Lamparter ---- a/arch/arm/boot/dts/gemini-nas4220b.dts -+++ b/arch/arm/boot/dts/gemini-nas4220b.dts -@@ -84,7 +84,7 @@ - partitions { - compatible = "redboot-fis"; - /* Eraseblock at 0xfe0000 */ -- fis-index-block = <0x1fc>; -+ fis-index-block = <0x7f>; - }; - }; - diff --git a/target/linux/generic/backport-5.10/081-net-next-regmap-allow-to-define-reg_update_bits-for-no-bus.patch b/target/linux/generic/backport-5.10/081-net-next-regmap-allow-to-define-reg_update_bits-for-no-bus.patch index 18b3869af5..6e274acb1f 100644 --- a/target/linux/generic/backport-5.10/081-net-next-regmap-allow-to-define-reg_update_bits-for-no-bus.patch +++ b/target/linux/generic/backport-5.10/081-net-next-regmap-allow-to-define-reg_update_bits-for-no-bus.patch @@ -19,7 +19,7 @@ Signed-off-by: Mark Brown --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c -@@ -841,6 +841,7 @@ struct regmap *__regmap_init(struct devi +@@ -842,6 +842,7 @@ struct regmap *__regmap_init(struct devi if (!bus) { map->reg_read = config->reg_read; map->reg_write = config->reg_write; diff --git a/target/linux/generic/backport-5.10/103-v5.13-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch b/target/linux/generic/backport-5.10/103-v5.13-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch index 6e34dd65c0..fafe530ac5 100644 --- a/target/linux/generic/backport-5.10/103-v5.13-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch +++ b/target/linux/generic/backport-5.10/103-v5.13-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch @@ -25,7 +25,7 @@ Signed-off-by: Jason A. Donenfeld --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -2084,7 +2084,7 @@ config CPU_MIPS32 +@@ -2088,7 +2088,7 @@ config CPU_MIPS32 config CPU_MIPS64 bool default y if CPU_MIPS64_R1 || CPU_MIPS64_R2 || CPU_MIPS64_R5 || \ diff --git a/target/linux/generic/backport-5.10/610-v5.13-15-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch b/target/linux/generic/backport-5.10/610-v5.13-15-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch index e74f47c238..712bb9ec97 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-15-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-15-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch @@ -12,7 +12,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c -@@ -1461,12 +1461,34 @@ static void ppp_dev_priv_destructor(stru +@@ -1466,12 +1466,34 @@ static void ppp_dev_priv_destructor(stru ppp_destroy_interface(ppp); } diff --git a/target/linux/generic/backport-5.10/712-v5.13-net-phy-marvell-refactor-HWMON-OOP-style.patch b/target/linux/generic/backport-5.10/712-v5.13-net-phy-marvell-refactor-HWMON-OOP-style.patch index 7bf59267fa..13e241a400 100644 --- a/target/linux/generic/backport-5.10/712-v5.13-net-phy-marvell-refactor-HWMON-OOP-style.patch +++ b/target/linux/generic/backport-5.10/712-v5.13-net-phy-marvell-refactor-HWMON-OOP-style.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c -@@ -2134,6 +2134,19 @@ static int marvell_vct7_cable_test_get_s +@@ -2140,6 +2140,19 @@ static int marvell_vct7_cable_test_get_s } #ifdef CONFIG_HWMON @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller static int m88e1121_get_temp(struct phy_device *phydev, long *temp) { int oldpage; -@@ -2177,75 +2190,6 @@ error: +@@ -2183,75 +2196,6 @@ error: return phy_restore_page(phydev, oldpage, ret); } @@ -114,7 +114,7 @@ Signed-off-by: David S. Miller static int m88e1510_get_temp(struct phy_device *phydev, long *temp) { int ret; -@@ -2308,92 +2252,6 @@ static int m88e1510_get_temp_alarm(struc +@@ -2314,92 +2258,6 @@ static int m88e1510_get_temp_alarm(struc return 0; } @@ -207,7 +207,7 @@ Signed-off-by: David S. Miller static int m88e6390_get_temp(struct phy_device *phydev, long *temp) { int sum = 0; -@@ -2452,63 +2310,112 @@ error: +@@ -2458,63 +2316,112 @@ error: return ret; } @@ -343,7 +343,7 @@ Signed-off-by: David S. Miller }; static int marvell_hwmon_name(struct phy_device *phydev) -@@ -2531,49 +2438,48 @@ static int marvell_hwmon_name(struct phy +@@ -2537,49 +2444,48 @@ static int marvell_hwmon_name(struct phy return 0; } @@ -416,7 +416,7 @@ Signed-off-by: David S. Miller { return 0; } -@@ -2589,40 +2495,7 @@ static int marvell_probe(struct phy_devi +@@ -2595,40 +2501,7 @@ static int marvell_probe(struct phy_devi phydev->priv = priv; @@ -458,7 +458,7 @@ Signed-off-by: David S. Miller } static struct phy_driver marvell_drivers[] = { -@@ -2707,8 +2580,9 @@ static struct phy_driver marvell_drivers +@@ -2713,8 +2586,9 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E1121R, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E1121R", @@ -469,7 +469,7 @@ Signed-off-by: David S. Miller .config_init = marvell_config_init, .config_aneg = m88e1121_config_aneg, .read_status = marvell_read_status, -@@ -2827,9 +2701,10 @@ static struct phy_driver marvell_drivers +@@ -2833,9 +2707,10 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E1510, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E1510", @@ -481,7 +481,7 @@ Signed-off-by: David S. Miller .config_init = m88e1510_config_init, .config_aneg = m88e1510_config_aneg, .read_status = marvell_read_status, -@@ -2856,9 +2731,10 @@ static struct phy_driver marvell_drivers +@@ -2862,9 +2737,10 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E1540, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E1540", @@ -493,7 +493,7 @@ Signed-off-by: David S. Miller .config_init = marvell_config_init, .config_aneg = m88e1510_config_aneg, .read_status = marvell_read_status, -@@ -2882,7 +2758,8 @@ static struct phy_driver marvell_drivers +@@ -2888,7 +2764,8 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E1545, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E1545", @@ -503,7 +503,7 @@ Signed-off-by: David S. Miller /* PHY_GBIT_FEATURES */ .flags = PHY_POLL_CABLE_TEST, .config_init = marvell_config_init, -@@ -2928,9 +2805,10 @@ static struct phy_driver marvell_drivers +@@ -2934,9 +2811,10 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E6341_FAMILY, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E6341 Family", @@ -515,7 +515,7 @@ Signed-off-by: David S. Miller .config_init = marvell_config_init, .config_aneg = m88e6390_config_aneg, .read_status = marvell_read_status, -@@ -2954,9 +2832,10 @@ static struct phy_driver marvell_drivers +@@ -2960,9 +2838,10 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E6390_FAMILY, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E6390 Family", @@ -527,7 +527,7 @@ Signed-off-by: David S. Miller .config_init = marvell_config_init, .config_aneg = m88e6390_config_aneg, .read_status = marvell_read_status, -@@ -2980,7 +2859,8 @@ static struct phy_driver marvell_drivers +@@ -2986,7 +2865,8 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E1340S, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E1340S", @@ -537,7 +537,7 @@ Signed-off-by: David S. Miller /* PHY_GBIT_FEATURES */ .config_init = marvell_config_init, .config_aneg = m88e1510_config_aneg, -@@ -3002,7 +2882,8 @@ static struct phy_driver marvell_drivers +@@ -3008,7 +2888,8 @@ static struct phy_driver marvell_drivers .phy_id = MARVELL_PHY_ID_88E1548P, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88E1548P", diff --git a/target/linux/generic/backport-5.10/713-v5.15-net-phy-marvell-add-SFP-support-for-88E1510.patch b/target/linux/generic/backport-5.10/713-v5.15-net-phy-marvell-add-SFP-support-for-88E1510.patch index 7fb78089f2..3e01e727e1 100644 --- a/target/linux/generic/backport-5.10/713-v5.15-net-phy-marvell-add-SFP-support-for-88E1510.patch +++ b/target/linux/generic/backport-5.10/713-v5.15-net-phy-marvell-add-SFP-support-for-88E1510.patch @@ -49,7 +49,7 @@ Signed-off-by: Jakub Kicinski #define MII_88E1510_GEN_CTRL_REG_1_RESET 0x8000 /* Soft reset */ #define MII_VCT5_TX_RX_MDI0_COUPLING 0x10 -@@ -2498,6 +2507,100 @@ static int marvell_probe(struct phy_devi +@@ -2504,6 +2513,100 @@ static int marvell_probe(struct phy_devi return marvell_hwmon_probe(phydev); } @@ -150,7 +150,7 @@ Signed-off-by: Jakub Kicinski static struct phy_driver marvell_drivers[] = { { .phy_id = MARVELL_PHY_ID_88E1101, -@@ -2704,7 +2807,7 @@ static struct phy_driver marvell_drivers +@@ -2710,7 +2813,7 @@ static struct phy_driver marvell_drivers .driver_data = DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), .features = PHY_GBIT_FIBRE_FEATURES, .flags = PHY_POLL_CABLE_TEST, diff --git a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 65619e0837..f2b04d4955 100644 --- a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -607,7 +607,7 @@ Signed-off-by: David S. Miller /* --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c -@@ -605,7 +605,6 @@ static int mac_probe(struct platform_dev +@@ -616,7 +616,6 @@ static int mac_probe(struct platform_dev struct platform_device *of_dev; struct resource res; struct mac_priv_s *priv; @@ -615,7 +615,7 @@ Signed-off-by: David S. Miller u32 val; u8 fman_id; phy_interface_t phy_if; -@@ -723,11 +722,9 @@ static int mac_probe(struct platform_dev +@@ -734,11 +733,9 @@ static int mac_probe(struct platform_dev priv->cell_index = (u8)val; /* Get the MAC address */ @@ -629,7 +629,7 @@ Signed-off-by: David S. Miller /* Get the port handles */ nph = of_count_phandle_with_args(mac_node, "fsl,fman-ports", NULL); -@@ -853,7 +850,7 @@ static int mac_probe(struct platform_dev +@@ -864,7 +861,7 @@ static int mac_probe(struct platform_dev if (err < 0) dev_err(dev, "fman_set_mac_active_pause() = %d\n", err); @@ -1608,7 +1608,7 @@ Signed-off-by: David S. Miller } --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c -@@ -1803,8 +1803,8 @@ static int axienet_probe(struct platform +@@ -1831,8 +1831,8 @@ static int axienet_probe(struct platform struct device_node *np; struct axienet_local *lp; struct net_device *ndev; @@ -1618,7 +1618,7 @@ Signed-off-by: David S. Miller int addr_width = 32; u32 value; -@@ -2004,13 +2004,14 @@ static int axienet_probe(struct platform +@@ -2032,13 +2032,14 @@ static int axienet_probe(struct platform dev_info(&pdev->dev, "Ethernet core IRQ not defined\n"); /* Retrieve the MAC address */ diff --git a/target/linux/generic/backport-5.10/850-v5.17-0001-PCI-pci-bridge-emul-Add-description-for-class_revisi.patch b/target/linux/generic/backport-5.10/850-v5.17-0001-PCI-pci-bridge-emul-Add-description-for-class_revisi.patch index 118606a791..19a4be2a9d 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0001-PCI-pci-bridge-emul-Add-description-for-class_revisi.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0001-PCI-pci-bridge-emul-Add-description-for-class_revisi.patch @@ -29,7 +29,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c -@@ -265,7 +265,11 @@ int pci_bridge_emul_init(struct pci_brid +@@ -284,7 +284,11 @@ int pci_bridge_emul_init(struct pci_brid { BUILD_BUG_ON(sizeof(bridge->conf) != PCI_BRIDGE_CONF_END); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0002-PCI-pci-bridge-emul-Add-definitions-for-missing-capa.patch b/target/linux/generic/backport-5.10/850-v5.17-0002-PCI-pci-bridge-emul-Add-definitions-for-missing-capa.patch index 2d8557b3f4..3dd82710e6 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0002-PCI-pci-bridge-emul-Add-definitions-for-missing-capa.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0002-PCI-pci-bridge-emul-Add-definitions-for-missing-capa.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c -@@ -251,6 +251,49 @@ struct pci_bridge_reg_behavior pcie_cap_ +@@ -270,6 +270,49 @@ struct pci_bridge_reg_behavior pcie_cap_ .ro = GENMASK(15, 0) | PCI_EXP_RTSTA_PENDING, .w1c = PCI_EXP_RTSTA_PME, }, diff --git a/target/linux/generic/backport-5.10/850-v5.17-0003-PCI-aardvark-Add-support-for-DEVCAP2-DEVCTL2-LNKCAP2.patch b/target/linux/generic/backport-5.10/850-v5.17-0003-PCI-aardvark-Add-support-for-DEVCAP2-DEVCTL2-LNKCAP2.patch index b98c0d16c9..ce38719009 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0003-PCI-aardvark-Add-support-for-DEVCAP2-DEVCTL2-LNKCAP2.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0003-PCI-aardvark-Add-support-for-DEVCAP2-DEVCTL2-LNKCAP2.patch @@ -21,8 +21,8 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -882,8 +882,13 @@ advk_pci_bridge_emul_pcie_conf_read(stru - case PCI_CAP_LIST_ID: +@@ -881,8 +881,13 @@ advk_pci_bridge_emul_pcie_conf_read(stru + case PCI_EXP_DEVCAP: case PCI_EXP_DEVCTL: + case PCI_EXP_DEVCAP2: @@ -35,7 +35,7 @@ Signed-off-by: Lorenzo Pieralisi default: return PCI_BRIDGE_EMUL_NOT_HANDLED; } -@@ -897,10 +902,6 @@ advk_pci_bridge_emul_pcie_conf_write(str +@@ -896,10 +901,6 @@ advk_pci_bridge_emul_pcie_conf_write(str struct advk_pcie *pcie = bridge->data; switch (reg) { @@ -46,7 +46,7 @@ Signed-off-by: Lorenzo Pieralisi case PCI_EXP_LNKCTL: advk_writel(pcie, new, PCIE_CORE_PCIEXP_CAP + reg); if (new & PCI_EXP_LNKCTL_RL) -@@ -922,6 +923,12 @@ advk_pci_bridge_emul_pcie_conf_write(str +@@ -921,6 +922,12 @@ advk_pci_bridge_emul_pcie_conf_write(str advk_writel(pcie, new, PCIE_ISR0_REG); break; diff --git a/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch b/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch index dc01c5f85d..66c7e60202 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch @@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Pieralisi /* Enable summary interrupt for GIC SPI source */ reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK); -@@ -1397,7 +1399,7 @@ static void advk_pcie_handle_msi(struct +@@ -1399,7 +1401,7 @@ static void advk_pcie_handle_msi(struct msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch b/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch index 45df1b9695..8870e47b40 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1696,11 +1696,13 @@ static int advk_pcie_remove(struct platf +@@ -1698,11 +1698,13 @@ static int advk_pcie_remove(struct platf struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); int i; diff --git a/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch b/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch index 5959d80592..f1c3f3bb13 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch @@ -19,7 +19,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1694,6 +1694,7 @@ static int advk_pcie_remove(struct platf +@@ -1696,6 +1696,7 @@ static int advk_pcie_remove(struct platf { struct advk_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); @@ -27,7 +27,7 @@ Signed-off-by: Lorenzo Pieralisi int i; /* Remove PCI bus with all devices */ -@@ -1702,6 +1703,11 @@ static int advk_pcie_remove(struct platf +@@ -1704,6 +1705,11 @@ static int advk_pcie_remove(struct platf pci_remove_root_bus(bridge->bus); pci_unlock_rescan_remove(); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch b/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch index 130bb701f8..7add045cab 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1708,6 +1708,27 @@ static int advk_pcie_remove(struct platf +@@ -1710,6 +1710,27 @@ static int advk_pcie_remove(struct platf val &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); advk_writel(pcie, val, PCIE_CORE_CMD_STATUS_REG); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch b/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch index 74d25d508b..f86d2bd61f 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1733,6 +1733,9 @@ static int advk_pcie_remove(struct platf +@@ -1735,6 +1735,9 @@ static int advk_pcie_remove(struct platf advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch b/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch index 26d8afdddd..1e9e74136c 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch @@ -20,7 +20,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1736,6 +1736,10 @@ static int advk_pcie_remove(struct platf +@@ -1738,6 +1738,10 @@ static int advk_pcie_remove(struct platf /* Free config space for emulated root bridge */ pci_bridge_emul_cleanup(&pcie->bridge); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch b/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch index 23346a9284..3b531deae0 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch @@ -20,7 +20,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1740,6 +1740,11 @@ static int advk_pcie_remove(struct platf +@@ -1742,6 +1742,11 @@ static int advk_pcie_remove(struct platf if (pcie->reset_gpio) gpiod_set_value_cansleep(pcie->reset_gpio, 1); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch b/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch index a7d5c014ab..6caa6eb362 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1749,6 +1749,9 @@ static int advk_pcie_remove(struct platf +@@ -1751,6 +1751,9 @@ static int advk_pcie_remove(struct platf for (i = 0; i < OB_WIN_COUNT; i++) advk_pcie_disable_ob_win(pcie, i); diff --git a/target/linux/generic/hack-5.10/259-regmap_dynamic.patch b/target/linux/generic/hack-5.10/259-regmap_dynamic.patch index 44112ce2f0..bc81a7285c 100644 --- a/target/linux/generic/hack-5.10/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-5.10/259-regmap_dynamic.patch @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -3297,3 +3298,5 @@ static int __init regmap_initcall(void) +@@ -3298,3 +3299,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); diff --git a/target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch index cf3bbd1f0f..0d1d3e1137 100644 --- a/target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ b/target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch @@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -7053,7 +7053,7 @@ static void __ref alloc_node_mem_map(str +@@ -7055,7 +7055,7 @@ static void __ref alloc_node_mem_map(str if (pgdat == NODE_DATA(0)) { mem_map = NODE_DATA(0)->node_mem_map; if (page_to_pfn(mem_map) != pgdat->node_start_pfn) diff --git a/target/linux/generic/pending-5.10/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-5.10/300-mips_expose_boot_raw.patch index cbc0d11293..706c5dee22 100644 --- a/target/linux/generic/pending-5.10/300-mips_expose_boot_raw.patch +++ b/target/linux/generic/pending-5.10/300-mips_expose_boot_raw.patch @@ -19,7 +19,7 @@ Acked-by: Rob Landley config CEVT_BCM1480 bool -@@ -3178,6 +3175,18 @@ choice +@@ -3182,6 +3179,18 @@ choice bool "Extend builtin kernel arguments with bootloader arguments" endchoice diff --git a/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index a2d84ac9a1..68edf37bf7 100644 --- a/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -53,7 +53,7 @@ Signed-off-by: Jonas Gorski --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c -@@ -141,6 +141,10 @@ const struct fib_prop fib_props[RTN_MAX +@@ -142,6 +142,10 @@ const struct fib_prop fib_props[RTN_MAX .error = -EINVAL, .scope = RT_SCOPE_NOWHERE, }, diff --git a/target/linux/generic/pending-5.10/850-0001-PCI-aardvark-Replace-custom-PCIE_CORE_INT_-macros-wi.patch b/target/linux/generic/pending-5.10/850-0001-PCI-aardvark-Replace-custom-PCIE_CORE_INT_-macros-wi.patch index c6d964eaa9..fecd19166c 100644 --- a/target/linux/generic/pending-5.10/850-0001-PCI-aardvark-Replace-custom-PCIE_CORE_INT_-macros-wi.patch +++ b/target/linux/generic/pending-5.10/850-0001-PCI-aardvark-Replace-custom-PCIE_CORE_INT_-macros-wi.patch @@ -29,12 +29,12 @@ Signed-off-by: Marek Behún /* PIO registers base address and register offsets */ #define PIO_BASE_ADDR 0x4000 #define PIO_CTRL (PIO_BASE_ADDR + 0x0) -@@ -967,7 +963,7 @@ static int advk_sw_pci_bridge_init(struc +@@ -966,7 +962,7 @@ static int advk_sw_pci_bridge_init(struc bridge->conf.pref_mem_limit = cpu_to_le16(PCI_PREF_RANGE_TYPE_64); /* Support interrupt A for MSI feature */ - bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE; + bridge->conf.intpin = PCI_INTERRUPT_INTA; - /* Indicates supports for Completion Retry Status */ - bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); + /* Aardvark HW provides PCIe Capability structure in version 2 */ + bridge->pcie_conf.cap = cpu_to_le16(2); diff --git a/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch b/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch index b2d32f5566..72a432fc06 100644 --- a/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch +++ b/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch @@ -27,7 +27,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1391,7 +1391,7 @@ static void advk_pcie_remove_irq_domain( +@@ -1393,7 +1393,7 @@ static void advk_pcie_remove_irq_domain( static void advk_pcie_handle_msi(struct advk_pcie *pcie) { u32 msi_val, msi_mask, msi_status, msi_idx; @@ -36,7 +36,7 @@ Signed-off-by: Marek Behún msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); -@@ -1401,13 +1401,12 @@ static void advk_pcie_handle_msi(struct +@@ -1403,13 +1403,12 @@ static void advk_pcie_handle_msi(struct if (!(BIT(msi_idx) & msi_status)) continue; diff --git a/target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch b/target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch index 0f1183ac4e..8b2d07089a 100644 --- a/target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch +++ b/target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch @@ -32,7 +32,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1187,7 +1187,7 @@ static void advk_msi_irq_compose_msi_msg +@@ -1189,7 +1189,7 @@ static void advk_msi_irq_compose_msi_msg msg->address_lo = lower_32_bits(msi_msg); msg->address_hi = upper_32_bits(msi_msg); @@ -41,7 +41,7 @@ Signed-off-by: Marek Behún } static int advk_msi_set_affinity(struct irq_data *irq_data, -@@ -1204,15 +1204,11 @@ static int advk_msi_irq_domain_alloc(str +@@ -1206,15 +1206,11 @@ static int advk_msi_irq_domain_alloc(str int hwirq, i; mutex_lock(&pcie->msi_used_lock); @@ -61,7 +61,7 @@ Signed-off-by: Marek Behún for (i = 0; i < nr_irqs; i++) irq_domain_set_info(domain, virq + i, hwirq + i, -@@ -1230,7 +1226,7 @@ static void advk_msi_irq_domain_free(str +@@ -1232,7 +1228,7 @@ static void advk_msi_irq_domain_free(str struct advk_pcie *pcie = domain->host_data; mutex_lock(&pcie->msi_used_lock); diff --git a/target/linux/generic/pending-5.10/850-0004-PCI-aardvark-Rewrite-IRQ-code-to-chained-IRQ-handler.patch b/target/linux/generic/pending-5.10/850-0004-PCI-aardvark-Rewrite-IRQ-code-to-chained-IRQ-handler.patch index e6ae3602ca..47a26ceeb8 100644 --- a/target/linux/generic/pending-5.10/850-0004-PCI-aardvark-Rewrite-IRQ-code-to-chained-IRQ-handler.patch +++ b/target/linux/generic/pending-5.10/850-0004-PCI-aardvark-Rewrite-IRQ-code-to-chained-IRQ-handler.patch @@ -31,7 +31,7 @@ Signed-off-by: Marek Behún struct irq_domain *irq_domain; struct irq_chip irq_chip; raw_spinlock_t irq_lock; -@@ -1440,21 +1441,26 @@ static void advk_pcie_handle_int(struct +@@ -1442,21 +1443,26 @@ static void advk_pcie_handle_int(struct } } @@ -68,7 +68,7 @@ Signed-off-by: Marek Behún } static void __maybe_unused advk_pcie_disable_phy(struct advk_pcie *pcie) -@@ -1521,7 +1527,7 @@ static int advk_pcie_probe(struct platfo +@@ -1523,7 +1529,7 @@ static int advk_pcie_probe(struct platfo struct advk_pcie *pcie; struct pci_host_bridge *bridge; struct resource_entry *entry; @@ -77,7 +77,7 @@ Signed-off-by: Marek Behún bridge = devm_pci_alloc_host_bridge(dev, sizeof(struct advk_pcie)); if (!bridge) -@@ -1609,17 +1615,9 @@ static int advk_pcie_probe(struct platfo +@@ -1611,17 +1617,9 @@ static int advk_pcie_probe(struct platfo if (IS_ERR(pcie->base)) return PTR_ERR(pcie->base); @@ -98,7 +98,7 @@ Signed-off-by: Marek Behún pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node, "reset-gpios", 0, -@@ -1668,11 +1666,14 @@ static int advk_pcie_probe(struct platfo +@@ -1670,11 +1668,14 @@ static int advk_pcie_probe(struct platfo return ret; } @@ -113,7 +113,7 @@ Signed-off-by: Marek Behún advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); return ret; -@@ -1720,6 +1721,9 @@ static int advk_pcie_remove(struct platf +@@ -1722,6 +1723,9 @@ static int advk_pcie_remove(struct platf advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG); advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG); diff --git a/target/linux/generic/pending-5.10/850-0005-PCI-aardvark-Check-return-value-of-generic_handle_do.patch b/target/linux/generic/pending-5.10/850-0005-PCI-aardvark-Check-return-value-of-generic_handle_do.patch index 66e9b32e4d..9cc37f727e 100644 --- a/target/linux/generic/pending-5.10/850-0005-PCI-aardvark-Check-return-value-of-generic_handle_do.patch +++ b/target/linux/generic/pending-5.10/850-0005-PCI-aardvark-Check-return-value-of-generic_handle_do.patch @@ -18,7 +18,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1437,7 +1437,9 @@ static void advk_pcie_handle_int(struct +@@ -1439,7 +1439,9 @@ static void advk_pcie_handle_int(struct PCIE_ISR1_REG); virq = irq_find_mapping(pcie->irq_domain, i); diff --git a/target/linux/generic/pending-5.10/850-0006-PCI-aardvark-Make-MSI-irq_chip-structures-static-dri.patch b/target/linux/generic/pending-5.10/850-0006-PCI-aardvark-Make-MSI-irq_chip-structures-static-dri.patch index 13734cd8fa..154b11290a 100644 --- a/target/linux/generic/pending-5.10/850-0006-PCI-aardvark-Make-MSI-irq_chip-structures-static-dri.patch +++ b/target/linux/generic/pending-5.10/850-0006-PCI-aardvark-Make-MSI-irq_chip-structures-static-dri.patch @@ -34,7 +34,7 @@ Signed-off-by: Marek Behún struct msi_domain_info msi_domain_info; DECLARE_BITMAP(msi_used, MSI_IRQ_NUM); struct mutex msi_used_lock; -@@ -1197,6 +1195,12 @@ static int advk_msi_set_affinity(struct +@@ -1199,6 +1197,12 @@ static int advk_msi_set_affinity(struct return -EINVAL; } @@ -47,7 +47,7 @@ Signed-off-by: Marek Behún static int advk_msi_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs, void *args) -@@ -1213,7 +1217,7 @@ static int advk_msi_irq_domain_alloc(str +@@ -1215,7 +1219,7 @@ static int advk_msi_irq_domain_alloc(str for (i = 0; i < nr_irqs; i++) irq_domain_set_info(domain, virq + i, hwirq + i, @@ -56,7 +56,7 @@ Signed-off-by: Marek Behún domain->host_data, handle_simple_irq, NULL, NULL); -@@ -1283,29 +1287,23 @@ static const struct irq_domain_ops advk_ +@@ -1285,29 +1289,23 @@ static const struct irq_domain_ops advk_ .xlate = irq_domain_xlate_onecell, }; diff --git a/target/linux/generic/pending-5.10/850-0007-PCI-aardvark-Make-msi_domain_info-structure-a-static.patch b/target/linux/generic/pending-5.10/850-0007-PCI-aardvark-Make-msi_domain_info-structure-a-static.patch index 54cb4cf790..2f15b5b8d6 100644 --- a/target/linux/generic/pending-5.10/850-0007-PCI-aardvark-Make-msi_domain_info-structure-a-static.patch +++ b/target/linux/generic/pending-5.10/850-0007-PCI-aardvark-Make-msi_domain_info-structure-a-static.patch @@ -25,7 +25,7 @@ Signed-off-by: Marek Behún DECLARE_BITMAP(msi_used, MSI_IRQ_NUM); struct mutex msi_used_lock; u16 msi_msg; -@@ -1291,20 +1290,20 @@ static struct irq_chip advk_msi_irq_chip +@@ -1293,20 +1292,20 @@ static struct irq_chip advk_msi_irq_chip .name = "advk-MSI", }; @@ -52,7 +52,7 @@ Signed-off-by: Marek Behún msi_msg_phys = virt_to_phys(&pcie->msi_msg); advk_writel(pcie, lower_32_bits(msi_msg_phys), -@@ -1320,7 +1319,8 @@ static int advk_pcie_init_msi_irq_domain +@@ -1322,7 +1321,8 @@ static int advk_pcie_init_msi_irq_domain pcie->msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(node), diff --git a/target/linux/generic/pending-5.10/850-0008-PCI-aardvark-Use-dev_fwnode-instead-of-of_node_to_fw.patch b/target/linux/generic/pending-5.10/850-0008-PCI-aardvark-Use-dev_fwnode-instead-of-of_node_to_fw.patch index 7676855816..73f7cb9476 100644 --- a/target/linux/generic/pending-5.10/850-0008-PCI-aardvark-Use-dev_fwnode-instead-of-of_node_to_fw.patch +++ b/target/linux/generic/pending-5.10/850-0008-PCI-aardvark-Use-dev_fwnode-instead-of-of_node_to_fw.patch @@ -21,7 +21,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1299,7 +1299,6 @@ static struct msi_domain_info advk_msi_d +@@ -1301,7 +1301,6 @@ static struct msi_domain_info advk_msi_d static int advk_pcie_init_msi_irq_domain(struct advk_pcie *pcie) { struct device *dev = &pcie->pdev->dev; @@ -29,7 +29,7 @@ Signed-off-by: Marek Behún phys_addr_t msi_msg_phys; mutex_init(&pcie->msi_used_lock); -@@ -1318,7 +1317,7 @@ static int advk_pcie_init_msi_irq_domain +@@ -1320,7 +1319,7 @@ static int advk_pcie_init_msi_irq_domain return -ENOMEM; pcie->msi_domain = diff --git a/target/linux/generic/pending-5.10/850-0010-PCI-aardvark-Add-support-for-masking-MSI-interrupts.patch b/target/linux/generic/pending-5.10/850-0010-PCI-aardvark-Add-support-for-masking-MSI-interrupts.patch index bc4cc7b4fc..808094ebd8 100644 --- a/target/linux/generic/pending-5.10/850-0010-PCI-aardvark-Add-support-for-masking-MSI-interrupts.patch +++ b/target/linux/generic/pending-5.10/850-0010-PCI-aardvark-Add-support-for-masking-MSI-interrupts.patch @@ -43,7 +43,7 @@ Signed-off-by: Marek Behún /* Unmask summary MSI interrupt */ reg = advk_readl(pcie, PCIE_ISR0_MASK_REG); -@@ -1196,10 +1195,52 @@ static int advk_msi_set_affinity(struct +@@ -1198,10 +1197,52 @@ static int advk_msi_set_affinity(struct return -EINVAL; } @@ -96,7 +96,7 @@ Signed-off-by: Marek Behún }; static int advk_msi_irq_domain_alloc(struct irq_domain *domain, -@@ -1289,7 +1330,9 @@ static const struct irq_domain_ops advk_ +@@ -1291,7 +1332,9 @@ static const struct irq_domain_ops advk_ }; static struct irq_chip advk_msi_irq_chip = { @@ -107,7 +107,7 @@ Signed-off-by: Marek Behún }; static struct msi_domain_info advk_msi_domain_info = { -@@ -1303,6 +1346,7 @@ static int advk_pcie_init_msi_irq_domain +@@ -1305,6 +1348,7 @@ static int advk_pcie_init_msi_irq_domain struct device *dev = &pcie->pdev->dev; phys_addr_t msi_msg_phys; diff --git a/target/linux/generic/pending-5.10/850-0011-PCI-aardvark-Fix-setting-MSI-address.patch b/target/linux/generic/pending-5.10/850-0011-PCI-aardvark-Fix-setting-MSI-address.patch index b5ddfdd97d..4807f24a12 100644 --- a/target/linux/generic/pending-5.10/850-0011-PCI-aardvark-Fix-setting-MSI-address.patch +++ b/target/linux/generic/pending-5.10/850-0011-PCI-aardvark-Fix-setting-MSI-address.patch @@ -56,7 +56,7 @@ Cc: stable@vger.kernel.org # f21a8b1b6837 ("PCI: aardvark: Move to MSI handling /* Enable MSI */ reg = advk_readl(pcie, PCIE_CORE_CTRL2_REG); reg |= PCIE_CORE_CTRL2_MSI_ENABLE; -@@ -1182,10 +1187,10 @@ static void advk_msi_irq_compose_msi_msg +@@ -1184,10 +1189,10 @@ static void advk_msi_irq_compose_msi_msg struct msi_msg *msg) { struct advk_pcie *pcie = irq_data_get_irq_chip_data(data); @@ -70,7 +70,7 @@ Cc: stable@vger.kernel.org # f21a8b1b6837 ("PCI: aardvark: Move to MSI handling msg->data = data->hwirq; } -@@ -1344,18 +1349,10 @@ static struct msi_domain_info advk_msi_d +@@ -1346,18 +1351,10 @@ static struct msi_domain_info advk_msi_d static int advk_pcie_init_msi_irq_domain(struct advk_pcie *pcie) { struct device *dev = &pcie->pdev->dev; diff --git a/target/linux/generic/pending-5.10/850-0012-PCI-aardvark-Enable-MSI-X-support.patch b/target/linux/generic/pending-5.10/850-0012-PCI-aardvark-Enable-MSI-X-support.patch index 6c80091a80..20757c7a80 100644 --- a/target/linux/generic/pending-5.10/850-0012-PCI-aardvark-Enable-MSI-X-support.patch +++ b/target/linux/generic/pending-5.10/850-0012-PCI-aardvark-Enable-MSI-X-support.patch @@ -27,7 +27,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1342,7 +1342,7 @@ static struct irq_chip advk_msi_irq_chip +@@ -1344,7 +1344,7 @@ static struct irq_chip advk_msi_irq_chip static struct msi_domain_info advk_msi_domain_info = { .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | diff --git a/target/linux/generic/pending-5.10/850-0013-PCI-aardvark-Add-support-for-ERR-interrupt-on-emulat.patch b/target/linux/generic/pending-5.10/850-0013-PCI-aardvark-Add-support-for-ERR-interrupt-on-emulat.patch index 5beca606d0..eb27610aa3 100644 --- a/target/linux/generic/pending-5.10/850-0013-PCI-aardvark-Add-support-for-ERR-interrupt-on-emulat.patch +++ b/target/linux/generic/pending-5.10/850-0013-PCI-aardvark-Add-support-for-ERR-interrupt-on-emulat.patch @@ -78,7 +78,7 @@ Signed-off-by: Marek Behún if (mask & (PCI_BRIDGE_CTL_BUS_RESET << 16)) { u32 val = advk_readl(pcie, PCIE_CORE_CTRL1_REG); if (new & (PCI_BRIDGE_CTL_BUS_RESET << 16)) -@@ -1464,6 +1485,19 @@ static void advk_pcie_handle_int(struct +@@ -1466,6 +1487,19 @@ static void advk_pcie_handle_int(struct isr1_mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); isr1_status = isr1_val & ((~isr1_mask) & PCIE_ISR1_ALL_MASK); diff --git a/target/linux/generic/pending-5.10/850-0015-PCI-aardvark-Optimize-writing-PCI_EXP_RTCTL_PMEIE-an.patch b/target/linux/generic/pending-5.10/850-0015-PCI-aardvark-Optimize-writing-PCI_EXP_RTCTL_PMEIE-an.patch index 9b4c6ef233..5ed809def2 100644 --- a/target/linux/generic/pending-5.10/850-0015-PCI-aardvark-Optimize-writing-PCI_EXP_RTCTL_PMEIE-an.patch +++ b/target/linux/generic/pending-5.10/850-0015-PCI-aardvark-Optimize-writing-PCI_EXP_RTCTL_PMEIE-an.patch @@ -19,7 +19,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -933,19 +933,21 @@ advk_pci_bridge_emul_pcie_conf_write(str +@@ -932,19 +932,21 @@ advk_pci_bridge_emul_pcie_conf_write(str advk_pcie_wait_for_retrain(pcie); break; diff --git a/target/linux/generic/pending-5.10/850-0016-PCI-aardvark-Add-support-for-PME-interrupts.patch b/target/linux/generic/pending-5.10/850-0016-PCI-aardvark-Add-support-for-PME-interrupts.patch index 920178b4a6..4272b6dd6e 100644 --- a/target/linux/generic/pending-5.10/850-0016-PCI-aardvark-Add-support-for-PME-interrupts.patch +++ b/target/linux/generic/pending-5.10/850-0016-PCI-aardvark-Add-support-for-PME-interrupts.patch @@ -25,7 +25,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1489,6 +1489,19 @@ static void advk_pcie_handle_int(struct +@@ -1491,6 +1491,19 @@ static void advk_pcie_handle_int(struct isr1_mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); isr1_status = isr1_val & ((~isr1_mask) & PCIE_ISR1_ALL_MASK); diff --git a/target/linux/generic/pending-5.10/850-0017-PCI-aardvark-Fix-support-for-PME-requester-on-emulat.patch b/target/linux/generic/pending-5.10/850-0017-PCI-aardvark-Fix-support-for-PME-requester-on-emulat.patch index 04c4bd6f57..6aa7dcbd76 100644 --- a/target/linux/generic/pending-5.10/850-0017-PCI-aardvark-Fix-support-for-PME-requester-on-emulat.patch +++ b/target/linux/generic/pending-5.10/850-0017-PCI-aardvark-Fix-support-for-PME-requester-on-emulat.patch @@ -80,7 +80,7 @@ Signed-off-by: Marek Behún case PCI_EXP_LNKCAP: { u32 val = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); -@@ -933,22 +927,19 @@ advk_pci_bridge_emul_pcie_conf_write(str +@@ -932,22 +926,19 @@ advk_pci_bridge_emul_pcie_conf_write(str advk_pcie_wait_for_retrain(pcie); break; @@ -114,7 +114,7 @@ Signed-off-by: Marek Behún case PCI_EXP_DEVCTL: case PCI_EXP_DEVCTL2: -@@ -1450,6 +1441,34 @@ static void advk_pcie_remove_irq_domain( +@@ -1452,6 +1443,34 @@ static void advk_pcie_remove_irq_domain( irq_domain_remove(pcie->irq_domain); } @@ -149,7 +149,7 @@ Signed-off-by: Marek Behún static void advk_pcie_handle_msi(struct advk_pcie *pcie) { u32 msi_val, msi_mask, msi_status, msi_idx; -@@ -1489,18 +1508,9 @@ static void advk_pcie_handle_int(struct +@@ -1491,18 +1510,9 @@ static void advk_pcie_handle_int(struct isr1_mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); isr1_status = isr1_val & ((~isr1_mask) & PCIE_ISR1_ALL_MASK); diff --git a/target/linux/generic/pending-5.10/850-0018-PCI-aardvark-Use-separate-INTA-interrupt-for-emulate.patch b/target/linux/generic/pending-5.10/850-0018-PCI-aardvark-Use-separate-INTA-interrupt-for-emulate.patch index 7f4d7a1bad..e9f65aca23 100644 --- a/target/linux/generic/pending-5.10/850-0018-PCI-aardvark-Use-separate-INTA-interrupt-for-emulate.patch +++ b/target/linux/generic/pending-5.10/850-0018-PCI-aardvark-Use-separate-INTA-interrupt-for-emulate.patch @@ -41,7 +41,7 @@ Signed-off-by: Marek Behún struct irq_domain *irq_domain; struct irq_chip irq_chip; raw_spinlock_t irq_lock; -@@ -1441,6 +1442,44 @@ static void advk_pcie_remove_irq_domain( +@@ -1443,6 +1444,44 @@ static void advk_pcie_remove_irq_domain( irq_domain_remove(pcie->irq_domain); } @@ -86,7 +86,7 @@ Signed-off-by: Marek Behún static void advk_pcie_handle_pme(struct advk_pcie *pcie) { u32 requester = advk_readl(pcie, PCIE_MSG_LOG_REG) >> 16; -@@ -1463,7 +1502,7 @@ static void advk_pcie_handle_pme(struct +@@ -1465,7 +1504,7 @@ static void advk_pcie_handle_pme(struct if (!(le16_to_cpu(pcie->bridge.pcie_conf.rootctl) & PCI_EXP_RTCTL_PMEIE)) return; @@ -95,7 +95,7 @@ Signed-off-by: Marek Behún if (generic_handle_irq(virq) == -EINVAL) dev_err_ratelimited(&pcie->pdev->dev, "unhandled PME IRQ\n"); } -@@ -1520,7 +1559,7 @@ static void advk_pcie_handle_int(struct +@@ -1522,7 +1561,7 @@ static void advk_pcie_handle_int(struct * Aardvark HW returns zero for PCI_ERR_ROOT_AER_IRQ, so use * PCIe interrupt 0 */ @@ -104,7 +104,7 @@ Signed-off-by: Marek Behún if (generic_handle_irq(virq) == -EINVAL) dev_err_ratelimited(&pcie->pdev->dev, "unhandled ERR IRQ\n"); } -@@ -1566,6 +1605,21 @@ static void advk_pcie_irq_handler(struct +@@ -1568,6 +1607,21 @@ static void advk_pcie_irq_handler(struct chained_irq_exit(chip, desc); } @@ -126,7 +126,7 @@ Signed-off-by: Marek Behún static void __maybe_unused advk_pcie_disable_phy(struct advk_pcie *pcie) { phy_power_off(pcie->phy); -@@ -1769,14 +1823,24 @@ static int advk_pcie_probe(struct platfo +@@ -1771,14 +1825,24 @@ static int advk_pcie_probe(struct platfo return ret; } @@ -151,7 +151,7 @@ Signed-off-by: Marek Behún advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); return ret; -@@ -1828,6 +1892,7 @@ static int advk_pcie_remove(struct platf +@@ -1830,6 +1894,7 @@ static int advk_pcie_remove(struct platf irq_set_chained_handler_and_data(pcie->irq, NULL, NULL); /* Remove IRQ domains */ diff --git a/target/linux/generic/pending-5.10/850-0019-PCI-aardvark-Remove-irq_mask_ack-callback-for-INTx-i.patch b/target/linux/generic/pending-5.10/850-0019-PCI-aardvark-Remove-irq_mask_ack-callback-for-INTx-i.patch index dc6503b2dd..75f31ba19e 100644 --- a/target/linux/generic/pending-5.10/850-0019-PCI-aardvark-Remove-irq_mask_ack-callback-for-INTx-i.patch +++ b/target/linux/generic/pending-5.10/850-0019-PCI-aardvark-Remove-irq_mask_ack-callback-for-INTx-i.patch @@ -19,7 +19,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1420,7 +1420,6 @@ static int advk_pcie_init_irq_domain(str +@@ -1422,7 +1422,6 @@ static int advk_pcie_init_irq_domain(str } irq_chip->irq_mask = advk_pcie_irq_mask; diff --git a/target/linux/generic/pending-5.10/850-0020-PCI-aardvark-Don-t-mask-irq-when-mapping.patch b/target/linux/generic/pending-5.10/850-0020-PCI-aardvark-Don-t-mask-irq-when-mapping.patch index c26e7e5b9d..5583dc1b6f 100644 --- a/target/linux/generic/pending-5.10/850-0020-PCI-aardvark-Don-t-mask-irq-when-mapping.patch +++ b/target/linux/generic/pending-5.10/850-0020-PCI-aardvark-Don-t-mask-irq-when-mapping.patch @@ -17,7 +17,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1337,7 +1337,6 @@ static int advk_pcie_irq_map(struct irq_ +@@ -1339,7 +1339,6 @@ static int advk_pcie_irq_map(struct irq_ { struct advk_pcie *pcie = h->host_data; diff --git a/target/linux/generic/pending-5.10/850-0021-PCI-aardvark-Drop-__maybe_unused-from-advk_pcie_disa.patch b/target/linux/generic/pending-5.10/850-0021-PCI-aardvark-Drop-__maybe_unused-from-advk_pcie_disa.patch index 79ea7a8d78..f359663ca4 100644 --- a/target/linux/generic/pending-5.10/850-0021-PCI-aardvark-Drop-__maybe_unused-from-advk_pcie_disa.patch +++ b/target/linux/generic/pending-5.10/850-0021-PCI-aardvark-Drop-__maybe_unused-from-advk_pcie_disa.patch @@ -17,7 +17,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1618,7 +1618,7 @@ static int advk_pcie_map_irq(const struc +@@ -1620,7 +1620,7 @@ static int advk_pcie_map_irq(const struc return of_irq_parse_and_map_pci(dev, slot, pin); } diff --git a/target/linux/generic/pending-5.10/850-0022-PCI-aardvark-Update-comment-about-link-going-down-af.patch b/target/linux/generic/pending-5.10/850-0022-PCI-aardvark-Update-comment-about-link-going-down-af.patch index 74769e7f5b..cc489ebc8a 100644 --- a/target/linux/generic/pending-5.10/850-0022-PCI-aardvark-Update-comment-about-link-going-down-af.patch +++ b/target/linux/generic/pending-5.10/850-0022-PCI-aardvark-Update-comment-about-link-going-down-af.patch @@ -18,7 +18,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1003,8 +1003,12 @@ static bool advk_pcie_valid_device(struc +@@ -1005,8 +1005,12 @@ static bool advk_pcie_valid_device(struc return false; /* diff --git a/target/linux/generic/pending-5.10/850-0023-PCI-aardvark-Make-main-irq_chip-structure-a-static-d.patch b/target/linux/generic/pending-5.10/850-0023-PCI-aardvark-Make-main-irq_chip-structure-a-static-d.patch index d5fbcdc787..a5e2d8a3dd 100644 --- a/target/linux/generic/pending-5.10/850-0023-PCI-aardvark-Make-main-irq_chip-structure-a-static-d.patch +++ b/target/linux/generic/pending-5.10/850-0023-PCI-aardvark-Make-main-irq_chip-structure-a-static-d.patch @@ -41,7 +41,7 @@ Signed-off-by: Marek Behún raw_spinlock_t irq_lock; struct irq_domain *msi_domain; struct irq_domain *msi_inner_domain; -@@ -1336,14 +1335,19 @@ static void advk_pcie_irq_unmask(struct +@@ -1338,14 +1337,19 @@ static void advk_pcie_irq_unmask(struct raw_spin_unlock_irqrestore(&pcie->irq_lock, flags); } @@ -63,7 +63,7 @@ Signed-off-by: Marek Behún irq_set_chip_data(virq, pcie); return 0; -@@ -1402,7 +1406,6 @@ static int advk_pcie_init_irq_domain(str +@@ -1404,7 +1408,6 @@ static int advk_pcie_init_irq_domain(str struct device *dev = &pcie->pdev->dev; struct device_node *node = dev->of_node; struct device_node *pcie_intc_node; @@ -71,7 +71,7 @@ Signed-off-by: Marek Behún int ret = 0; raw_spin_lock_init(&pcie->irq_lock); -@@ -1413,28 +1416,14 @@ static int advk_pcie_init_irq_domain(str +@@ -1415,28 +1418,14 @@ static int advk_pcie_init_irq_domain(str return -ENODEV; } diff --git a/target/linux/generic/pending-5.10/851-0006-Revert-PCI-aardvark-Fix-initialization-with-old-Marv.patch b/target/linux/generic/pending-5.10/851-0006-Revert-PCI-aardvark-Fix-initialization-with-old-Marv.patch index 7741502b20..857ee66a31 100644 --- a/target/linux/generic/pending-5.10/851-0006-Revert-PCI-aardvark-Fix-initialization-with-old-Marv.patch +++ b/target/linux/generic/pending-5.10/851-0006-Revert-PCI-aardvark-Fix-initialization-with-old-Marv.patch @@ -23,7 +23,7 @@ Acked-by: Miquel Raynal --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1635,9 +1635,7 @@ static int advk_pcie_enable_phy(struct a +@@ -1637,9 +1637,7 @@ static int advk_pcie_enable_phy(struct a } ret = phy_power_on(pcie->phy); diff --git a/target/linux/generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch b/target/linux/generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch new file mode 100644 index 0000000000..fcc3caa7d5 --- /dev/null +++ b/target/linux/generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch @@ -0,0 +1,52 @@ +From 8af60f5b0aa5b33525379d2859c8581b3472f9ea Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 28 Jan 2022 13:25:46 +0000 +Subject: [PATCH] Revert "ASoC: mediatek: Check for error clk pointer" + +This reverts commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e. +--- + drivers/soc/mediatek/mtk-scpsys.c | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +--- a/drivers/soc/mediatek/mtk-scpsys.c ++++ b/drivers/soc/mediatek/mtk-scpsys.c +@@ -411,17 +411,12 @@ out: + return ret; + } + +-static int init_clks(struct platform_device *pdev, struct clk **clk) ++static void init_clks(struct platform_device *pdev, struct clk **clk) + { + int i; + +- for (i = CLK_NONE + 1; i < CLK_MAX; i++) { ++ for (i = CLK_NONE + 1; i < CLK_MAX; i++) + clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); +- if (IS_ERR(clk[i])) +- return PTR_ERR(clk[i]); +- } +- +- return 0; + } + + static struct scp *init_scp(struct platform_device *pdev, +@@ -431,7 +426,7 @@ static struct scp *init_scp(struct platf + { + struct genpd_onecell_data *pd_data; + struct resource *res; +- int i, j, ret; ++ int i, j; + struct scp *scp; + struct clk *clk[CLK_MAX]; + +@@ -486,9 +481,7 @@ static struct scp *init_scp(struct platf + + pd_data->num_domains = num; + +- ret = init_clks(pdev, clk); +- if (ret) +- return ERR_PTR(ret); ++ init_clks(pdev, clk); + + for (i = 0; i < num; i++) { + struct scp_domain *scpd = &scp->domains[i]; diff --git a/target/linux/ipq40xx/patches-5.10/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch b/target/linux/ipq40xx/patches-5.10/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch index b2239d82dc..1aa5a9f386 100644 --- a/target/linux/ipq40xx/patches-5.10/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch +++ b/target/linux/ipq40xx/patches-5.10/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch @@ -22,7 +22,7 @@ Signed-off-by: John Thomson --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S -@@ -601,6 +601,41 @@ not_relocated: mov r0, #0 +@@ -602,6 +602,41 @@ not_relocated: mov r0, #0 bic r4, r4, #1 blne cache_on diff --git a/target/linux/lantiq/patches-5.10/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-5.10/0152-lantiq-VPE.patch index 71e9886d2e..c3b63188a7 100644 --- a/target/linux/lantiq/patches-5.10/0152-lantiq-VPE.patch +++ b/target/linux/lantiq/patches-5.10/0152-lantiq-VPE.patch @@ -1,6 +1,6 @@ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -2434,6 +2434,12 @@ config MIPS_VPE_LOADER +@@ -2438,6 +2438,12 @@ config MIPS_VPE_LOADER Includes a loader for loading an elf relocatable object onto another VPE and running it. diff --git a/target/linux/mvebu/patches-5.10/801-pci-mvebu-time-out-reset-on-link-up.patch b/target/linux/mvebu/patches-5.10/801-pci-mvebu-time-out-reset-on-link-up.patch index 42f890e48c..a5e49552e9 100644 --- a/target/linux/mvebu/patches-5.10/801-pci-mvebu-time-out-reset-on-link-up.patch +++ b/target/linux/mvebu/patches-5.10/801-pci-mvebu-time-out-reset-on-link-up.patch @@ -13,7 +13,7 @@ Signed-off-by: Russell King --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c -@@ -933,6 +933,7 @@ static int mvebu_pcie_powerup(struct mve +@@ -941,6 +941,7 @@ static int mvebu_pcie_powerup(struct mve if (port->reset_gpio) { u32 reset_udelay = PCI_PM_D3COLD_WAIT * 1000; @@ -21,7 +21,7 @@ Signed-off-by: Russell King of_property_read_u32(port->dn, "reset-delay-us", &reset_udelay); -@@ -940,7 +941,13 @@ static int mvebu_pcie_powerup(struct mve +@@ -948,7 +949,13 @@ static int mvebu_pcie_powerup(struct mve udelay(100); gpiod_set_value_cansleep(port->reset_gpio, 0); @@ -36,7 +36,7 @@ Signed-off-by: Russell King } return 0; -@@ -1100,15 +1107,16 @@ static int mvebu_pcie_probe(struct platf +@@ -1108,15 +1115,16 @@ static int mvebu_pcie_probe(struct platf if (!child) continue; diff --git a/target/linux/octeon/patches-5.10/130-itus_shield_support.patch b/target/linux/octeon/patches-5.10/130-itus_shield_support.patch index 37c75bbcd1..15f514209d 100644 --- a/target/linux/octeon/patches-5.10/130-itus_shield_support.patch +++ b/target/linux/octeon/patches-5.10/130-itus_shield_support.patch @@ -20,7 +20,7 @@ } --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c -@@ -771,7 +771,7 @@ int __init octeon_prune_device_tree(void +@@ -773,7 +773,7 @@ int __init octeon_prune_device_tree(void if (fdt_check_header(initial_boot_params)) panic("Corrupt Device Tree."); diff --git a/target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch index c7e39e07b7..2637343999 100644 --- a/target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch +++ b/target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch @@ -22,7 +22,7 @@ Signed-off-by: Tim Harvey #include #include #include -@@ -5769,3 +5770,34 @@ static void nvidia_ion_ahci_fixup(struct +@@ -5772,3 +5773,34 @@ static void nvidia_ion_ahci_fixup(struct pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); From b9736cb78c508dfeda7178973fe4fb9eb12c6a1b Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Sun, 30 Jan 2022 20:25:58 +0000 Subject: [PATCH 075/144] kernel: bump 5.10 to 5.10.95 Patches automatically rebased. Signed-off-by: Rui Salvaterra --- include/kernel-5.10 | 4 ++-- .../401-mtd-nor-support-mtd-name-from-device-tree.patch | 4 ++-- .../401-mtd-nor-support-mtd-name-from-device-tree.patch | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/kernel-5.10 b/include/kernel-5.10 index 46fe028757..b21ac55771 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .94 -LINUX_KERNEL_HASH-5.10.94 = 28ff44aa4a9a8a1ea52ae74e448da6174ca4ff042ddc202e36b157c951cd7508 +LINUX_VERSION-5.10 = .95 +LINUX_KERNEL_HASH-5.10.95 = c8d9daf94e2784ddc9cbb49936c89a20415aa02faa2c4ab4a832ab6d8c63fc23 diff --git a/target/linux/ath79/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch index b85ecef383..3beca822b5 100644 --- a/target/linux/ath79/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -3189,6 +3189,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3147,6 +3147,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -3243,7 +3244,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3201,7 +3202,12 @@ int spi_nor_scan(struct spi_nor *nor, co if (ret) return ret; diff --git a/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch index b85ecef383..3beca822b5 100644 --- a/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -3189,6 +3189,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3147,6 +3147,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -3243,7 +3244,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3201,7 +3202,12 @@ int spi_nor_scan(struct spi_nor *nor, co if (ret) return ret; From ff97fb98e3176aef0378318d7ff52aaa85bfeb48 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Tue, 1 Feb 2022 20:07:47 +0000 Subject: [PATCH 076/144] kernel: bump 5.10 to 5.10.96 Patches automatically rebased. Signed-off-by: Rui Salvaterra --- include/kernel-5.10 | 4 ++-- .../910-unaligned_access_hacks.patch | 2 +- ...ing-for-updating-interrupt-endpoint-int.patch | 2 +- ...split-out-the-BCM54213PE-from-the-BCM54.patch | 2 +- ...orwarding-path-from-virtual-netdevice-a.patch | 2 +- ...ss-the-dst-buffer-to-of_get_mac_address.patch | 2 +- .../generic/hack-5.10/902-debloat_proc.patch | 6 +++--- .../pending-5.10/630-packet_socket_type.patch | 16 ++++++++-------- ...mmac-explicitly-deassert-gmac-ahb-reset.patch | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/kernel-5.10 b/include/kernel-5.10 index b21ac55771..bd84ddef80 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .95 -LINUX_KERNEL_HASH-5.10.95 = c8d9daf94e2784ddc9cbb49936c89a20415aa02faa2c4ab4a832ab6d8c63fc23 +LINUX_VERSION-5.10 = .96 +LINUX_KERNEL_HASH-5.10.96 = 35e5a042819dd37af891c47d151b209d93e078a22f2637b2f5171bdff5b2e048 diff --git a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch index 161ed445bd..911d436dc2 100644 --- a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch @@ -545,7 +545,7 @@ * XXX skbs on the gro_list have all been parsed and pulled --- a/include/net/addrconf.h +++ b/include/net/addrconf.h -@@ -45,7 +45,7 @@ struct prefix_info { +@@ -47,7 +47,7 @@ struct prefix_info { __be32 reserved2; struct in6_addr prefix; diff --git a/target/linux/bcm27xx/patches-5.10/950-0138-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch b/target/linux/bcm27xx/patches-5.10/950-0138-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch index b541c0cb12..e158dc591c 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0138-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0138-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch @@ -27,7 +27,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c -@@ -1952,6 +1952,16 @@ reset: +@@ -1966,6 +1966,16 @@ reset: return ret; } diff --git a/target/linux/bcm27xx/patches-5.10/950-0371-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch b/target/linux/bcm27xx/patches-5.10/950-0371-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch index 4fbb4d6594..55aa66c1a6 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0371-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0371-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch @@ -49,7 +49,7 @@ Signed-off-by: Jonathan Bell .phy_id = PHY_ID_BCM5461, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM5461", -@@ -924,7 +933,8 @@ module_phy_driver(broadcom_drivers); +@@ -925,7 +934,8 @@ module_phy_driver(broadcom_drivers); static struct mdio_device_id __maybe_unused broadcom_tbl[] = { { PHY_ID_BCM5411, 0xfffffff0 }, { PHY_ID_BCM5421, 0xfffffff0 }, diff --git a/target/linux/generic/backport-5.10/610-v5.13-11-net-resolve-forwarding-path-from-virtual-netdevice-a.patch b/target/linux/generic/backport-5.10/610-v5.13-11-net-resolve-forwarding-path-from-virtual-netdevice-a.patch index 34c4dc20b7..a8fc1cabe2 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-11-net-resolve-forwarding-path-from-virtual-netdevice-a.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-11-net-resolve-forwarding-path-from-virtual-netdevice-a.patch @@ -104,7 +104,7 @@ Signed-off-by: Pablo Neira Ayuso }; /** -@@ -2827,6 +2852,8 @@ void dev_remove_offload(struct packet_of +@@ -2828,6 +2853,8 @@ void dev_remove_offload(struct packet_of int dev_get_iflink(const struct net_device *dev); int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb); diff --git a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index f2b04d4955..68fb423a54 100644 --- a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -1360,7 +1360,7 @@ Signed-off-by: David S. Miller int irq; --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -4990,7 +4990,7 @@ int stmmac_dvr_probe(struct device *devi +@@ -4988,7 +4988,7 @@ int stmmac_dvr_probe(struct device *devi priv->wol_irq = res->wol_irq; priv->lpi_irq = res->lpi_irq; diff --git a/target/linux/generic/hack-5.10/902-debloat_proc.patch b/target/linux/generic/hack-5.10/902-debloat_proc.patch index 5d7620b80d..33a3e3c5d5 100644 --- a/target/linux/generic/hack-5.10/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.10/902-debloat_proc.patch @@ -286,7 +286,7 @@ Signed-off-by: Felix Fietkau goto err; --- a/net/core/net-procfs.c +++ b/net/core/net-procfs.c -@@ -290,10 +290,12 @@ static int __net_init dev_proc_net_init( +@@ -320,10 +320,12 @@ static int __net_init dev_proc_net_init( if (!proc_create_net("dev", 0444, net->proc_net, &dev_seq_ops, sizeof(struct seq_net_private))) goto out; @@ -301,7 +301,7 @@ Signed-off-by: Felix Fietkau sizeof(struct seq_net_private))) goto out_softnet; -@@ -303,9 +305,11 @@ static int __net_init dev_proc_net_init( +@@ -333,9 +335,11 @@ static int __net_init dev_proc_net_init( out: return rc; out_ptype: @@ -315,7 +315,7 @@ Signed-off-by: Felix Fietkau out_dev: remove_proc_entry("dev", net->proc_net); goto out; -@@ -315,8 +319,10 @@ static void __net_exit dev_proc_net_exit +@@ -345,8 +349,10 @@ static void __net_exit dev_proc_net_exit { wext_proc_exit(net); diff --git a/target/linux/generic/pending-5.10/630-packet_socket_type.patch b/target/linux/generic/pending-5.10/630-packet_socket_type.patch index 9e415d803d..9721dc4d01 100644 --- a/target/linux/generic/pending-5.10/630-packet_socket_type.patch +++ b/target/linux/generic/pending-5.10/630-packet_socket_type.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #define PACKET_FANOUT_LB 1 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c -@@ -1818,6 +1818,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1819,6 +1819,7 @@ static int packet_rcv_spkt(struct sk_buf { struct sock *sk; struct sockaddr_pkt *spkt; @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau /* * When we registered the protocol we saved the socket in the data -@@ -1825,6 +1826,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1826,6 +1827,7 @@ static int packet_rcv_spkt(struct sk_buf */ sk = pt->af_packet_priv; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau /* * Yank back the headers [hope the device set this -@@ -1837,7 +1839,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1838,7 +1840,7 @@ static int packet_rcv_spkt(struct sk_buf * so that this procedure is noop. */ @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau goto out; if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -2075,12 +2077,12 @@ static int packet_rcv(struct sk_buff *sk +@@ -2076,12 +2078,12 @@ static int packet_rcv(struct sk_buff *sk unsigned int snaplen, res; bool is_drop_n_account = false; @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -2206,12 +2208,12 @@ static int tpacket_rcv(struct sk_buff *s +@@ -2207,12 +2209,12 @@ static int tpacket_rcv(struct sk_buff *s BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3318,6 +3320,7 @@ static int packet_create(struct net *net +@@ -3319,6 +3321,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3954,6 +3957,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3956,6 +3959,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4010,6 +4023,13 @@ static int packet_getsockopt(struct sock +@@ -4012,6 +4025,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch index 2bcf17751a..dd1e506e5b 100644 --- a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch +++ b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5023,6 +5023,10 @@ int stmmac_dvr_probe(struct device *devi +@@ -5021,6 +5021,10 @@ int stmmac_dvr_probe(struct device *devi reset_control_reset(priv->plat->stmmac_rst); } @@ -40,7 +40,7 @@ Signed-off-by: David S. Miller /* Init MAC and get the capabilities */ ret = stmmac_hw_init(priv); if (ret) -@@ -5247,6 +5251,7 @@ int stmmac_dvr_remove(struct device *dev +@@ -5245,6 +5249,7 @@ int stmmac_dvr_remove(struct device *dev phylink_destroy(priv->phylink); if (priv->plat->stmmac_rst) reset_control_assert(priv->plat->stmmac_rst); From dc2da6a23369c8da069321dcfd593a9cf8c993c6 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 1 Feb 2022 23:00:50 +0100 Subject: [PATCH 077/144] bcm63xx: Remove patch already in Linux stable Remove the 434-nand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch, it was already applied to Linux 5.10.37 and is not needed any more. Signed-off-by: Hauke Mehrtens --- ...rcmnand-fix-OOB-R-W-with-Hamming-ECC.patch | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 target/linux/bcm63xx/patches-5.10/434-nand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch diff --git a/target/linux/bcm63xx/patches-5.10/434-nand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch b/target/linux/bcm63xx/patches-5.10/434-nand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch deleted file mode 100644 index 33e27d2153..0000000000 --- a/target/linux/bcm63xx/patches-5.10/434-nand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch +++ /dev/null @@ -1,34 +0,0 @@ -From cf0d2fbaae9e962d91a321de75e0d4f9f9ccbdfe Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Thu, 21 Jan 2021 18:17:37 +0100 -Subject: [PATCH] nand: brcmnand: fix OOB R/W with Hamming ECC -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Hamming ECC doesn't cover the OOB data, so reading or writing OOB shall -always be done without ECC enabled. -This is a problem when adding JFFS2 cleanmarkers to erased blocks. When JFFS2 -clenmarkers are added to the OOB with ECC enabled, OOB bytes will be changed -from ff ff ff to 00 00 00, reporting incorrect ECC errors. - -Signed-off-by: Álvaro Fernández Rojas ---- - drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c -+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -2694,6 +2694,12 @@ static int brcmnand_attach_chip(struct n - chip->ecc.read_oob = brcmnand_read_oob_raw; - } - -+ /* If OOB is written with ECC enabled it will cause ECC errors */ -+ if (is_hamming_ecc(host->ctrl, &host->hwcfg)) { -+ chip->ecc.write_oob = brcmnand_write_oob_raw; -+ chip->ecc.read_oob = brcmnand_read_oob_raw; -+ } -+ - return ret; - } - From 4367d4f869cb031790d8077fd4405830762a6134 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 2 Feb 2022 02:35:04 +0000 Subject: [PATCH 078/144] uqmi: update to git HEAD f254fc5 uqmi: add support for get operating mode Signed-off-by: Daniel Golle --- package/network/utils/uqmi/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index 806f44f284..ee2add1573 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git -PKG_SOURCE_DATE:=2021-11-22 -PKG_SOURCE_VERSION:=b2c53dc67a6a509f6e6d7f6ba540c55bbc34e988 -PKG_MIRROR_HASH:=3244dccf22ede70b61650c7a92eada4aff29c77f55f513ad1a40cd385361f430 +PKG_SOURCE_DATE:=2022-02-02 +PKG_SOURCE_VERSION:=f254fc59c710d781eca3ec36e0bff2d8970370fa +PKG_MIRROR_HASH:=350fd627150dde0601a96ff313a76f7a827b0199e7ee9ab86e4f2f96280edad5 PKG_MAINTAINER:=Matti Laakso PKG_LICENSE:=GPL-2.0 From a5c8811c04799a601447a5b0cd21d39e00c0ae0e Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Wed, 26 Jan 2022 14:20:37 -0500 Subject: [PATCH 079/144] iptables: fix ip6tables-extra description The define was referencing ip6tables-mod-extra instead of ip6tables-extra Signed-off-by: Etienne Champetier --- package/network/utils/iptables/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 6aee5c6caf..a21a2382e3 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -473,7 +473,7 @@ $(call Package/iptables/Default) TITLE:=IPv6 header matching modules endef -define Package/ip6tables-mod-extra/description +define Package/ip6tables-extra/description iptables header matching modules for IPv6 endef From 4e7ad159043f3c75eaf4d81a2dc089d7babba07e Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Thu, 27 Jan 2022 14:03:02 -0500 Subject: [PATCH 080/144] iptables: fix ip6tables-nft description ip6tables-nft packages ip6tables* utils not iptables* Signed-off-by: Etienne Champetier --- package/network/utils/iptables/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index a21a2382e3..2ba30eeca8 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -460,11 +460,11 @@ endef define Package/ip6tables-nft/description Extra ip6tables nftables nft binaries. - iptables-nft - iptables-nft-restore - iptables-nft-save - iptables-translate - iptables-restore-translate + ip6tables-nft + ip6tables-nft-restore + ip6tables-nft-save + ip6tables-translate + ip6tables-restore-translate endef define Package/ip6tables-extra From 1ebb8e3b6be8ed070dcb466fc8d1631e5453df72 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Thu, 27 Jan 2022 16:00:21 -0500 Subject: [PATCH 081/144] netfilter: add kmod-nft-compat This modules is required by iptables-nft Signed-off-by: Etienne Champetier --- include/netfilter.mk | 2 ++ package/kernel/linux/modules/netfilter.mk | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/netfilter.mk b/include/netfilter.mk index 65e8e3b8f0..4602a1d412 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -350,6 +350,8 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_IPV6, $(P_V6)nft_fib $(eval $(if $(NF_KMOD),$(call nf_add,NFT_QUEUE,CONFIG_NFT_QUEUE, $(P_XT)nft_queue),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_COMPAT,CONFIG_NFT_COMPAT, $(P_XT)nft_compat),)) + # userland only IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m) IPT_BUILTIN += $(IPT_CORE-y) $(IPT_CORE-m) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index f204b257d1..75a06fb651 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1179,3 +1179,14 @@ define KernelPackage/nft-queue endef $(eval $(call KernelPackage,nft-queue)) + +define KernelPackage/nft-compat + SUBMENU:=$(NF_MENU) + TITLE:=Netfilter nf_tables compat support + DEPENDS:=+kmod-nft-core +kmod-nf-ipt + FILES:=$(foreach mod,$(NFT_COMPAT-m),$(LINUX_DIR)/net/$(mod).ko) + AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_COMPAT-m))) + KCONFIG:=$(KCONFIG_NFT_COMPAT) +endef + +$(eval $(call KernelPackage,nft-compat)) From b0bd6599e840c443d8ccb8759315e4dd006fd6aa Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Wed, 26 Jan 2022 14:33:52 -0500 Subject: [PATCH 082/144] iptables: rework ip(6)tables-nft dependencies according to iptables-nft man page, "These tools use the libxtables framework extensions and hook to the nf_tables kernel subsystem using the nft_compat module." This means that to work, iptables-nft needs the same modules as iptables legacy except the ip(6)table-{filter,mangle,nat,raw} ip_tables, ip6tables. When those modules are loaded iptables-nft-save output contains "# Warning: iptables-legacy tables present, use iptables-legacy-save to see them" But as long as it's empty it should not be a problem. To have nft properly display the rules created by ip(6)tables-nft we need all iptables targets and matches to be built as extension and not built-in (/usr/lib/iptables/libip(6)t_*.so) When switching a package to iptables-nft, you need to keep the iptables-mod-* dependencies This patch does minimal changes: - remove the direct iptables-nft -> iptables dependency - and more important add nft-compat dependency The rule iptables-nft -A OUTPUT -d 8.8.8.8 -m comment --comment "aaa" -j REJECT becomes table ip filter { chain OUTPUT { type filter hook output priority filter; policy accept; ip daddr 8.8.8.8 # xt_comment counter packets 0 bytes 0 # xt_REJECT } } Signed-off-by: Etienne Champetier --- package/network/utils/iptables/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 2ba30eeca8..853bff39c6 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -41,7 +41,7 @@ endef define Package/iptables/Module $(call Package/iptables/Default) - DEPENDS:=iptables $(1) + DEPENDS:=+iptables $(1) endef define Package/iptables @@ -108,7 +108,7 @@ endef define Package/iptables-nft $(call Package/iptables/Default) TITLE:=IP firewall administration tool nft - DEPENDS:=iptables @IPTABLES_NFTABLES +libxtables-nft + DEPENDS:=@IPTABLES_NFTABLES +libxtables-nft +libip4tc +IPV6:libip6tc +kmod-ipt-core +kmod-nft-compat endef define Package/iptables-nft/description @@ -454,7 +454,7 @@ endef define Package/ip6tables-nft $(call Package/iptables/Default) - DEPENDS:=ip6tables @IPTABLES_NFTABLES +libxtables-nft + DEPENDS:=@IPV6 +kmod-ip6tables +iptables-nft TITLE:=IP firewall administration tool nft endef @@ -522,7 +522,7 @@ define Package/libxtables-nft CATEGORY:=Libraries TITLE:=IPv4/IPv6 firewall - shared xtables nft library ABI_VERSION:=12 - DEPENDS:=libxtables + DEPENDS:=+libxtables endef TARGET_CPPFLAGS := \ From 3a5df36cf694ca821ad5486ff360969bd3492aaa Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Wed, 26 Jan 2022 17:09:44 -0500 Subject: [PATCH 083/144] iptables: use ALTERNATIVES for ip(6)tables(-nft) As nftables is now the default, ip(6)tables-nft gets higher priority The removed symlinks ("$(CP)" line) will now be installed by the ALTERNATIVES mechanism Signed-off-by: Etienne Champetier --- package/network/utils/iptables/Makefile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 853bff39c6..cf87d6de06 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -49,6 +49,10 @@ $(call Package/iptables/Default) TITLE:=IP firewall administration tool MENU:=1 DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libxtables + ALTERNATIVES:=\ + 200:/usr/sbin/iptables:/usr/sbin/xtables-legacy-multi \ + 200:/usr/sbin/iptables-restore:/usr/sbin/xtables-legacy-multi \ + 200:/usr/sbin/iptables-save:/usr/sbin/xtables-legacy-multi endef define Package/iptables/config @@ -109,6 +113,10 @@ define Package/iptables-nft $(call Package/iptables/Default) TITLE:=IP firewall administration tool nft DEPENDS:=@IPTABLES_NFTABLES +libxtables-nft +libip4tc +IPV6:libip6tc +kmod-ipt-core +kmod-nft-compat + ALTERNATIVES:=\ + 300:/usr/sbin/iptables:/usr/sbin/xtables-nft-multi \ + 300:/usr/sbin/iptables-restore:/usr/sbin/xtables-nft-multi \ + 300:/usr/sbin/iptables-save:/usr/sbin/xtables-nft-multi endef define Package/iptables-nft/description @@ -450,12 +458,20 @@ $(call Package/iptables/Default) CATEGORY:=Network TITLE:=IPv6 firewall administration tool MENU:=1 + ALTERNATIVES:=\ + 200:/usr/sbin/ip6tables:/usr/sbin/xtables-legacy-multi \ + 200:/usr/sbin/ip6tables-restore:/usr/sbin/xtables-legacy-multi \ + 200:/usr/sbin/ip6tables-save:/usr/sbin/xtables-legacy-multi endef define Package/ip6tables-nft $(call Package/iptables/Default) DEPENDS:=@IPV6 +kmod-ip6tables +iptables-nft TITLE:=IP firewall administration tool nft + ALTERNATIVES:=\ + 300:/usr/sbin/ip6tables:/usr/sbin/xtables-nft-multi \ + 300:/usr/sbin/ip6tables-restore:/usr/sbin/xtables-nft-multi \ + 300:/usr/sbin/ip6tables-save:/usr/sbin/xtables-nft-multi endef define Package/ip6tables-nft/description @@ -598,7 +614,6 @@ endef define Package/iptables/install $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-legacy-multi $(1)/usr/sbin/ - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore,-save} $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/usr/lib/iptables endef @@ -611,7 +626,6 @@ endef define Package/ip6tables/install $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore,-save} $(1)/usr/sbin/ endef define Package/ip6tables-nft/install From 0e32c6baf37688e8cefed5718afe13ec18f75233 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Wed, 26 Jan 2022 14:23:23 -0500 Subject: [PATCH 084/144] iptables: add ip{,6}tables-legacy{,-restore,-save} symlinks Now that we can have both legacy and nft iptables variants installed at the same time, install the legacy symlinks Signed-off-by: Etienne Champetier --- package/network/utils/iptables/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index cf87d6de06..e936a57380 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -614,6 +614,7 @@ endef define Package/iptables/install $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-legacy-multi $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-legacy{,-restore,-save} $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/usr/lib/iptables endef @@ -626,6 +627,7 @@ endef define Package/ip6tables/install $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-legacy{,-restore,-save} $(1)/usr/sbin/ endef define Package/ip6tables-nft/install From 02b9b6872a4f70b304264cd4ccea0ec633b16816 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 30 Nov 2021 11:55:46 +0100 Subject: [PATCH 085/144] mac80211: backport support for ndo_fill_forward_path Will be used in an upcoming mt76 update Signed-off-by: Felix Fietkau --- ...d-support-for-.ndo_fill_forward_path.patch | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/330-mac80211-add-support-for-.ndo_fill_forward_path.patch diff --git a/package/kernel/mac80211/patches/subsys/330-mac80211-add-support-for-.ndo_fill_forward_path.patch b/package/kernel/mac80211/patches/subsys/330-mac80211-add-support-for-.ndo_fill_forward_path.patch new file mode 100644 index 0000000000..7764edfb27 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/330-mac80211-add-support-for-.ndo_fill_forward_path.patch @@ -0,0 +1,172 @@ +From: Felix Fietkau +Date: Fri, 12 Nov 2021 12:22:23 +0100 +Subject: [PATCH] mac80211: add support for .ndo_fill_forward_path + +This allows drivers to provide a destination device + info for flow offload +Only supported in combination with 802.3 encap offload + +Signed-off-by: Felix Fietkau +Tested-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/20211112112223.1209-1-nbd@nbd.name +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -3937,6 +3937,8 @@ struct ieee80211_prep_tx_info { + * twt structure. + * @twt_teardown_request: Update the hw with TWT teardown request received + * from the peer. ++ * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to ++ * resolve a path for hardware flow offloading + */ + struct ieee80211_ops { + void (*tx)(struct ieee80211_hw *hw, +@@ -4265,6 +4267,11 @@ struct ieee80211_ops { + struct ieee80211_twt_setup *twt); + void (*twt_teardown_request)(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, u8 flowid); ++ int (*net_fill_forward_path)(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta, ++ struct net_device_path_ctx *ctx, ++ struct net_device_path *path); + }; + + /** +--- a/net/mac80211/driver-ops.h ++++ b/net/mac80211/driver-ops.h +@@ -1483,4 +1483,26 @@ static inline void drv_twt_teardown_requ + trace_drv_return_void(local); + } + ++static inline int drv_net_fill_forward_path(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_sta *sta, ++ struct net_device_path_ctx *ctx, ++ struct net_device_path *path) ++{ ++ int ret = -EOPNOTSUPP; ++ ++ sdata = get_bss_sdata(sdata); ++ if (!check_sdata_in_driver(sdata)) ++ return -EIO; ++ ++ trace_drv_net_fill_forward_path(local, sdata, sta); ++ if (local->ops->net_fill_forward_path) ++ ret = local->ops->net_fill_forward_path(&local->hw, ++ &sdata->vif, sta, ++ ctx, path); ++ trace_drv_return_int(local, ret); ++ ++ return ret; ++} ++ + #endif /* __MAC80211_DRIVER_OPS */ +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1465,7 +1465,7 @@ struct ieee80211_local { + }; + + static inline struct ieee80211_sub_if_data * +-IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) ++IEEE80211_DEV_TO_SUB_IF(const struct net_device *dev) + { + return netdev_priv(dev); + } +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -822,6 +822,66 @@ static const struct net_device_ops ieee8 + + }; + ++#if LINUX_VERSION_IS_GEQ(5,10,0) ++static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx, ++ struct net_device_path *path) ++{ ++ struct ieee80211_sub_if_data *sdata; ++ struct ieee80211_local *local; ++ struct sta_info *sta; ++ int ret = -ENOENT; ++ ++ sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev); ++ local = sdata->local; ++ ++ if (!local->ops->net_fill_forward_path) ++ return -EOPNOTSUPP; ++ ++ rcu_read_lock(); ++ switch (sdata->vif.type) { ++ case NL80211_IFTYPE_AP_VLAN: ++ sta = rcu_dereference(sdata->u.vlan.sta); ++ if (sta) ++ break; ++ if (sdata->wdev.use_4addr) ++ goto out; ++ if (is_multicast_ether_addr(ctx->daddr)) ++ goto out; ++ sta = sta_info_get_bss(sdata, ctx->daddr); ++ break; ++ case NL80211_IFTYPE_AP: ++ if (is_multicast_ether_addr(ctx->daddr)) ++ goto out; ++ sta = sta_info_get(sdata, ctx->daddr); ++ break; ++ case NL80211_IFTYPE_STATION: ++ if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { ++ sta = sta_info_get(sdata, ctx->daddr); ++ if (sta && test_sta_flag(sta, WLAN_STA_TDLS_PEER)) { ++ if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) ++ goto out; ++ ++ break; ++ } ++ } ++ ++ sta = sta_info_get(sdata, sdata->u.mgd.bssid); ++ break; ++ default: ++ goto out; ++ } ++ ++ if (!sta) ++ goto out; ++ ++ ret = drv_net_fill_forward_path(local, sdata, &sta->sta, ctx, path); ++out: ++ rcu_read_unlock(); ++ ++ return ret; ++} ++#endif ++ + static const struct net_device_ops ieee80211_dataif_8023_ops = { + #if LINUX_VERSION_IS_LESS(4,10,0) + .ndo_change_mtu = __change_mtu, +@@ -839,7 +899,9 @@ static const struct net_device_ops ieee8 + #else + .ndo_get_stats64 = bp_ieee80211_get_stats64, + #endif +- ++#if LINUX_VERSION_IS_GEQ(5,10,0) ++ .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, ++#endif + }; + + static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) +--- a/net/mac80211/trace.h ++++ b/net/mac80211/trace.h +@@ -2892,6 +2892,13 @@ TRACE_EVENT(drv_twt_teardown_request, + ) + ); + ++DEFINE_EVENT(sta_event, drv_net_fill_forward_path, ++ TP_PROTO(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_sta *sta), ++ TP_ARGS(local, sdata, sta) ++); ++ + #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ + + #undef TRACE_INCLUDE_PATH From 543ada64edb88ff68328bcde5418eac7afcc3634 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 28 Jan 2022 13:51:22 +0100 Subject: [PATCH 086/144] mac80211: reorganize patches Signed-off-by: Felix Fietkau --- ... 300-mac80211-fix-rate-control-for-retransmitted-frames.patch} | 0 ...01-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch} | 0 ...302-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch} | 0 ...303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch} | 0 ...04-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch} | 0 ...05-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch} | 0 ...06-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch} | 0 ....patch => 307-mac80211_hwsim-make-6-GHz-channels-usable.patch} | 0 ... => 308-mac80211-add-support-for-.ndo_fill_forward_path.patch} | 0 ...tch => 309-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch} | 0 ...10-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch} | 0 ...11-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch} | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename package/kernel/mac80211/patches/subsys/{301-mac80211-fix-rate-control-for-retransmitted-frames.patch => 300-mac80211-fix-rate-control-for-retransmitted-frames.patch} (100%) rename package/kernel/mac80211/patches/subsys/{304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch => 301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch} (100%) rename package/kernel/mac80211/patches/subsys/{305-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch => 302-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch} (100%) rename package/kernel/mac80211/patches/subsys/{306-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch => 303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch} (100%) rename package/kernel/mac80211/patches/subsys/{309-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch => 304-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch} (100%) rename package/kernel/mac80211/patches/subsys/{310-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch => 305-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch} (100%) rename package/kernel/mac80211/patches/subsys/{311-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch => 306-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch} (100%) rename package/kernel/mac80211/patches/subsys/{321-mac80211_hwsim-make-6-GHz-channels-usable.patch => 307-mac80211_hwsim-make-6-GHz-channels-usable.patch} (100%) rename package/kernel/mac80211/patches/subsys/{330-mac80211-add-support-for-.ndo_fill_forward_path.patch => 308-mac80211-add-support-for-.ndo_fill_forward_path.patch} (100%) rename package/kernel/mac80211/patches/subsys/{353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch => 309-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch} (100%) rename package/kernel/mac80211/patches/subsys/{354-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch => 310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch} (100%) rename package/kernel/mac80211/patches/subsys/{355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch => 311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch} (100%) diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-fix-rate-control-for-retransmitted-frames.patch b/package/kernel/mac80211/patches/subsys/300-mac80211-fix-rate-control-for-retransmitted-frames.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/301-mac80211-fix-rate-control-for-retransmitted-frames.patch rename to package/kernel/mac80211/patches/subsys/300-mac80211-fix-rate-control-for-retransmitted-frames.patch diff --git a/package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/304-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch rename to package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch b/package/kernel/mac80211/patches/subsys/302-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/305-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch rename to package/kernel/mac80211/patches/subsys/302-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch diff --git a/package/kernel/mac80211/patches/subsys/306-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch b/package/kernel/mac80211/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/306-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch rename to package/kernel/mac80211/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch diff --git a/package/kernel/mac80211/patches/subsys/309-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch b/package/kernel/mac80211/patches/subsys/304-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/309-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch rename to package/kernel/mac80211/patches/subsys/304-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch diff --git a/package/kernel/mac80211/patches/subsys/310-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/310-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch rename to package/kernel/mac80211/patches/subsys/305-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch diff --git a/package/kernel/mac80211/patches/subsys/311-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch b/package/kernel/mac80211/patches/subsys/306-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/311-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch rename to package/kernel/mac80211/patches/subsys/306-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch rename to package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch diff --git a/package/kernel/mac80211/patches/subsys/330-mac80211-add-support-for-.ndo_fill_forward_path.patch b/package/kernel/mac80211/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/330-mac80211-add-support-for-.ndo_fill_forward_path.patch rename to package/kernel/mac80211/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch diff --git a/package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch b/package/kernel/mac80211/patches/subsys/309-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch rename to package/kernel/mac80211/patches/subsys/309-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch diff --git a/package/kernel/mac80211/patches/subsys/354-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/354-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch rename to package/kernel/mac80211/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch diff --git a/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch b/package/kernel/mac80211/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch rename to package/kernel/mac80211/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch From 03ea0405a6db0e5144d486a682e97a0be47a47c1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 28 Jan 2022 14:13:58 +0100 Subject: [PATCH 087/144] mac80211: backport MBSSID/EMA support patches Signed-off-by: Felix Fietkau --- ...211-split-beacon-retrieval-functions.patch | 262 ++++++++++ ...11-MBSSID-and-EMA-support-in-AP-mode.patch | 493 ++++++++++++++++++ .../500-mac80211_configure_antenna_gain.patch | 32 +- .../utils/iw/patches/001-nl80211_h_sync.patch | 130 ++--- 4 files changed, 803 insertions(+), 114 deletions(-) create mode 100644 package/kernel/mac80211/patches/subsys/312-mac80211-split-beacon-retrieval-functions.patch create mode 100644 package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch diff --git a/package/kernel/mac80211/patches/subsys/312-mac80211-split-beacon-retrieval-functions.patch b/package/kernel/mac80211/patches/subsys/312-mac80211-split-beacon-retrieval-functions.patch new file mode 100644 index 0000000000..18b1951f6e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/312-mac80211-split-beacon-retrieval-functions.patch @@ -0,0 +1,262 @@ +From: Aloka Dixit +Date: Tue, 5 Oct 2021 21:09:36 -0700 +Subject: [PATCH] mac80211: split beacon retrieval functions + +Split __ieee80211_beacon_get() into a separate function for AP mode +ieee80211_beacon_get_ap(). +Also, move the code common to all modes (AP, adhoc and mesh) to +a separate function ieee80211_beacon_get_finish(). + +Signed-off-by: Aloka Dixit +Link: https://lore.kernel.org/r/20211006040938.9531-2-alokad@codeaurora.org +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -4987,6 +4987,115 @@ static int ieee80211_beacon_protect(stru + return 0; + } + ++static void ++ieee80211_beacon_get_finish(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_mutable_offsets *offs, ++ struct beacon_data *beacon, ++ struct sk_buff *skb, ++ struct ieee80211_chanctx_conf *chanctx_conf, ++ u16 csa_off_base) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); ++ struct ieee80211_tx_info *info; ++ enum nl80211_band band; ++ struct ieee80211_tx_rate_control txrc; ++ ++ /* CSA offsets */ ++ if (offs && beacon) { ++ u16 i; ++ ++ for (i = 0; i < IEEE80211_MAX_CNTDWN_COUNTERS_NUM; i++) { ++ u16 csa_off = beacon->cntdwn_counter_offsets[i]; ++ ++ if (!csa_off) ++ continue; ++ ++ offs->cntdwn_counter_offs[i] = csa_off_base + csa_off; ++ } ++ } ++ ++ band = chanctx_conf->def.chan->band; ++ info = IEEE80211_SKB_CB(skb); ++ info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; ++ info->flags |= IEEE80211_TX_CTL_NO_ACK; ++ info->band = band; ++ ++ memset(&txrc, 0, sizeof(txrc)); ++ txrc.hw = hw; ++ txrc.sband = local->hw.wiphy->bands[band]; ++ txrc.bss_conf = &sdata->vif.bss_conf; ++ txrc.skb = skb; ++ txrc.reported_rate.idx = -1; ++ if (sdata->beacon_rate_set && sdata->beacon_rateidx_mask[band]) ++ txrc.rate_idx_mask = sdata->beacon_rateidx_mask[band]; ++ else ++ txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; ++ txrc.bss = true; ++ rate_control_get_rate(sdata, NULL, &txrc); ++ ++ info->control.vif = vif; ++ info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT | ++ IEEE80211_TX_CTL_ASSIGN_SEQ | ++ IEEE80211_TX_CTL_FIRST_FRAGMENT; ++} ++ ++static struct sk_buff * ++ieee80211_beacon_get_ap(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_mutable_offsets *offs, ++ bool is_template, ++ struct beacon_data *beacon, ++ struct ieee80211_chanctx_conf *chanctx_conf) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); ++ struct ieee80211_if_ap *ap = &sdata->u.ap; ++ struct sk_buff *skb = NULL; ++ u16 csa_off_base = 0; ++ ++ if (beacon->cntdwn_counter_offsets[0]) { ++ if (!is_template) ++ ieee80211_beacon_update_cntdwn(vif); ++ ++ ieee80211_set_beacon_cntdwn(sdata, beacon); ++ } ++ ++ /* headroom, head length, ++ * tail length and maximum TIM length ++ */ ++ skb = dev_alloc_skb(local->tx_headroom + beacon->head_len + ++ beacon->tail_len + 256 + ++ local->hw.extra_beacon_tailroom); ++ if (!skb) ++ return NULL; ++ ++ skb_reserve(skb, local->tx_headroom); ++ skb_put_data(skb, beacon->head, beacon->head_len); ++ ++ ieee80211_beacon_add_tim(sdata, &ap->ps, skb, is_template); ++ ++ if (offs) { ++ offs->tim_offset = beacon->head_len; ++ offs->tim_length = skb->len - beacon->head_len; ++ offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; ++ ++ /* for AP the csa offsets are from tail */ ++ csa_off_base = skb->len; ++ } ++ ++ if (beacon->tail) ++ skb_put_data(skb, beacon->tail, beacon->tail_len); ++ ++ if (ieee80211_beacon_protect(skb, local, sdata) < 0) ++ return NULL; ++ ++ ieee80211_beacon_get_finish(hw, vif, offs, beacon, skb, chanctx_conf, ++ csa_off_base); ++ return skb; ++} ++ + static struct sk_buff * + __ieee80211_beacon_get(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, +@@ -4996,12 +5105,8 @@ __ieee80211_beacon_get(struct ieee80211_ + struct ieee80211_local *local = hw_to_local(hw); + struct beacon_data *beacon = NULL; + struct sk_buff *skb = NULL; +- struct ieee80211_tx_info *info; + struct ieee80211_sub_if_data *sdata = NULL; +- enum nl80211_band band; +- struct ieee80211_tx_rate_control txrc; + struct ieee80211_chanctx_conf *chanctx_conf; +- int csa_off_base = 0; + + rcu_read_lock(); + +@@ -5018,48 +5123,11 @@ __ieee80211_beacon_get(struct ieee80211_ + struct ieee80211_if_ap *ap = &sdata->u.ap; + + beacon = rcu_dereference(ap->beacon); +- if (beacon) { +- if (beacon->cntdwn_counter_offsets[0]) { +- if (!is_template) +- ieee80211_beacon_update_cntdwn(vif); +- +- ieee80211_set_beacon_cntdwn(sdata, beacon); +- } +- +- /* +- * headroom, head length, +- * tail length and maximum TIM length +- */ +- skb = dev_alloc_skb(local->tx_headroom + +- beacon->head_len + +- beacon->tail_len + 256 + +- local->hw.extra_beacon_tailroom); +- if (!skb) +- goto out; +- +- skb_reserve(skb, local->tx_headroom); +- skb_put_data(skb, beacon->head, beacon->head_len); +- +- ieee80211_beacon_add_tim(sdata, &ap->ps, skb, +- is_template); +- +- if (offs) { +- offs->tim_offset = beacon->head_len; +- offs->tim_length = skb->len - beacon->head_len; +- offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; +- +- /* for AP the csa offsets are from tail */ +- csa_off_base = skb->len; +- } +- +- if (beacon->tail) +- skb_put_data(skb, beacon->tail, +- beacon->tail_len); +- +- if (ieee80211_beacon_protect(skb, local, sdata) < 0) +- goto out; +- } else ++ if (!beacon) + goto out; ++ ++ skb = ieee80211_beacon_get_ap(hw, vif, offs, is_template, ++ beacon, chanctx_conf); + } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { + struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; + struct ieee80211_hdr *hdr; +@@ -5085,6 +5153,9 @@ __ieee80211_beacon_get(struct ieee80211_ + hdr = (struct ieee80211_hdr *) skb->data; + hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | + IEEE80211_STYPE_BEACON); ++ ++ ieee80211_beacon_get_finish(hw, vif, offs, beacon, skb, ++ chanctx_conf, 0); + } else if (ieee80211_vif_is_mesh(&sdata->vif)) { + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; + +@@ -5124,51 +5195,13 @@ __ieee80211_beacon_get(struct ieee80211_ + } + + skb_put_data(skb, beacon->tail, beacon->tail_len); ++ ieee80211_beacon_get_finish(hw, vif, offs, beacon, skb, ++ chanctx_conf, 0); + } else { + WARN_ON(1); + goto out; + } + +- /* CSA offsets */ +- if (offs && beacon) { +- int i; +- +- for (i = 0; i < IEEE80211_MAX_CNTDWN_COUNTERS_NUM; i++) { +- u16 csa_off = beacon->cntdwn_counter_offsets[i]; +- +- if (!csa_off) +- continue; +- +- offs->cntdwn_counter_offs[i] = csa_off_base + csa_off; +- } +- } +- +- band = chanctx_conf->def.chan->band; +- +- info = IEEE80211_SKB_CB(skb); +- +- info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; +- info->flags |= IEEE80211_TX_CTL_NO_ACK; +- info->band = band; +- +- memset(&txrc, 0, sizeof(txrc)); +- txrc.hw = hw; +- txrc.sband = local->hw.wiphy->bands[band]; +- txrc.bss_conf = &sdata->vif.bss_conf; +- txrc.skb = skb; +- txrc.reported_rate.idx = -1; +- if (sdata->beacon_rate_set && sdata->beacon_rateidx_mask[band]) +- txrc.rate_idx_mask = sdata->beacon_rateidx_mask[band]; +- else +- txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; +- txrc.bss = true; +- rate_control_get_rate(sdata, NULL, &txrc); +- +- info->control.vif = vif; +- +- info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT | +- IEEE80211_TX_CTL_ASSIGN_SEQ | +- IEEE80211_TX_CTL_FIRST_FRAGMENT; + out: + rcu_read_unlock(); + return skb; diff --git a/package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch new file mode 100644 index 0000000000..8e6b301888 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch @@ -0,0 +1,493 @@ +From: John Crispin +Date: Wed, 15 Sep 2021 19:54:34 -0700 +Subject: [PATCH] nl80211: MBSSID and EMA support in AP mode + +Add new attributes to configure support for multiple BSSID +and advanced multi-BSSID advertisements (EMA) in AP mode. + +- NL80211_ATTR_MBSSID_CONFIG used for per interface configuration. +- NL80211_ATTR_MBSSID_ELEMS used to MBSSID elements for beacons. + +Memory for the elements is allocated dynamically. This change frees +the memory in existing functions which call nl80211_parse_beacon(), +a comment is added to indicate the new references to do the same. + +Signed-off-by: John Crispin +Co-developed-by: Aloka Dixit +Signed-off-by: Aloka Dixit +Link: https://lore.kernel.org/r/20210916025437.29138-2-alokad@codeaurora.org +[don't leave ERR_PTR hanging around] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -1046,6 +1046,36 @@ struct cfg80211_crypto_settings { + }; + + /** ++ * struct cfg80211_mbssid_config - AP settings for multi bssid ++ * ++ * @tx_wdev: pointer to the transmitted interface in the MBSSID set ++ * @index: index of this AP in the multi bssid group. ++ * @ema: set to true if the beacons should be sent out in EMA mode. ++ */ ++struct cfg80211_mbssid_config { ++ struct wireless_dev *tx_wdev; ++ u8 index; ++ bool ema; ++}; ++ ++/** ++ * struct cfg80211_mbssid_elems - Multiple BSSID elements ++ * ++ * @cnt: Number of elements in array %elems. ++ * ++ * @elem: Array of multiple BSSID element(s) to be added into Beacon frames. ++ * @elem.data: Data for multiple BSSID elements. ++ * @elem.len: Length of data. ++ */ ++struct cfg80211_mbssid_elems { ++ u8 cnt; ++ struct { ++ const u8 *data; ++ size_t len; ++ } elem[]; ++}; ++ ++/** + * struct cfg80211_beacon_data - beacon data + * @head: head portion of beacon (before TIM IE) + * or %NULL if not changed +@@ -1063,6 +1093,7 @@ struct cfg80211_crypto_settings { + * @assocresp_ies_len: length of assocresp_ies in octets + * @probe_resp_len: length of probe response template (@probe_resp) + * @probe_resp: probe response template (AP mode only) ++ * @mbssid_ies: multiple BSSID elements + * @ftm_responder: enable FTM responder functionality; -1 for no change + * (which also implies no change in LCI/civic location data) + * @lci: Measurement Report element content, starting with Measurement Token +@@ -1080,6 +1111,7 @@ struct cfg80211_beacon_data { + const u8 *probe_resp; + const u8 *lci; + const u8 *civicloc; ++ struct cfg80211_mbssid_elems *mbssid_ies; + s8 ftm_responder; + + size_t head_len, tail_len; +@@ -1194,6 +1226,7 @@ enum cfg80211_ap_settings_flags { + * @he_oper: HE operation IE (or %NULL if HE isn't enabled) + * @fils_discovery: FILS discovery transmission parameters + * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters ++ * @mbssid_config: AP settings for multiple bssid + */ + struct cfg80211_ap_settings { + struct cfg80211_chan_def chandef; +@@ -1226,6 +1259,7 @@ struct cfg80211_ap_settings { + struct cfg80211_he_bss_color he_bss_color; + struct cfg80211_fils_discovery fils_discovery; + struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; ++ struct cfg80211_mbssid_config mbssid_config; + }; + + /** +@@ -4986,6 +5020,13 @@ struct wiphy_iftype_akm_suites { + * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes + * @sar_capa: SAR control capabilities + * @rfkill: a pointer to the rfkill structure ++ * ++ * @mbssid_max_interfaces: maximum number of interfaces supported by the driver ++ * in a multiple BSSID set. This field must be set to a non-zero value ++ * by the driver to advertise MBSSID support. ++ * @mbssid_max_ema_profile_periodicity: maximum profile periodicity supported by ++ * the driver. Setting this field to a non-zero value indicates that the ++ * driver supports enhanced multi-BSSID advertisements (EMA AP). + */ + struct wiphy { + struct mutex mtx; +@@ -5133,6 +5174,9 @@ struct wiphy { + + struct rfkill *rfkill; + ++ u8 mbssid_max_interfaces; ++ u8 ema_max_profile_periodicity; ++ + char priv[] __aligned(NETDEV_ALIGN); + }; + +--- a/include/uapi/linux/nl80211.h ++++ b/include/uapi/linux/nl80211.h +@@ -337,7 +337,10 @@ + * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes + * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from + * userspace to request deletion of a virtual interface, then requires +- * attribute %NL80211_ATTR_IFINDEX. ++ * attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are ++ * enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS, ++ * and if this command is used for the transmitting interface, then all ++ * the non-transmitting interfaces are deleted as well. + * + * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified + * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. +@@ -2593,6 +2596,18 @@ enum nl80211_commands { + * @NL80211_ATTR_COLOR_CHANGE_ELEMS: Nested set of attributes containing the IE + * information for the time while performing a color switch. + * ++ * @NL80211_ATTR_MBSSID_CONFIG: Nested attribute for multiple BSSID ++ * advertisements (MBSSID) parameters in AP mode. ++ * Kernel uses this attribute to indicate the driver's support for MBSSID ++ * and enhanced multi-BSSID advertisements (EMA AP) to the userspace. ++ * Userspace should use this attribute to configure per interface MBSSID ++ * parameters. ++ * See &enum nl80211_mbssid_config_attributes for details. ++ * ++ * @NL80211_ATTR_MBSSID_ELEMS: Nested parameter to pass multiple BSSID elements. ++ * Mandatory parameter for the transmitting interface to enable MBSSID. ++ * Optional for the non-transmitting interfaces. ++ * + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +@@ -3096,6 +3111,9 @@ enum nl80211_attrs { + NL80211_ATTR_COLOR_CHANGE_COLOR, + NL80211_ATTR_COLOR_CHANGE_ELEMS, + ++ NL80211_ATTR_MBSSID_CONFIG, ++ NL80211_ATTR_MBSSID_ELEMS, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +@@ -7349,4 +7367,60 @@ enum nl80211_sar_specs_attrs { + NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1, + }; + ++/** ++ * enum nl80211_mbssid_config_attributes - multiple BSSID (MBSSID) and enhanced ++ * multi-BSSID advertisements (EMA) in AP mode. ++ * Kernel uses some of these attributes to advertise driver's support for ++ * MBSSID and EMA. ++ * Remaining attributes should be used by the userspace to configure the ++ * features. ++ * ++ * @__NL80211_MBSSID_CONFIG_ATTR_INVALID: Invalid ++ * ++ * @NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES: Used by the kernel to advertise ++ * the maximum number of MBSSID interfaces supported by the driver. ++ * Driver should indicate MBSSID support by setting ++ * wiphy->mbssid_max_interfaces to a value more than or equal to 2. ++ * ++ * @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel ++ * to advertise the maximum profile periodicity supported by the driver ++ * if EMA is enabled. Driver should indicate EMA support to the userspace ++ * by setting wiphy->mbssid_max_ema_profile_periodicity to ++ * a non-zero value. ++ * ++ * @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of ++ * this BSS (u8) in the multiple BSSID set. ++ * Value must be set to 0 for the transmitting interface and non-zero for ++ * all non-transmitting interfaces. The userspace will be responsible ++ * for using unique indices for the interfaces. ++ * Range: 0 to wiphy->mbssid_max_interfaces-1. ++ * ++ * @NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX: Mandatory parameter for ++ * a non-transmitted profile which provides the interface index (u32) of ++ * the transmitted profile. The value must match one of the interface ++ * indices advertised by the kernel. Optional if the interface being set up ++ * is the transmitting one, however, if provided then the value must match ++ * the interface index of the same. ++ * ++ * @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature. ++ * Setting this flag is permitted only if the driver advertises EMA support ++ * by setting wiphy->mbssid_max_ema_profile_periodicity to non-zero. ++ * ++ * @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal ++ * @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute ++ */ ++enum nl80211_mbssid_config_attributes { ++ __NL80211_MBSSID_CONFIG_ATTR_INVALID, ++ ++ NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES, ++ NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY, ++ NL80211_MBSSID_CONFIG_ATTR_INDEX, ++ NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX, ++ NL80211_MBSSID_CONFIG_ATTR_EMA, ++ ++ /* keep last */ ++ __NL80211_MBSSID_CONFIG_ATTR_LAST, ++ NL80211_MBSSID_CONFIG_ATTR_MAX = __NL80211_MBSSID_CONFIG_ATTR_LAST - 1, ++}; ++ + #endif /* __LINUX_NL80211_H */ +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -439,6 +439,16 @@ sar_policy[NL80211_SAR_ATTR_MAX + 1] = { + [NL80211_SAR_ATTR_SPECS] = NLA_POLICY_NESTED_ARRAY(sar_specs_policy), + }; + ++static const struct nla_policy ++nl80211_mbssid_config_policy[NL80211_MBSSID_CONFIG_ATTR_MAX + 1] = { ++ [NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES] = NLA_POLICY_MIN(NLA_U8, 2), ++ [NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY] = ++ NLA_POLICY_MIN(NLA_U8, 1), ++ [NL80211_MBSSID_CONFIG_ATTR_INDEX] = { .type = NLA_U8 }, ++ [NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX] = { .type = NLA_U32 }, ++ [NL80211_MBSSID_CONFIG_ATTR_EMA] = { .type = NLA_FLAG }, ++}; ++ + static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { + [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD }, + [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, +@@ -780,6 +790,9 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, + [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, + [NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy), ++ [NL80211_ATTR_MBSSID_CONFIG] = ++ NLA_POLICY_NESTED(nl80211_mbssid_config_policy), ++ [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, + }; + + /* policy for the key attributes */ +@@ -2228,6 +2241,35 @@ fail: + return -ENOBUFS; + } + ++static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg) ++{ ++ struct nlattr *config; ++ ++ if (!wiphy->mbssid_max_interfaces) ++ return 0; ++ ++ config = nla_nest_start(msg, NL80211_ATTR_MBSSID_CONFIG); ++ if (!config) ++ return -ENOBUFS; ++ ++ if (nla_put_u8(msg, NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES, ++ wiphy->mbssid_max_interfaces)) ++ goto fail; ++ ++ if (wiphy->ema_max_profile_periodicity && ++ nla_put_u8(msg, ++ NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY, ++ wiphy->ema_max_profile_periodicity)) ++ goto fail; ++ ++ nla_nest_end(msg, config); ++ return 0; ++ ++fail: ++ nla_nest_cancel(msg, config); ++ return -ENOBUFS; ++} ++ + struct nl80211_dump_wiphy_state { + s64 filter_wiphy; + long start; +@@ -2813,6 +2855,9 @@ static int nl80211_send_wiphy(struct cfg + if (nl80211_put_sar_specs(rdev, msg)) + goto nla_put_failure; + ++ if (nl80211_put_mbssid_support(&rdev->wiphy, msg)) ++ goto nla_put_failure; ++ + /* done */ + state->split_start = 0; + break; +@@ -5002,6 +5047,96 @@ static int validate_beacon_tx_rate(struc + return 0; + } + ++static int nl80211_parse_mbssid_config(struct wiphy *wiphy, ++ struct net_device *dev, ++ struct nlattr *attrs, ++ struct cfg80211_mbssid_config *config, ++ u8 num_elems) ++{ ++ struct nlattr *tb[NL80211_MBSSID_CONFIG_ATTR_MAX + 1]; ++ ++ if (!wiphy->mbssid_max_interfaces) ++ return -EOPNOTSUPP; ++ ++ if (nla_parse_nested(tb, NL80211_MBSSID_CONFIG_ATTR_MAX, attrs, NULL, ++ NULL) || ++ !tb[NL80211_MBSSID_CONFIG_ATTR_INDEX]) ++ return -EINVAL; ++ ++ config->ema = nla_get_flag(tb[NL80211_MBSSID_CONFIG_ATTR_EMA]); ++ if (config->ema) { ++ if (!wiphy->ema_max_profile_periodicity) ++ return -EOPNOTSUPP; ++ ++ if (num_elems > wiphy->ema_max_profile_periodicity) ++ return -EINVAL; ++ } ++ ++ config->index = nla_get_u8(tb[NL80211_MBSSID_CONFIG_ATTR_INDEX]); ++ if (config->index >= wiphy->mbssid_max_interfaces || ++ (!config->index && !num_elems)) ++ return -EINVAL; ++ ++ if (tb[NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX]) { ++ u32 tx_ifindex = ++ nla_get_u32(tb[NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX]); ++ ++ if ((!config->index && tx_ifindex != dev->ifindex) || ++ (config->index && tx_ifindex == dev->ifindex)) ++ return -EINVAL; ++ ++ if (tx_ifindex != dev->ifindex) { ++ struct net_device *tx_netdev = ++ dev_get_by_index(wiphy_net(wiphy), tx_ifindex); ++ ++ if (!tx_netdev || !tx_netdev->ieee80211_ptr || ++ tx_netdev->ieee80211_ptr->wiphy != wiphy || ++ tx_netdev->ieee80211_ptr->iftype != ++ NL80211_IFTYPE_AP) { ++ dev_put(tx_netdev); ++ return -EINVAL; ++ } ++ ++ config->tx_wdev = tx_netdev->ieee80211_ptr; ++ } else { ++ config->tx_wdev = dev->ieee80211_ptr; ++ } ++ } else if (!config->index) { ++ config->tx_wdev = dev->ieee80211_ptr; ++ } else { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static struct cfg80211_mbssid_elems * ++nl80211_parse_mbssid_elems(struct wiphy *wiphy, struct nlattr *attrs) ++{ ++ struct nlattr *nl_elems; ++ struct cfg80211_mbssid_elems *elems; ++ int rem_elems; ++ u8 i = 0, num_elems = 0; ++ ++ if (!wiphy->mbssid_max_interfaces) ++ return ERR_PTR(-EINVAL); ++ ++ nla_for_each_nested(nl_elems, attrs, rem_elems) ++ num_elems++; ++ ++ elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL); ++ if (!elems) ++ return ERR_PTR(-ENOMEM); ++ ++ nla_for_each_nested(nl_elems, attrs, rem_elems) { ++ elems->elem[i].data = nla_data(nl_elems); ++ elems->elem[i].len = nla_len(nl_elems); ++ i++; ++ } ++ elems->cnt = num_elems; ++ return elems; ++} ++ + static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev, + struct nlattr *attrs[], + struct cfg80211_beacon_data *bcn) +@@ -5082,6 +5217,17 @@ static int nl80211_parse_beacon(struct c + bcn->ftm_responder = -1; + } + ++ if (attrs[NL80211_ATTR_MBSSID_ELEMS]) { ++ struct cfg80211_mbssid_elems *mbssid = ++ nl80211_parse_mbssid_elems(&rdev->wiphy, ++ attrs[NL80211_ATTR_MBSSID_ELEMS]); ++ ++ if (IS_ERR(mbssid)) ++ return PTR_ERR(mbssid); ++ ++ bcn->mbssid_ies = mbssid; ++ } ++ + return 0; + } + +@@ -5538,6 +5684,17 @@ static int nl80211_start_ap(struct sk_bu + goto out; + } + ++ if (info->attrs[NL80211_ATTR_MBSSID_CONFIG]) { ++ err = nl80211_parse_mbssid_config(&rdev->wiphy, dev, ++ info->attrs[NL80211_ATTR_MBSSID_CONFIG], ++ ¶ms.mbssid_config, ++ params.beacon.mbssid_ies ? ++ params.beacon.mbssid_ies->cnt : ++ 0); ++ if (err) ++ goto out; ++ } ++ + nl80211_calculate_ap_params(¶ms); + + if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT]) +@@ -5559,6 +5716,11 @@ static int nl80211_start_ap(struct sk_bu + + out: + kfree(params.acl); ++ kfree(params.beacon.mbssid_ies); ++ if (params.mbssid_config.tx_wdev && ++ params.mbssid_config.tx_wdev->netdev && ++ params.mbssid_config.tx_wdev->netdev != dev) ++ dev_put(params.mbssid_config.tx_wdev->netdev); + + return err; + } +@@ -5583,12 +5745,14 @@ static int nl80211_set_beacon(struct sk_ + + err = nl80211_parse_beacon(rdev, info->attrs, ¶ms); + if (err) +- return err; ++ goto out; + + wdev_lock(wdev); + err = rdev_change_beacon(rdev, dev, ¶ms); + wdev_unlock(wdev); + ++out: ++ kfree(params.mbssid_ies); + return err; + } + +@@ -9265,12 +9429,14 @@ static int nl80211_channel_switch(struct + + err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.beacon_after); + if (err) +- return err; ++ goto free; + + csa_attrs = kcalloc(NL80211_ATTR_MAX + 1, sizeof(*csa_attrs), + GFP_KERNEL); +- if (!csa_attrs) +- return -ENOMEM; ++ if (!csa_attrs) { ++ err = -ENOMEM; ++ goto free; ++ } + + err = nla_parse_nested_deprecated(csa_attrs, NL80211_ATTR_MAX, + info->attrs[NL80211_ATTR_CSA_IES], +@@ -9389,6 +9555,8 @@ skip_beacons: + wdev_unlock(wdev); + + free: ++ kfree(params.beacon_after.mbssid_ies); ++ kfree(params.beacon_csa.mbssid_ies); + kfree(csa_attrs); + return err; + } +@@ -14924,6 +15092,8 @@ static int nl80211_color_change(struct s + wdev_unlock(wdev); + + out: ++ kfree(params.beacon_next.mbssid_ies); ++ kfree(params.beacon_color_change.mbssid_ies); + kfree(tb); + return err; + } diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index e0a259cde5..3140eee5d0 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3835,6 +3835,7 @@ struct mgmt_frame_regs { +@@ -3869,6 +3869,7 @@ struct mgmt_frame_regs { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state -@@ -4159,6 +4160,7 @@ struct cfg80211_ops { +@@ -4193,6 +4194,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -36,9 +36,9 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -2593,6 +2593,9 @@ enum nl80211_commands { - * @NL80211_ATTR_COLOR_CHANGE_ELEMS: Nested set of attributes containing the IE - * information for the time while performing a color switch. +@@ -2608,6 +2608,9 @@ enum nl80211_commands { + * Mandatory parameter for the transmitting interface to enable MBSSID. + * Optional for the non-transmitting interfaces. * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. @@ -46,9 +46,9 @@ * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3096,6 +3099,8 @@ enum nl80211_attrs { - NL80211_ATTR_COLOR_CHANGE_COLOR, - NL80211_ATTR_COLOR_CHANGE_ELEMS, +@@ -3114,6 +3117,8 @@ enum nl80211_attrs { + NL80211_ATTR_MBSSID_CONFIG, + NL80211_ATTR_MBSSID_ELEMS, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + @@ -129,19 +129,18 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -780,6 +780,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, - [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, - [NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy), +@@ -793,6 +793,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_MBSSID_CONFIG] = + NLA_POLICY_NESTED(nl80211_mbssid_config_policy), + [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -3328,6 +3329,22 @@ static int nl80211_set_wiphy(struct sk_b - if (result) +@@ -3374,6 +3375,22 @@ static int nl80211_set_wiphy(struct sk_b goto out; } -+ + + if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) { + int idx, dbi = 0; + @@ -157,6 +156,7 @@ + if (result) + goto out; + } - ++ if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) { struct wireless_dev *txp_wdev = wdev; + enum nl80211_tx_power_setting type; diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch index 6d81dd0da1..3fb5ca255c 100644 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch @@ -30,19 +30,7 @@ * enum nl80211_commands - supported nl80211 commands * * @NL80211_CMD_UNSPEC: unspecified command to catch errors -@@ -360,10 +337,7 @@ - * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes - * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from - * userspace to request deletion of a virtual interface, then requires -- * attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are -- * enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS, -- * and if this command is used for the transmitting interface, then all -- * the non-transmitting interfaces are deleted as well. -+ * attribute %NL80211_ATTR_IFINDEX. - * - * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified - * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. -@@ -1226,12 +1200,6 @@ +@@ -1226,12 +1203,6 @@ * @NL80211_CMD_COLOR_CHANGE_COMPLETED: Notify userland that the color change * has completed * @@ -55,7 +43,7 @@ * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ -@@ -1472,8 +1440,6 @@ enum nl80211_commands { +@@ -1472,8 +1443,6 @@ enum nl80211_commands { NL80211_CMD_COLOR_CHANGE_ABORTED, NL80211_CMD_COLOR_CHANGE_COMPLETED, @@ -64,37 +52,26 @@ /* add new commands above here */ /* used to define NL80211_CMD_MAX below */ -@@ -2627,17 +2593,8 @@ enum nl80211_commands { - * @NL80211_ATTR_COLOR_CHANGE_ELEMS: Nested set of attributes containing the IE - * information for the time while performing a color switch. +@@ -2639,6 +2608,9 @@ enum nl80211_commands { + * Mandatory parameter for the transmitting interface to enable MBSSID. + * Optional for the non-transmitting interfaces. * -- * @NL80211_ATTR_MBSSID_CONFIG: Nested attribute for multiple BSSID -- * advertisements (MBSSID) parameters in AP mode. -- * Kernel uses this attribute to indicate the driver's support for MBSSID -- * and enhanced multi-BSSID advertisements (EMA AP) to the userspace. -- * Userspace should use this attribute to configure per interface MBSSID -- * parameters. -- * See &enum nl80211_mbssid_config_attributes for details. -- * -- * @NL80211_ATTR_MBSSID_ELEMS: Nested parameter to pass multiple BSSID elements. -- * Mandatory parameter for the transmitting interface to enable MBSSID. -- * Optional for the non-transmitting interfaces. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. - * ++ * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined -@@ -3142,8 +3099,7 @@ enum nl80211_attrs { - NL80211_ATTR_COLOR_CHANGE_COLOR, - NL80211_ATTR_COLOR_CHANGE_ELEMS, + * @__NL80211_ATTR_AFTER_LAST: internal use +@@ -3145,6 +3117,8 @@ enum nl80211_attrs { + NL80211_ATTR_MBSSID_CONFIG, + NL80211_ATTR_MBSSID_ELEMS, -- NL80211_ATTR_MBSSID_CONFIG, -- NL80211_ATTR_MBSSID_ELEMS, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, - ++ /* add attributes here, update the policy in nl80211.c */ -@@ -4978,7 +4934,6 @@ enum nl80211_txrate_gi { + __NL80211_ATTR_AFTER_LAST, +@@ -4978,7 +4952,6 @@ enum nl80211_txrate_gi { * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz) * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz) * @NL80211_BAND_S1GHZ: around 900MHz, supported by S1G PHYs @@ -102,7 +79,7 @@ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace * since newer kernel versions may support more bands */ -@@ -4988,7 +4943,6 @@ enum nl80211_band { +@@ -4988,7 +4961,6 @@ enum nl80211_band { NL80211_BAND_60GHZ, NL80211_BAND_6GHZ, NL80211_BAND_S1GHZ, @@ -110,7 +87,7 @@ NUM_NL80211_BANDS, }; -@@ -6046,11 +6000,6 @@ enum nl80211_feature_flags { +@@ -6046,11 +6018,6 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision * detection and change announcemnts. * @@ -122,7 +99,7 @@ * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ -@@ -6116,7 +6065,6 @@ enum nl80211_ext_feature_index { +@@ -6116,7 +6083,6 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_SECURE_RTT, NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, NL80211_EXT_FEATURE_BSS_COLOR, @@ -130,67 +107,24 @@ /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, -@@ -7406,60 +7354,4 @@ enum nl80211_sar_specs_attrs { - NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1, - }; - --/** -- * enum nl80211_mbssid_config_attributes - multiple BSSID (MBSSID) and enhanced -- * multi-BSSID advertisements (EMA) in AP mode. -- * Kernel uses some of these attributes to advertise driver's support for -- * MBSSID and EMA. -- * Remaining attributes should be used by the userspace to configure the -- * features. -- * -- * @__NL80211_MBSSID_CONFIG_ATTR_INVALID: Invalid -- * -- * @NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES: Used by the kernel to advertise -- * the maximum number of MBSSID interfaces supported by the driver. -- * Driver should indicate MBSSID support by setting -- * wiphy->mbssid_max_interfaces to a value more than or equal to 2. -- * -- * @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel -- * to advertise the maximum profile periodicity supported by the driver -- * if EMA is enabled. Driver should indicate EMA support to the userspace +@@ -7424,7 +7390,7 @@ enum nl80211_sar_specs_attrs { + * @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel + * to advertise the maximum profile periodicity supported by the driver + * if EMA is enabled. Driver should indicate EMA support to the userspace - * by setting wiphy->ema_max_profile_periodicity to -- * a non-zero value. -- * -- * @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of -- * this BSS (u8) in the multiple BSSID set. -- * Value must be set to 0 for the transmitting interface and non-zero for -- * all non-transmitting interfaces. The userspace will be responsible -- * for using unique indices for the interfaces. -- * Range: 0 to wiphy->mbssid_max_interfaces-1. -- * -- * @NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX: Mandatory parameter for -- * a non-transmitted profile which provides the interface index (u32) of -- * the transmitted profile. The value must match one of the interface -- * indices advertised by the kernel. Optional if the interface being set up -- * is the transmitting one, however, if provided then the value must match -- * the interface index of the same. -- * -- * @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature. -- * Setting this flag is permitted only if the driver advertises EMA support ++ * by setting wiphy->mbssid_max_ema_profile_periodicity to + * a non-zero value. + * + * @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of +@@ -7443,7 +7409,7 @@ enum nl80211_sar_specs_attrs { + * + * @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature. + * Setting this flag is permitted only if the driver advertises EMA support - * by setting wiphy->ema_max_profile_periodicity to non-zero. -- * -- * @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal -- * @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute -- */ --enum nl80211_mbssid_config_attributes { -- __NL80211_MBSSID_CONFIG_ATTR_INVALID, -- -- NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES, -- NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY, -- NL80211_MBSSID_CONFIG_ATTR_INDEX, -- NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX, -- NL80211_MBSSID_CONFIG_ATTR_EMA, -- -- /* keep last */ -- __NL80211_MBSSID_CONFIG_ATTR_LAST, -- NL80211_MBSSID_CONFIG_ATTR_MAX = __NL80211_MBSSID_CONFIG_ATTR_LAST - 1, --}; -- - #endif /* __LINUX_NL80211_H */ ++ * by setting wiphy->mbssid_max_ema_profile_periodicity to non-zero. + * + * @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal + * @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute --- a/info.c +++ b/info.c @@ -701,7 +701,6 @@ broken_combination: From 0b5a547ef0310a95467bbf8cce8c3e28a7ab1cfc Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 28 Jan 2022 14:32:21 +0100 Subject: [PATCH 088/144] mac80211: backport support for background radar detection Will be used in an upcoming mt76 update Signed-off-by: Felix Fietkau --- ...nt-APIs-for-dedicated-radar-detectio.patch | 378 +++++++++++++ ...ffchan_cac_event-to-a-dedicated-work.patch | 183 ++++++ ...sible-NULL-pointer-dereference-in-cf.patch | 99 ++++ ...e-offchan_cac_abort_wk-in-cfg80211_r.patch | 136 +++++ ...ontinuous-radar-monitoring-on-offcha.patch | 220 ++++++++ ...introduce-set_radar_offchan-callback.patch | 67 +++ ...offchannel_chain-structs-to-backgrou.patch | 532 ++++++++++++++++++ .../patches/subsys/400-allow-ibss-mixed.patch | 2 +- .../500-mac80211_configure_antenna_gain.patch | 22 +- 9 files changed, 1627 insertions(+), 12 deletions(-) create mode 100644 package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch create mode 100644 package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch create mode 100644 package/kernel/mac80211/patches/subsys/316-cfg80211-fix-possible-NULL-pointer-dereference-in-cf.patch create mode 100644 package/kernel/mac80211/patches/subsys/317-cfg80211-schedule-offchan_cac_abort_wk-in-cfg80211_r.patch create mode 100644 package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch create mode 100644 package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch create mode 100644 package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch diff --git a/package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch b/package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch new file mode 100644 index 0000000000..032bcf7a0c --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch @@ -0,0 +1,378 @@ +From: Lorenzo Bianconi +Date: Sat, 23 Oct 2021 11:10:50 +0200 +Subject: [PATCH] cfg80211: implement APIs for dedicated radar detection HW + +If a dedicated (off-channel) radar detection hardware (chain) +is available in the hardware/driver, allow this to be used by +calling the NL80211_CMD_RADAR_DETECT command with a new flag +attribute requesting off-channel radar detection is used. + +Offchannel CAC (channel availability check) avoids the CAC +downtime when switching to a radar channel or when turning on +the AP. + +Drivers advertise support for this using the new feature flag +NL80211_EXT_FEATURE_RADAR_OFFCHAN. + +Tested-by: Evelyn Tsai +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/7468e291ef5d05d692c1738d25b8f778d8ea5c3f.1634979655.git.lorenzo@kernel.org +Link: https://lore.kernel.org/r/1e60e60fef00e14401adae81c3d49f3e5f307537.1634979655.git.lorenzo@kernel.org +Link: https://lore.kernel.org/r/85fa50f57fc3adb2934c8d9ca0be30394de6b7e8.1634979655.git.lorenzo@kernel.org +Link: https://lore.kernel.org/r/4b6c08671ad59aae0ac46fc94c02f31b1610eb72.1634979655.git.lorenzo@kernel.org +Link: https://lore.kernel.org/r/241849ccaf2c228873c6f8495bf87b19159ba458.1634979655.git.lorenzo@kernel.org +[remove offchan_mutex, fix cfg80211_stop_offchan_radar_detection(), + remove gfp_t argument, fix documentation, fix tracing] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -4057,6 +4057,15 @@ struct mgmt_frame_regs { + * @set_sar_specs: Update the SAR (TX power) settings. + * + * @color_change: Initiate a color change. ++ * ++ * @set_radar_offchan: Configure dedicated offchannel chain available for ++ * radar/CAC detection on some hw. This chain can't be used to transmit ++ * or receive frames and it is bounded to a running wdev. ++ * Offchannel radar/CAC detection allows to avoid the CAC downtime ++ * switching to a different channel during CAC detection on the selected ++ * radar channel. ++ * The caller is expected to set chandef pointer to NULL in order to ++ * disable offchannel CAC/radar detection. + */ + struct cfg80211_ops { + int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); +@@ -4387,6 +4396,8 @@ struct cfg80211_ops { + int (*color_change)(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_color_change_settings *params); ++ int (*set_radar_offchan)(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef); + }; + + /* +@@ -7608,6 +7619,20 @@ void cfg80211_cac_event(struct net_devic + const struct cfg80211_chan_def *chandef, + enum nl80211_radar_event event, gfp_t gfp); + ++/** ++ * cfg80211_offchan_cac_event - Channel Availability Check (CAC) offchan event ++ * @wiphy: the wiphy ++ * @chandef: chandef for the current channel ++ * @event: type of event ++ * ++ * This function is called when a Channel Availability Check (CAC) is finished, ++ * started or aborted by a offchannel dedicated chain. ++ * ++ * Note that this acquires the wiphy lock. ++ */ ++void cfg80211_offchan_cac_event(struct wiphy *wiphy, ++ const struct cfg80211_chan_def *chandef, ++ enum nl80211_radar_event event); + + /** + * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying +--- a/include/uapi/linux/nl80211.h ++++ b/include/uapi/linux/nl80211.h +@@ -2608,6 +2608,13 @@ enum nl80211_commands { + * Mandatory parameter for the transmitting interface to enable MBSSID. + * Optional for the non-transmitting interfaces. + * ++ * @NL80211_ATTR_RADAR_OFFCHAN: Configure dedicated offchannel chain available for ++ * radar/CAC detection on some hw. This chain can't be used to transmit ++ * or receive frames and it is bounded to a running wdev. ++ * Offchannel radar/CAC detection allows to avoid the CAC downtime ++ * switching on a different channel during CAC detection on the selected ++ * radar channel. ++ * + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +@@ -3114,6 +3121,8 @@ enum nl80211_attrs { + NL80211_ATTR_MBSSID_CONFIG, + NL80211_ATTR_MBSSID_ELEMS, + ++ NL80211_ATTR_RADAR_OFFCHAN, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +@@ -6013,6 +6022,9 @@ enum nl80211_feature_flags { + * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision + * detection and change announcemnts. + * ++ * @NL80211_EXT_FEATURE_RADAR_OFFCHAN: Device supports offchannel radar/CAC ++ * detection. ++ * + * @NUM_NL80211_EXT_FEATURES: number of extended features. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index. + */ +@@ -6078,6 +6090,7 @@ enum nl80211_ext_feature_index { + NL80211_EXT_FEATURE_SECURE_RTT, + NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, + NL80211_EXT_FEATURE_BSS_COLOR, ++ NL80211_EXT_FEATURE_RADAR_OFFCHAN, + + /* add new features before the definition below */ + NUM_NL80211_EXT_FEATURES, +--- a/net/wireless/core.c ++++ b/net/wireless/core.c +@@ -552,6 +552,7 @@ use_default_name: + INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); + INIT_WORK(&rdev->conn_work, cfg80211_conn_work); + INIT_WORK(&rdev->event_work, cfg80211_event_work); ++ INIT_DELAYED_WORK(&rdev->offchan_cac_work, cfg80211_offchan_cac_work); + + init_waitqueue_head(&rdev->dev_wait); + +@@ -1214,6 +1215,8 @@ void __cfg80211_leave(struct cfg80211_re + + cfg80211_pmsr_wdev_down(wdev); + ++ cfg80211_stop_offchan_radar_detection(wdev); ++ + switch (wdev->iftype) { + case NL80211_IFTYPE_ADHOC: + __cfg80211_leave_ibss(rdev, dev, true); +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -84,6 +84,10 @@ struct cfg80211_registered_device { + + struct delayed_work dfs_update_channels_wk; + ++ struct wireless_dev *offchan_radar_wdev; ++ struct cfg80211_chan_def offchan_radar_chandef; ++ struct delayed_work offchan_cac_work; ++ + /* netlink port which started critical protocol (0 means not started) */ + u32 crit_proto_nlportid; + +@@ -491,6 +495,15 @@ cfg80211_chandef_dfs_cac_time(struct wip + + void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev); + ++int ++cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, ++ struct cfg80211_chan_def *chandef); ++ ++void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev); ++ ++void cfg80211_offchan_cac_work(struct work_struct *work); ++ + bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, + struct ieee80211_channel *chan); + +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -970,3 +970,116 @@ void cfg80211_cac_event(struct net_devic + nl80211_radar_notify(rdev, chandef, event, netdev, gfp); + } + EXPORT_SYMBOL(cfg80211_cac_event); ++ ++void cfg80211_offchan_cac_work(struct work_struct *work) ++{ ++ struct delayed_work *delayed_work = to_delayed_work(work); ++ struct cfg80211_registered_device *rdev; ++ ++ rdev = container_of(delayed_work, struct cfg80211_registered_device, ++ offchan_cac_work); ++ cfg80211_offchan_cac_event(&rdev->wiphy, &rdev->offchan_radar_chandef, ++ NL80211_RADAR_CAC_FINISHED); ++} ++ ++static void ++__cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, ++ const struct cfg80211_chan_def *chandef, ++ enum nl80211_radar_event event) ++{ ++ struct wiphy *wiphy = &rdev->wiphy; ++ struct net_device *netdev; ++ ++ lockdep_assert_wiphy(&rdev->wiphy); ++ ++ if (event != NL80211_RADAR_CAC_STARTED && !rdev->offchan_radar_wdev) ++ return; ++ ++ switch (event) { ++ case NL80211_RADAR_CAC_FINISHED: ++ cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); ++ memcpy(&rdev->cac_done_chandef, chandef, sizeof(*chandef)); ++ queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk); ++ cfg80211_sched_dfs_chan_update(rdev); ++ wdev = rdev->offchan_radar_wdev; ++ rdev->offchan_radar_wdev = NULL; ++ break; ++ case NL80211_RADAR_CAC_ABORTED: ++ cancel_delayed_work(&rdev->offchan_cac_work); ++ wdev = rdev->offchan_radar_wdev; ++ rdev->offchan_radar_wdev = NULL; ++ break; ++ case NL80211_RADAR_CAC_STARTED: ++ WARN_ON(!wdev); ++ rdev->offchan_radar_wdev = wdev; ++ break; ++ default: ++ return; ++ } ++ ++ netdev = wdev ? wdev->netdev : NULL; ++ nl80211_radar_notify(rdev, chandef, event, netdev, GFP_KERNEL); ++} ++ ++void cfg80211_offchan_cac_event(struct wiphy *wiphy, ++ const struct cfg80211_chan_def *chandef, ++ enum nl80211_radar_event event) ++{ ++ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); ++ ++ wiphy_lock(wiphy); ++ __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); ++ wiphy_unlock(wiphy); ++} ++EXPORT_SYMBOL(cfg80211_offchan_cac_event); ++ ++int ++cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, ++ struct cfg80211_chan_def *chandef) ++{ ++ unsigned int cac_time_ms; ++ int err; ++ ++ lockdep_assert_wiphy(&rdev->wiphy); ++ ++ if (!wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_RADAR_OFFCHAN)) ++ return -EOPNOTSUPP; ++ ++ if (rdev->offchan_radar_wdev) ++ return -EBUSY; ++ ++ err = rdev_set_radar_offchan(rdev, chandef); ++ if (err) ++ return err; ++ ++ cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, chandef); ++ if (!cac_time_ms) ++ cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; ++ ++ rdev->offchan_radar_chandef = *chandef; ++ __cfg80211_offchan_cac_event(rdev, wdev, chandef, ++ NL80211_RADAR_CAC_STARTED); ++ queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_work, ++ msecs_to_jiffies(cac_time_ms)); ++ ++ return 0; ++} ++ ++void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev) ++{ ++ struct wiphy *wiphy = wdev->wiphy; ++ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); ++ ++ lockdep_assert_wiphy(wiphy); ++ ++ if (wdev != rdev->offchan_radar_wdev) ++ return; ++ ++ rdev_set_radar_offchan(rdev, NULL); ++ ++ __cfg80211_offchan_cac_event(rdev, NULL, NULL, ++ NL80211_RADAR_CAC_ABORTED); ++} +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -793,6 +793,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_MBSSID_CONFIG] = + NLA_POLICY_NESTED(nl80211_mbssid_config_policy), + [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, ++ [NL80211_ATTR_RADAR_OFFCHAN] = { .type = NLA_FLAG }, + }; + + /* policy for the key attributes */ +@@ -9269,12 +9270,6 @@ static int nl80211_start_radar_detection + if (err) + return err; + +- if (netif_carrier_ok(dev)) +- return -EBUSY; +- +- if (wdev->cac_started) +- return -EBUSY; +- + err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); + if (err < 0) + return err; +@@ -9285,6 +9280,16 @@ static int nl80211_start_radar_detection + if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) + return -EINVAL; + ++ if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) ++ return cfg80211_start_offchan_radar_detection(rdev, wdev, ++ &chandef); ++ ++ if (netif_carrier_ok(dev)) ++ return -EBUSY; ++ ++ if (wdev->cac_started) ++ return -EBUSY; ++ + /* CAC start is offloaded to HW and can't be started manually */ + if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) + return -EOPNOTSUPP; +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -1381,4 +1381,21 @@ static inline int rdev_color_change(stru + return ret; + } + ++static inline int ++rdev_set_radar_offchan(struct cfg80211_registered_device *rdev, ++ struct cfg80211_chan_def *chandef) ++{ ++ struct wiphy *wiphy = &rdev->wiphy; ++ int ret; ++ ++ if (!rdev->ops->set_radar_offchan) ++ return -EOPNOTSUPP; ++ ++ trace_rdev_set_radar_offchan(wiphy, chandef); ++ ret = rdev->ops->set_radar_offchan(wiphy, chandef); ++ trace_rdev_return_int(wiphy, ret); ++ ++ return ret; ++} ++ + #endif /* __CFG80211_RDEV_OPS */ +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -3643,6 +3643,25 @@ TRACE_EVENT(cfg80211_bss_color_notify, + __entry->color_bitmap) + ); + ++TRACE_EVENT(rdev_set_radar_offchan, ++ TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), ++ ++ TP_ARGS(wiphy, chandef), ++ ++ TP_STRUCT__entry( ++ WIPHY_ENTRY ++ CHAN_DEF_ENTRY ++ ), ++ ++ TP_fast_assign( ++ WIPHY_ASSIGN; ++ CHAN_DEF_ASSIGN(chandef) ++ ), ++ ++ TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, ++ WIPHY_PR_ARG, CHAN_DEF_PR_ARG) ++); ++ + #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ + + #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch b/package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch new file mode 100644 index 0000000000..e58c3b99be --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch @@ -0,0 +1,183 @@ +From: Lorenzo Bianconi +Date: Wed, 27 Oct 2021 11:03:42 +0200 +Subject: [PATCH] cfg80211: move offchan_cac_event to a dedicated work + +In order to make cfg80211_offchan_cac_abort() (renamed from +cfg80211_offchan_cac_event) callable in other contexts and +without so much locking restrictions, make it trigger a new +work instead of operating directly. + +Do some other renames while at it to clarify. + +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/6145c3d0f30400a568023f67981981d24c7c6133.1635325205.git.lorenzo@kernel.org +[rewrite commit log] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -7620,19 +7620,13 @@ void cfg80211_cac_event(struct net_devic + enum nl80211_radar_event event, gfp_t gfp); + + /** +- * cfg80211_offchan_cac_event - Channel Availability Check (CAC) offchan event ++ * cfg80211_offchan_cac_abort - Channel Availability Check offchan abort event + * @wiphy: the wiphy +- * @chandef: chandef for the current channel +- * @event: type of event + * +- * This function is called when a Channel Availability Check (CAC) is finished, +- * started or aborted by a offchannel dedicated chain. +- * +- * Note that this acquires the wiphy lock. ++ * This function is called by the driver when a Channel Availability Check ++ * (CAC) is aborted by a offchannel dedicated chain. + */ +-void cfg80211_offchan_cac_event(struct wiphy *wiphy, +- const struct cfg80211_chan_def *chandef, +- enum nl80211_radar_event event); ++void cfg80211_offchan_cac_abort(struct wiphy *wiphy); + + /** + * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying +--- a/net/wireless/core.c ++++ b/net/wireless/core.c +@@ -552,7 +552,9 @@ use_default_name: + INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); + INIT_WORK(&rdev->conn_work, cfg80211_conn_work); + INIT_WORK(&rdev->event_work, cfg80211_event_work); +- INIT_DELAYED_WORK(&rdev->offchan_cac_work, cfg80211_offchan_cac_work); ++ INIT_WORK(&rdev->offchan_cac_abort_wk, cfg80211_offchan_cac_abort_wk); ++ INIT_DELAYED_WORK(&rdev->offchan_cac_done_wk, ++ cfg80211_offchan_cac_done_wk); + + init_waitqueue_head(&rdev->dev_wait); + +@@ -1062,11 +1064,13 @@ void wiphy_unregister(struct wiphy *wiph + cancel_work_sync(&rdev->conn_work); + flush_work(&rdev->event_work); + cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); ++ cancel_delayed_work_sync(&rdev->offchan_cac_done_wk); + flush_work(&rdev->destroy_work); + flush_work(&rdev->sched_scan_stop_wk); + flush_work(&rdev->propagate_radar_detect_wk); + flush_work(&rdev->propagate_cac_done_wk); + flush_work(&rdev->mgmt_registrations_update_wk); ++ flush_work(&rdev->offchan_cac_abort_wk); + + #ifdef CONFIG_PM + if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -86,7 +86,8 @@ struct cfg80211_registered_device { + + struct wireless_dev *offchan_radar_wdev; + struct cfg80211_chan_def offchan_radar_chandef; +- struct delayed_work offchan_cac_work; ++ struct delayed_work offchan_cac_done_wk; ++ struct work_struct offchan_cac_abort_wk; + + /* netlink port which started critical protocol (0 means not started) */ + u32 crit_proto_nlportid; +@@ -502,7 +503,9 @@ cfg80211_start_offchan_radar_detection(s + + void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev); + +-void cfg80211_offchan_cac_work(struct work_struct *work); ++void cfg80211_offchan_cac_done_wk(struct work_struct *work); ++ ++void cfg80211_offchan_cac_abort_wk(struct work_struct *work); + + bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, + struct ieee80211_channel *chan); +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -971,17 +971,6 @@ void cfg80211_cac_event(struct net_devic + } + EXPORT_SYMBOL(cfg80211_cac_event); + +-void cfg80211_offchan_cac_work(struct work_struct *work) +-{ +- struct delayed_work *delayed_work = to_delayed_work(work); +- struct cfg80211_registered_device *rdev; +- +- rdev = container_of(delayed_work, struct cfg80211_registered_device, +- offchan_cac_work); +- cfg80211_offchan_cac_event(&rdev->wiphy, &rdev->offchan_radar_chandef, +- NL80211_RADAR_CAC_FINISHED); +-} +- + static void + __cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, + struct wireless_dev *wdev, +@@ -1006,7 +995,7 @@ __cfg80211_offchan_cac_event(struct cfg8 + rdev->offchan_radar_wdev = NULL; + break; + case NL80211_RADAR_CAC_ABORTED: +- cancel_delayed_work(&rdev->offchan_cac_work); ++ cancel_delayed_work(&rdev->offchan_cac_done_wk); + wdev = rdev->offchan_radar_wdev; + rdev->offchan_radar_wdev = NULL; + break; +@@ -1022,17 +1011,44 @@ __cfg80211_offchan_cac_event(struct cfg8 + nl80211_radar_notify(rdev, chandef, event, netdev, GFP_KERNEL); + } + +-void cfg80211_offchan_cac_event(struct wiphy *wiphy, +- const struct cfg80211_chan_def *chandef, +- enum nl80211_radar_event event) ++static void ++cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, ++ const struct cfg80211_chan_def *chandef, ++ enum nl80211_radar_event event) ++{ ++ wiphy_lock(&rdev->wiphy); ++ __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); ++ wiphy_unlock(&rdev->wiphy); ++} ++ ++void cfg80211_offchan_cac_done_wk(struct work_struct *work) ++{ ++ struct delayed_work *delayed_work = to_delayed_work(work); ++ struct cfg80211_registered_device *rdev; ++ ++ rdev = container_of(delayed_work, struct cfg80211_registered_device, ++ offchan_cac_done_wk); ++ cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, ++ NL80211_RADAR_CAC_FINISHED); ++} ++ ++void cfg80211_offchan_cac_abort_wk(struct work_struct *work) ++{ ++ struct cfg80211_registered_device *rdev; ++ ++ rdev = container_of(work, struct cfg80211_registered_device, ++ offchan_cac_abort_wk); ++ cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, ++ NL80211_RADAR_CAC_ABORTED); ++} ++ ++void cfg80211_offchan_cac_abort(struct wiphy *wiphy) + { + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); + +- wiphy_lock(wiphy); +- __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); +- wiphy_unlock(wiphy); ++ queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); + } +-EXPORT_SYMBOL(cfg80211_offchan_cac_event); ++EXPORT_SYMBOL(cfg80211_offchan_cac_abort); + + int + cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, +@@ -1062,7 +1078,7 @@ cfg80211_start_offchan_radar_detection(s + rdev->offchan_radar_chandef = *chandef; + __cfg80211_offchan_cac_event(rdev, wdev, chandef, + NL80211_RADAR_CAC_STARTED); +- queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_work, ++ queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_done_wk, + msecs_to_jiffies(cac_time_ms)); + + return 0; diff --git a/package/kernel/mac80211/patches/subsys/316-cfg80211-fix-possible-NULL-pointer-dereference-in-cf.patch b/package/kernel/mac80211/patches/subsys/316-cfg80211-fix-possible-NULL-pointer-dereference-in-cf.patch new file mode 100644 index 0000000000..362bb885d7 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/316-cfg80211-fix-possible-NULL-pointer-dereference-in-cf.patch @@ -0,0 +1,99 @@ +From: Lorenzo Bianconi +Date: Wed, 3 Nov 2021 18:02:35 +0100 +Subject: [PATCH] cfg80211: fix possible NULL pointer dereference in + cfg80211_stop_offchan_radar_detection + +Fix the following NULL pointer dereference in +cfg80211_stop_offchan_radar_detection routine that occurs when hostapd +is stopped during the CAC on offchannel chain: + +Sat Jan 1 0[ 779.567851] ESR = 0x96000005 +0:12:50 2000 dae[ 779.572346] EC = 0x25: DABT (current EL), IL = 32 bits +mon.debug hostap[ 779.578984] SET = 0, FnV = 0 +d: hostapd_inter[ 779.583445] EA = 0, S1PTW = 0 +face_deinit_free[ 779.587936] Data abort info: +: num_bss=1 conf[ 779.592224] ISV = 0, ISS = 0x00000005 +->num_bss=1 +Sat[ 779.597403] CM = 0, WnR = 0 + Jan 1 00:12:50[ 779.601749] user pgtable: 4k pages, 39-bit VAs, pgdp=00000000418b2000 + 2000 daemon.deb[ 779.609601] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 +ug hostapd: host[ 779.619657] Internal error: Oops: 96000005 [#1] SMP +[ 779.770810] CPU: 0 PID: 2202 Comm: hostapd Not tainted 5.10.75 #0 +[ 779.776892] Hardware name: MediaTek MT7622 RFB1 board (DT) +[ 779.782370] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) +[ 779.788384] pc : cfg80211_chandef_valid+0x10/0x490 [cfg80211] +[ 779.794128] lr : cfg80211_check_station_change+0x3190/0x3950 [cfg80211] +[ 779.800731] sp : ffffffc01204b7e0 +[ 779.804036] x29: ffffffc01204b7e0 x28: ffffff80039bdc00 +[ 779.809340] x27: 0000000000000000 x26: ffffffc008cb3050 +[ 779.814644] x25: 0000000000000000 x24: 0000000000000002 +[ 779.819948] x23: ffffff8002630000 x22: ffffff8003e748d0 +[ 779.825252] x21: 0000000000000cc0 x20: ffffff8003da4a00 +[ 779.830556] x19: 0000000000000000 x18: ffffff8001bf7ce0 +[ 779.835860] x17: 00000000ffffffff x16: 0000000000000000 +[ 779.841164] x15: 0000000040d59200 x14: 00000000000019c0 +[ 779.846467] x13: 00000000000001c8 x12: 000636b9e9dab1c6 +[ 779.851771] x11: 0000000000000141 x10: 0000000000000820 +[ 779.857076] x9 : 0000000000000000 x8 : ffffff8003d7d038 +[ 779.862380] x7 : 0000000000000000 x6 : ffffff8003d7d038 +[ 779.867683] x5 : 0000000000000e90 x4 : 0000000000000038 +[ 779.872987] x3 : 0000000000000002 x2 : 0000000000000004 +[ 779.878291] x1 : 0000000000000000 x0 : 0000000000000000 +[ 779.883594] Call trace: +[ 779.886039] cfg80211_chandef_valid+0x10/0x490 [cfg80211] +[ 779.891434] cfg80211_check_station_change+0x3190/0x3950 [cfg80211] +[ 779.897697] nl80211_radar_notify+0x138/0x19c [cfg80211] +[ 779.903005] cfg80211_stop_offchan_radar_detection+0x7c/0x8c [cfg80211] +[ 779.909616] __cfg80211_leave+0x2c/0x190 [cfg80211] +[ 779.914490] cfg80211_register_netdevice+0x1c0/0x6d0 [cfg80211] +[ 779.920404] raw_notifier_call_chain+0x50/0x70 +[ 779.924841] call_netdevice_notifiers_info+0x54/0xa0 +[ 779.929796] __dev_close_many+0x40/0x100 +[ 779.933712] __dev_change_flags+0x98/0x190 +[ 779.937800] dev_change_flags+0x20/0x60 +[ 779.941628] devinet_ioctl+0x534/0x6d0 +[ 779.945370] inet_ioctl+0x1bc/0x230 +[ 779.948849] sock_do_ioctl+0x44/0x200 +[ 779.952502] sock_ioctl+0x268/0x4c0 +[ 779.955985] __arm64_sys_ioctl+0xac/0xd0 +[ 779.959900] el0_svc_common.constprop.0+0x60/0x110 +[ 779.964682] do_el0_svc+0x1c/0x24 +[ 779.967990] el0_svc+0x10/0x1c +[ 779.971036] el0_sync_handler+0x9c/0x120 +[ 779.974950] el0_sync+0x148/0x180 +[ 779.978259] Code: a9bc7bfd 910003fd a90153f3 aa0003f3 (f9400000) +[ 779.984344] ---[ end trace 0e67b4f5d6cdeec7 ]--- +[ 779.996400] Kernel panic - not syncing: Oops: Fatal exception +[ 780.002139] SMP: stopping secondary CPUs +[ 780.006057] Kernel Offset: disabled +[ 780.009537] CPU features: 0x0000002,04002004 +[ 780.013796] Memory Limit: none + +Fixes: b8f5facf286b ("cfg80211: implement APIs for dedicated radar detection HW") +Reported-by: Evelyn Tsai +Tested-by: Evelyn Tsai +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/c2e34c065bf8839c5ffa45498ae154021a72a520.1635958796.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -982,6 +982,9 @@ __cfg80211_offchan_cac_event(struct cfg8 + + lockdep_assert_wiphy(&rdev->wiphy); + ++ if (!cfg80211_chandef_valid(chandef)) ++ return; ++ + if (event != NL80211_RADAR_CAC_STARTED && !rdev->offchan_radar_wdev) + return; + +@@ -1096,6 +1099,6 @@ void cfg80211_stop_offchan_radar_detecti + + rdev_set_radar_offchan(rdev, NULL); + +- __cfg80211_offchan_cac_event(rdev, NULL, NULL, ++ __cfg80211_offchan_cac_event(rdev, wdev, &rdev->offchan_radar_chandef, + NL80211_RADAR_CAC_ABORTED); + } diff --git a/package/kernel/mac80211/patches/subsys/317-cfg80211-schedule-offchan_cac_abort_wk-in-cfg80211_r.patch b/package/kernel/mac80211/patches/subsys/317-cfg80211-schedule-offchan_cac_abort_wk-in-cfg80211_r.patch new file mode 100644 index 0000000000..df7afefb34 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/317-cfg80211-schedule-offchan_cac_abort_wk-in-cfg80211_r.patch @@ -0,0 +1,136 @@ +From: Lorenzo Bianconi +Date: Tue, 16 Nov 2021 12:41:52 +0100 +Subject: [PATCH] cfg80211: schedule offchan_cac_abort_wk in + cfg80211_radar_event + +If necessary schedule offchan_cac_abort_wk work in cfg80211_radar_event +routine adding offchan parameter to cfg80211_radar_event signature. +Rename cfg80211_radar_event in __cfg80211_radar_event and introduce +the two following inline helpers: +- cfg80211_radar_event +- cfg80211_offchan_radar_event +Doing so the drv will not need to run cfg80211_offchan_cac_abort() after +radar detection on the offchannel chain. + +Tested-by: Owen Peng +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/3ff583e021e3343a3ced54a7b09b5e184d1880dc.1637062727.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -7580,15 +7580,33 @@ void cfg80211_cqm_txe_notify(struct net_ + void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); + + /** +- * cfg80211_radar_event - radar detection event ++ * __cfg80211_radar_event - radar detection event + * @wiphy: the wiphy + * @chandef: chandef for the current channel ++ * @offchan: the radar has been detected on the offchannel chain + * @gfp: context flags + * + * This function is called when a radar is detected on the current chanenl. + */ +-void cfg80211_radar_event(struct wiphy *wiphy, +- struct cfg80211_chan_def *chandef, gfp_t gfp); ++void __cfg80211_radar_event(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef, ++ bool offchan, gfp_t gfp); ++ ++static inline void ++cfg80211_radar_event(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef, ++ gfp_t gfp) ++{ ++ __cfg80211_radar_event(wiphy, chandef, false, gfp); ++} ++ ++static inline void ++cfg80211_offchan_radar_event(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef, ++ gfp_t gfp) ++{ ++ __cfg80211_radar_event(wiphy, chandef, true, gfp); ++} + + /** + * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -905,13 +905,13 @@ void cfg80211_dfs_channels_update_work(s + } + + +-void cfg80211_radar_event(struct wiphy *wiphy, +- struct cfg80211_chan_def *chandef, +- gfp_t gfp) ++void __cfg80211_radar_event(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef, ++ bool offchan, gfp_t gfp) + { + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); + +- trace_cfg80211_radar_event(wiphy, chandef); ++ trace_cfg80211_radar_event(wiphy, chandef, offchan); + + /* only set the chandef supplied channel to unavailable, in + * case the radar is detected on only one of multiple channels +@@ -919,6 +919,9 @@ void cfg80211_radar_event(struct wiphy * + */ + cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_UNAVAILABLE); + ++ if (offchan) ++ queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); ++ + cfg80211_sched_dfs_chan_update(rdev); + + nl80211_radar_notify(rdev, chandef, NL80211_RADAR_DETECTED, NULL, gfp); +@@ -926,7 +929,7 @@ void cfg80211_radar_event(struct wiphy * + memcpy(&rdev->radar_chandef, chandef, sizeof(struct cfg80211_chan_def)); + queue_work(cfg80211_wq, &rdev->propagate_radar_detect_wk); + } +-EXPORT_SYMBOL(cfg80211_radar_event); ++EXPORT_SYMBOL(__cfg80211_radar_event); + + void cfg80211_cac_event(struct net_device *netdev, + const struct cfg80211_chan_def *chandef, +@@ -998,7 +1001,8 @@ __cfg80211_offchan_cac_event(struct cfg8 + rdev->offchan_radar_wdev = NULL; + break; + case NL80211_RADAR_CAC_ABORTED: +- cancel_delayed_work(&rdev->offchan_cac_done_wk); ++ if (!cancel_delayed_work(&rdev->offchan_cac_done_wk)) ++ return; + wdev = rdev->offchan_radar_wdev; + rdev->offchan_radar_wdev = NULL; + break; +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -3022,18 +3022,21 @@ TRACE_EVENT(cfg80211_ch_switch_started_n + ); + + TRACE_EVENT(cfg80211_radar_event, +- TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), +- TP_ARGS(wiphy, chandef), ++ TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, ++ bool offchan), ++ TP_ARGS(wiphy, chandef, offchan), + TP_STRUCT__entry( + WIPHY_ENTRY + CHAN_DEF_ENTRY ++ __field(bool, offchan) + ), + TP_fast_assign( + WIPHY_ASSIGN; + CHAN_DEF_ASSIGN(chandef); ++ __entry->offchan = offchan; + ), +- TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, +- WIPHY_PR_ARG, CHAN_DEF_PR_ARG) ++ TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", offchan %d", ++ WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->offchan) + ); + + TRACE_EVENT(cfg80211_cac_event, diff --git a/package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch b/package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch new file mode 100644 index 0000000000..ae97947fab --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch @@ -0,0 +1,220 @@ +From: Lorenzo Bianconi +Date: Tue, 16 Nov 2021 15:03:36 +0100 +Subject: [PATCH] cfg80211: allow continuous radar monitoring on offchannel + chain + +Allow continuous radar detection on the offchannel chain in order +to switch to the monitored channel whenever the underlying driver +reports a radar pattern on the main channel. + +Tested-by: Owen Peng +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/d46217310a49b14ff0e9c002f0a6e0547d70fd2c.1637071350.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -712,6 +712,19 @@ static bool cfg80211_is_wiphy_oper_chan( + return false; + } + ++static bool ++cfg80211_offchan_chain_is_active(struct cfg80211_registered_device *rdev, ++ struct ieee80211_channel *channel) ++{ ++ if (!rdev->offchan_radar_wdev) ++ return false; ++ ++ if (!cfg80211_chandef_valid(&rdev->offchan_radar_chandef)) ++ return false; ++ ++ return cfg80211_is_sub_chan(&rdev->offchan_radar_chandef, channel); ++} ++ + bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, + struct ieee80211_channel *chan) + { +@@ -728,6 +741,9 @@ bool cfg80211_any_wiphy_oper_chan(struct + + if (cfg80211_is_wiphy_oper_chan(&rdev->wiphy, chan)) + return true; ++ ++ if (cfg80211_offchan_chain_is_active(rdev, chan)) ++ return true; + } + + return false; +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -988,7 +988,7 @@ __cfg80211_offchan_cac_event(struct cfg8 + if (!cfg80211_chandef_valid(chandef)) + return; + +- if (event != NL80211_RADAR_CAC_STARTED && !rdev->offchan_radar_wdev) ++ if (!rdev->offchan_radar_wdev) + return; + + switch (event) { +@@ -998,17 +998,13 @@ __cfg80211_offchan_cac_event(struct cfg8 + queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk); + cfg80211_sched_dfs_chan_update(rdev); + wdev = rdev->offchan_radar_wdev; +- rdev->offchan_radar_wdev = NULL; + break; + case NL80211_RADAR_CAC_ABORTED: + if (!cancel_delayed_work(&rdev->offchan_cac_done_wk)) + return; + wdev = rdev->offchan_radar_wdev; +- rdev->offchan_radar_wdev = NULL; + break; + case NL80211_RADAR_CAC_STARTED: +- WARN_ON(!wdev); +- rdev->offchan_radar_wdev = wdev; + break; + default: + return; +@@ -1024,7 +1020,8 @@ cfg80211_offchan_cac_event(struct cfg802 + enum nl80211_radar_event event) + { + wiphy_lock(&rdev->wiphy); +- __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); ++ __cfg80211_offchan_cac_event(rdev, rdev->offchan_radar_wdev, ++ chandef, event); + wiphy_unlock(&rdev->wiphy); + } + +@@ -1071,7 +1068,13 @@ cfg80211_start_offchan_radar_detection(s + NL80211_EXT_FEATURE_RADAR_OFFCHAN)) + return -EOPNOTSUPP; + +- if (rdev->offchan_radar_wdev) ++ /* Offchannel chain already locked by another wdev */ ++ if (rdev->offchan_radar_wdev && rdev->offchan_radar_wdev != wdev) ++ return -EBUSY; ++ ++ /* CAC already in progress on the offchannel chain */ ++ if (rdev->offchan_radar_wdev == wdev && ++ delayed_work_pending(&rdev->offchan_cac_done_wk)) + return -EBUSY; + + err = rdev_set_radar_offchan(rdev, chandef); +@@ -1083,6 +1086,8 @@ cfg80211_start_offchan_radar_detection(s + cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; + + rdev->offchan_radar_chandef = *chandef; ++ rdev->offchan_radar_wdev = wdev; /* Get offchain ownership */ ++ + __cfg80211_offchan_cac_event(rdev, wdev, chandef, + NL80211_RADAR_CAC_STARTED); + queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_done_wk, +@@ -1102,6 +1107,7 @@ void cfg80211_stop_offchan_radar_detecti + return; + + rdev_set_radar_offchan(rdev, NULL); ++ rdev->offchan_radar_wdev = NULL; /* Release offchain ownership */ + + __cfg80211_offchan_cac_event(rdev, wdev, &rdev->offchan_radar_chandef, + NL80211_RADAR_CAC_ABORTED); +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -9260,42 +9260,60 @@ static int nl80211_start_radar_detection + struct cfg80211_chan_def chandef; + enum nl80211_dfs_regions dfs_region; + unsigned int cac_time_ms; +- int err; ++ int err = -EINVAL; ++ ++ flush_delayed_work(&rdev->dfs_update_channels_wk); ++ ++ wiphy_lock(wiphy); + + dfs_region = reg_get_dfs_region(wiphy); + if (dfs_region == NL80211_DFS_UNSET) +- return -EINVAL; ++ goto unlock; + + err = nl80211_parse_chandef(rdev, info, &chandef); + if (err) +- return err; ++ goto unlock; + + err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); + if (err < 0) +- return err; ++ goto unlock; + +- if (err == 0) +- return -EINVAL; ++ if (err == 0) { ++ err = -EINVAL; ++ goto unlock; ++ } + +- if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) +- return -EINVAL; ++ if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) { ++ err = -EINVAL; ++ goto unlock; ++ } + +- if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) +- return cfg80211_start_offchan_radar_detection(rdev, wdev, +- &chandef); ++ if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) { ++ err = cfg80211_start_offchan_radar_detection(rdev, wdev, ++ &chandef); ++ goto unlock; ++ } + +- if (netif_carrier_ok(dev)) +- return -EBUSY; ++ if (netif_carrier_ok(dev)) { ++ err = -EBUSY; ++ goto unlock; ++ } + +- if (wdev->cac_started) +- return -EBUSY; ++ if (wdev->cac_started) { ++ err = -EBUSY; ++ goto unlock; ++ } + + /* CAC start is offloaded to HW and can't be started manually */ +- if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) +- return -EOPNOTSUPP; ++ if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) { ++ err = -EOPNOTSUPP; ++ goto unlock; ++ } + +- if (!rdev->ops->start_radar_detection) +- return -EOPNOTSUPP; ++ if (!rdev->ops->start_radar_detection) { ++ err = -EOPNOTSUPP; ++ goto unlock; ++ } + + cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, &chandef); + if (WARN_ON(!cac_time_ms)) +@@ -9308,6 +9326,9 @@ static int nl80211_start_radar_detection + wdev->cac_start_time = jiffies; + wdev->cac_time_ms = cac_time_ms; + } ++unlock: ++ wiphy_unlock(wiphy); ++ + return err; + } + +@@ -15926,7 +15947,8 @@ static const struct genl_small_ops nl802 + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .doit = nl80211_start_radar_detection, + .flags = GENL_UNS_ADMIN_PERM, +- .internal_flags = NL80211_FLAG_NEED_NETDEV_UP, ++ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | ++ NL80211_FLAG_NO_WIPHY_MTX, + }, + { + .cmd = NL80211_CMD_GET_PROTOCOL_FEATURES, diff --git a/package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch b/package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch new file mode 100644 index 0000000000..127b86e76d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch @@ -0,0 +1,67 @@ +From: Lorenzo Bianconi +Date: Sat, 23 Oct 2021 11:10:51 +0200 +Subject: [PATCH] mac80211: introduce set_radar_offchan callback + +Similar to cfg80211, introduce set_radar_offchan callback in mac80211_ops +in order to configure a dedicated offchannel chain available on some hw +(e.g. mt7915) to perform offchannel CAC detection and avoid tx/rx downtime. + +Tested-by: Evelyn Tsai +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/201110606d4f3a7dfdf31440e351f2e2c375d4f0.1634979655.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -3937,6 +3937,14 @@ struct ieee80211_prep_tx_info { + * twt structure. + * @twt_teardown_request: Update the hw with TWT teardown request received + * from the peer. ++ * @set_radar_offchan: Configure dedicated offchannel chain available for ++ * radar/CAC detection on some hw. This chain can't be used to transmit ++ * or receive frames and it is bounded to a running wdev. ++ * Offchannel radar/CAC detection allows to avoid the CAC downtime ++ * switching to a different channel during CAC detection on the selected ++ * radar channel. ++ * The caller is expected to set chandef pointer to NULL in order to ++ * disable offchannel CAC/radar detection. + * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to + * resolve a path for hardware flow offloading + */ +@@ -4267,6 +4275,8 @@ struct ieee80211_ops { + struct ieee80211_twt_setup *twt); + void (*twt_teardown_request)(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, u8 flowid); ++ int (*set_radar_offchan)(struct ieee80211_hw *hw, ++ struct cfg80211_chan_def *chandef); + int (*net_fill_forward_path)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -4344,6 +4344,18 @@ out: + return err; + } + ++static int ++ieee80211_set_radar_offchan(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef) ++{ ++ struct ieee80211_local *local = wiphy_priv(wiphy); ++ ++ if (!local->ops->set_radar_offchan) ++ return -EOPNOTSUPP; ++ ++ return local->ops->set_radar_offchan(&local->hw, chandef); ++} ++ + const struct cfg80211_ops mac80211_config_ops = { + .add_virtual_intf = ieee80211_add_iface, + .del_virtual_intf = ieee80211_del_iface, +@@ -4448,4 +4460,5 @@ const struct cfg80211_ops mac80211_confi + .reset_tid_config = ieee80211_reset_tid_config, + .set_sar_specs = ieee80211_set_sar_specs, + .color_change = ieee80211_color_change, ++ .set_radar_offchan = ieee80211_set_radar_offchan, + }; diff --git a/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch b/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch new file mode 100644 index 0000000000..ce4611b145 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch @@ -0,0 +1,532 @@ +From: Lorenzo Bianconi +Date: Mon, 29 Nov 2021 14:11:24 +0100 +Subject: [PATCH] cfg80211: rename offchannel_chain structs to background_chain + to avoid confusion with ETSI standard + +ETSI standard defines "Offchannel CAC" as: +"Off-Channel CAC is performed by a number of non-continuous checks +spread over a period in time. This period, which is required to +determine the presence of radar signals, is defined as the Off-Channel +CAC Time.. +Minimum Off-Channel CAC Time 6 minutes and Maximum Off-Channel CAC Time +4 hours..". +mac80211 implementation refers to a dedicated hw chain used for continuous +radar monitoring. Rename offchannel_* references to background_* in +order to avoid confusion with ETSI standard. + +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/4204cc1d648d76b44557981713231e030a3bd991.1638190762.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -4058,14 +4058,14 @@ struct mgmt_frame_regs { + * + * @color_change: Initiate a color change. + * +- * @set_radar_offchan: Configure dedicated offchannel chain available for ++ * @set_radar_background: Configure dedicated offchannel chain available for + * radar/CAC detection on some hw. This chain can't be used to transmit + * or receive frames and it is bounded to a running wdev. +- * Offchannel radar/CAC detection allows to avoid the CAC downtime ++ * Background radar/CAC detection allows to avoid the CAC downtime + * switching to a different channel during CAC detection on the selected + * radar channel. + * The caller is expected to set chandef pointer to NULL in order to +- * disable offchannel CAC/radar detection. ++ * disable background CAC/radar detection. + */ + struct cfg80211_ops { + int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); +@@ -4396,8 +4396,8 @@ struct cfg80211_ops { + int (*color_change)(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_color_change_settings *params); +- int (*set_radar_offchan)(struct wiphy *wiphy, +- struct cfg80211_chan_def *chandef); ++ int (*set_radar_background)(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef); + }; + + /* +@@ -7601,9 +7601,9 @@ cfg80211_radar_event(struct wiphy *wiphy + } + + static inline void +-cfg80211_offchan_radar_event(struct wiphy *wiphy, +- struct cfg80211_chan_def *chandef, +- gfp_t gfp) ++cfg80211_background_radar_event(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef, ++ gfp_t gfp) + { + __cfg80211_radar_event(wiphy, chandef, true, gfp); + } +@@ -7638,13 +7638,13 @@ void cfg80211_cac_event(struct net_devic + enum nl80211_radar_event event, gfp_t gfp); + + /** +- * cfg80211_offchan_cac_abort - Channel Availability Check offchan abort event ++ * cfg80211_background_cac_abort - Channel Availability Check offchan abort event + * @wiphy: the wiphy + * + * This function is called by the driver when a Channel Availability Check + * (CAC) is aborted by a offchannel dedicated chain. + */ +-void cfg80211_offchan_cac_abort(struct wiphy *wiphy); ++void cfg80211_background_cac_abort(struct wiphy *wiphy); + + /** + * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -3937,14 +3937,14 @@ struct ieee80211_prep_tx_info { + * twt structure. + * @twt_teardown_request: Update the hw with TWT teardown request received + * from the peer. +- * @set_radar_offchan: Configure dedicated offchannel chain available for ++ * @set_radar_background: Configure dedicated offchannel chain available for + * radar/CAC detection on some hw. This chain can't be used to transmit + * or receive frames and it is bounded to a running wdev. +- * Offchannel radar/CAC detection allows to avoid the CAC downtime ++ * Background radar/CAC detection allows to avoid the CAC downtime + * switching to a different channel during CAC detection on the selected + * radar channel. + * The caller is expected to set chandef pointer to NULL in order to +- * disable offchannel CAC/radar detection. ++ * disable background CAC/radar detection. + * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to + * resolve a path for hardware flow offloading + */ +@@ -4275,8 +4275,8 @@ struct ieee80211_ops { + struct ieee80211_twt_setup *twt); + void (*twt_teardown_request)(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, u8 flowid); +- int (*set_radar_offchan)(struct ieee80211_hw *hw, +- struct cfg80211_chan_def *chandef); ++ int (*set_radar_background)(struct ieee80211_hw *hw, ++ struct cfg80211_chan_def *chandef); + int (*net_fill_forward_path)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, +--- a/include/uapi/linux/nl80211.h ++++ b/include/uapi/linux/nl80211.h +@@ -2608,10 +2608,10 @@ enum nl80211_commands { + * Mandatory parameter for the transmitting interface to enable MBSSID. + * Optional for the non-transmitting interfaces. + * +- * @NL80211_ATTR_RADAR_OFFCHAN: Configure dedicated offchannel chain available for +- * radar/CAC detection on some hw. This chain can't be used to transmit +- * or receive frames and it is bounded to a running wdev. +- * Offchannel radar/CAC detection allows to avoid the CAC downtime ++ * @NL80211_ATTR_RADAR_BACKGROUND: Configure dedicated offchannel chain ++ * available for radar/CAC detection on some hw. This chain can't be used ++ * to transmit or receive frames and it is bounded to a running wdev. ++ * Background radar/CAC detection allows to avoid the CAC downtime + * switching on a different channel during CAC detection on the selected + * radar channel. + * +@@ -3121,7 +3121,7 @@ enum nl80211_attrs { + NL80211_ATTR_MBSSID_CONFIG, + NL80211_ATTR_MBSSID_ELEMS, + +- NL80211_ATTR_RADAR_OFFCHAN, ++ NL80211_ATTR_RADAR_BACKGROUND, + + /* add attributes here, update the policy in nl80211.c */ + +@@ -6022,7 +6022,7 @@ enum nl80211_feature_flags { + * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision + * detection and change announcemnts. + * +- * @NL80211_EXT_FEATURE_RADAR_OFFCHAN: Device supports offchannel radar/CAC ++ * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC + * detection. + * + * @NUM_NL80211_EXT_FEATURES: number of extended features. +@@ -6090,7 +6090,7 @@ enum nl80211_ext_feature_index { + NL80211_EXT_FEATURE_SECURE_RTT, + NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, + NL80211_EXT_FEATURE_BSS_COLOR, +- NL80211_EXT_FEATURE_RADAR_OFFCHAN, ++ NL80211_EXT_FEATURE_RADAR_BACKGROUND, + + /* add new features before the definition below */ + NUM_NL80211_EXT_FEATURES, +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -4345,15 +4345,15 @@ out: + } + + static int +-ieee80211_set_radar_offchan(struct wiphy *wiphy, +- struct cfg80211_chan_def *chandef) ++ieee80211_set_radar_background(struct wiphy *wiphy, ++ struct cfg80211_chan_def *chandef) + { + struct ieee80211_local *local = wiphy_priv(wiphy); + +- if (!local->ops->set_radar_offchan) ++ if (!local->ops->set_radar_background) + return -EOPNOTSUPP; + +- return local->ops->set_radar_offchan(&local->hw, chandef); ++ return local->ops->set_radar_background(&local->hw, chandef); + } + + const struct cfg80211_ops mac80211_config_ops = { +@@ -4460,5 +4460,5 @@ const struct cfg80211_ops mac80211_confi + .reset_tid_config = ieee80211_reset_tid_config, + .set_sar_specs = ieee80211_set_sar_specs, + .color_change = ieee80211_color_change, +- .set_radar_offchan = ieee80211_set_radar_offchan, ++ .set_radar_background = ieee80211_set_radar_background, + }; +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -716,13 +716,13 @@ static bool + cfg80211_offchan_chain_is_active(struct cfg80211_registered_device *rdev, + struct ieee80211_channel *channel) + { +- if (!rdev->offchan_radar_wdev) ++ if (!rdev->background_radar_wdev) + return false; + +- if (!cfg80211_chandef_valid(&rdev->offchan_radar_chandef)) ++ if (!cfg80211_chandef_valid(&rdev->background_radar_chandef)) + return false; + +- return cfg80211_is_sub_chan(&rdev->offchan_radar_chandef, channel); ++ return cfg80211_is_sub_chan(&rdev->background_radar_chandef, channel); + } + + bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, +--- a/net/wireless/core.c ++++ b/net/wireless/core.c +@@ -552,9 +552,10 @@ use_default_name: + INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); + INIT_WORK(&rdev->conn_work, cfg80211_conn_work); + INIT_WORK(&rdev->event_work, cfg80211_event_work); +- INIT_WORK(&rdev->offchan_cac_abort_wk, cfg80211_offchan_cac_abort_wk); +- INIT_DELAYED_WORK(&rdev->offchan_cac_done_wk, +- cfg80211_offchan_cac_done_wk); ++ INIT_WORK(&rdev->background_cac_abort_wk, ++ cfg80211_background_cac_abort_wk); ++ INIT_DELAYED_WORK(&rdev->background_cac_done_wk, ++ cfg80211_background_cac_done_wk); + + init_waitqueue_head(&rdev->dev_wait); + +@@ -1064,13 +1065,13 @@ void wiphy_unregister(struct wiphy *wiph + cancel_work_sync(&rdev->conn_work); + flush_work(&rdev->event_work); + cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); +- cancel_delayed_work_sync(&rdev->offchan_cac_done_wk); ++ cancel_delayed_work_sync(&rdev->background_cac_done_wk); + flush_work(&rdev->destroy_work); + flush_work(&rdev->sched_scan_stop_wk); + flush_work(&rdev->propagate_radar_detect_wk); + flush_work(&rdev->propagate_cac_done_wk); + flush_work(&rdev->mgmt_registrations_update_wk); +- flush_work(&rdev->offchan_cac_abort_wk); ++ flush_work(&rdev->background_cac_abort_wk); + + #ifdef CONFIG_PM + if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) +@@ -1219,7 +1220,7 @@ void __cfg80211_leave(struct cfg80211_re + + cfg80211_pmsr_wdev_down(wdev); + +- cfg80211_stop_offchan_radar_detection(wdev); ++ cfg80211_stop_background_radar_detection(wdev); + + switch (wdev->iftype) { + case NL80211_IFTYPE_ADHOC: +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -84,10 +84,10 @@ struct cfg80211_registered_device { + + struct delayed_work dfs_update_channels_wk; + +- struct wireless_dev *offchan_radar_wdev; +- struct cfg80211_chan_def offchan_radar_chandef; +- struct delayed_work offchan_cac_done_wk; +- struct work_struct offchan_cac_abort_wk; ++ struct wireless_dev *background_radar_wdev; ++ struct cfg80211_chan_def background_radar_chandef; ++ struct delayed_work background_cac_done_wk; ++ struct work_struct background_cac_abort_wk; + + /* netlink port which started critical protocol (0 means not started) */ + u32 crit_proto_nlportid; +@@ -497,15 +497,15 @@ cfg80211_chandef_dfs_cac_time(struct wip + void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev); + + int +-cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, +- struct wireless_dev *wdev, +- struct cfg80211_chan_def *chandef); ++cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, ++ struct cfg80211_chan_def *chandef); + +-void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev); ++void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev); + +-void cfg80211_offchan_cac_done_wk(struct work_struct *work); ++void cfg80211_background_cac_done_wk(struct work_struct *work); + +-void cfg80211_offchan_cac_abort_wk(struct work_struct *work); ++void cfg80211_background_cac_abort_wk(struct work_struct *work); + + bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, + struct ieee80211_channel *chan); +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -920,7 +920,7 @@ void __cfg80211_radar_event(struct wiphy + cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_UNAVAILABLE); + + if (offchan) +- queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); ++ queue_work(cfg80211_wq, &rdev->background_cac_abort_wk); + + cfg80211_sched_dfs_chan_update(rdev); + +@@ -975,10 +975,10 @@ void cfg80211_cac_event(struct net_devic + EXPORT_SYMBOL(cfg80211_cac_event); + + static void +-__cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, +- struct wireless_dev *wdev, +- const struct cfg80211_chan_def *chandef, +- enum nl80211_radar_event event) ++__cfg80211_background_cac_event(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, ++ const struct cfg80211_chan_def *chandef, ++ enum nl80211_radar_event event) + { + struct wiphy *wiphy = &rdev->wiphy; + struct net_device *netdev; +@@ -988,7 +988,7 @@ __cfg80211_offchan_cac_event(struct cfg8 + if (!cfg80211_chandef_valid(chandef)) + return; + +- if (!rdev->offchan_radar_wdev) ++ if (!rdev->background_radar_wdev) + return; + + switch (event) { +@@ -997,12 +997,12 @@ __cfg80211_offchan_cac_event(struct cfg8 + memcpy(&rdev->cac_done_chandef, chandef, sizeof(*chandef)); + queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk); + cfg80211_sched_dfs_chan_update(rdev); +- wdev = rdev->offchan_radar_wdev; ++ wdev = rdev->background_radar_wdev; + break; + case NL80211_RADAR_CAC_ABORTED: +- if (!cancel_delayed_work(&rdev->offchan_cac_done_wk)) ++ if (!cancel_delayed_work(&rdev->background_cac_done_wk)) + return; +- wdev = rdev->offchan_radar_wdev; ++ wdev = rdev->background_radar_wdev; + break; + case NL80211_RADAR_CAC_STARTED: + break; +@@ -1015,49 +1015,49 @@ __cfg80211_offchan_cac_event(struct cfg8 + } + + static void +-cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, +- const struct cfg80211_chan_def *chandef, +- enum nl80211_radar_event event) ++cfg80211_background_cac_event(struct cfg80211_registered_device *rdev, ++ const struct cfg80211_chan_def *chandef, ++ enum nl80211_radar_event event) + { + wiphy_lock(&rdev->wiphy); +- __cfg80211_offchan_cac_event(rdev, rdev->offchan_radar_wdev, +- chandef, event); ++ __cfg80211_background_cac_event(rdev, rdev->background_radar_wdev, ++ chandef, event); + wiphy_unlock(&rdev->wiphy); + } + +-void cfg80211_offchan_cac_done_wk(struct work_struct *work) ++void cfg80211_background_cac_done_wk(struct work_struct *work) + { + struct delayed_work *delayed_work = to_delayed_work(work); + struct cfg80211_registered_device *rdev; + + rdev = container_of(delayed_work, struct cfg80211_registered_device, +- offchan_cac_done_wk); +- cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, +- NL80211_RADAR_CAC_FINISHED); ++ background_cac_done_wk); ++ cfg80211_background_cac_event(rdev, &rdev->background_radar_chandef, ++ NL80211_RADAR_CAC_FINISHED); + } + +-void cfg80211_offchan_cac_abort_wk(struct work_struct *work) ++void cfg80211_background_cac_abort_wk(struct work_struct *work) + { + struct cfg80211_registered_device *rdev; + + rdev = container_of(work, struct cfg80211_registered_device, +- offchan_cac_abort_wk); +- cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, +- NL80211_RADAR_CAC_ABORTED); ++ background_cac_abort_wk); ++ cfg80211_background_cac_event(rdev, &rdev->background_radar_chandef, ++ NL80211_RADAR_CAC_ABORTED); + } + +-void cfg80211_offchan_cac_abort(struct wiphy *wiphy) ++void cfg80211_background_cac_abort(struct wiphy *wiphy) + { + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); + +- queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); ++ queue_work(cfg80211_wq, &rdev->background_cac_abort_wk); + } +-EXPORT_SYMBOL(cfg80211_offchan_cac_abort); ++EXPORT_SYMBOL(cfg80211_background_cac_abort); + + int +-cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, +- struct wireless_dev *wdev, +- struct cfg80211_chan_def *chandef) ++cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, ++ struct cfg80211_chan_def *chandef) + { + unsigned int cac_time_ms; + int err; +@@ -1065,19 +1065,19 @@ cfg80211_start_offchan_radar_detection(s + lockdep_assert_wiphy(&rdev->wiphy); + + if (!wiphy_ext_feature_isset(&rdev->wiphy, +- NL80211_EXT_FEATURE_RADAR_OFFCHAN)) ++ NL80211_EXT_FEATURE_RADAR_BACKGROUND)) + return -EOPNOTSUPP; + + /* Offchannel chain already locked by another wdev */ +- if (rdev->offchan_radar_wdev && rdev->offchan_radar_wdev != wdev) ++ if (rdev->background_radar_wdev && rdev->background_radar_wdev != wdev) + return -EBUSY; + + /* CAC already in progress on the offchannel chain */ +- if (rdev->offchan_radar_wdev == wdev && +- delayed_work_pending(&rdev->offchan_cac_done_wk)) ++ if (rdev->background_radar_wdev == wdev && ++ delayed_work_pending(&rdev->background_cac_done_wk)) + return -EBUSY; + +- err = rdev_set_radar_offchan(rdev, chandef); ++ err = rdev_set_radar_background(rdev, chandef); + if (err) + return err; + +@@ -1085,30 +1085,31 @@ cfg80211_start_offchan_radar_detection(s + if (!cac_time_ms) + cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; + +- rdev->offchan_radar_chandef = *chandef; +- rdev->offchan_radar_wdev = wdev; /* Get offchain ownership */ ++ rdev->background_radar_chandef = *chandef; ++ rdev->background_radar_wdev = wdev; /* Get offchain ownership */ + +- __cfg80211_offchan_cac_event(rdev, wdev, chandef, +- NL80211_RADAR_CAC_STARTED); +- queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_done_wk, ++ __cfg80211_background_cac_event(rdev, wdev, chandef, ++ NL80211_RADAR_CAC_STARTED); ++ queue_delayed_work(cfg80211_wq, &rdev->background_cac_done_wk, + msecs_to_jiffies(cac_time_ms)); + + return 0; + } + +-void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev) ++void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev) + { + struct wiphy *wiphy = wdev->wiphy; + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); + + lockdep_assert_wiphy(wiphy); + +- if (wdev != rdev->offchan_radar_wdev) ++ if (wdev != rdev->background_radar_wdev) + return; + +- rdev_set_radar_offchan(rdev, NULL); +- rdev->offchan_radar_wdev = NULL; /* Release offchain ownership */ ++ rdev_set_radar_background(rdev, NULL); ++ rdev->background_radar_wdev = NULL; /* Release offchain ownership */ + +- __cfg80211_offchan_cac_event(rdev, wdev, &rdev->offchan_radar_chandef, +- NL80211_RADAR_CAC_ABORTED); ++ __cfg80211_background_cac_event(rdev, wdev, ++ &rdev->background_radar_chandef, ++ NL80211_RADAR_CAC_ABORTED); + } +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -793,7 +793,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_MBSSID_CONFIG] = + NLA_POLICY_NESTED(nl80211_mbssid_config_policy), + [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, +- [NL80211_ATTR_RADAR_OFFCHAN] = { .type = NLA_FLAG }, ++ [NL80211_ATTR_RADAR_BACKGROUND] = { .type = NLA_FLAG }, + }; + + /* policy for the key attributes */ +@@ -9288,9 +9288,9 @@ static int nl80211_start_radar_detection + goto unlock; + } + +- if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) { +- err = cfg80211_start_offchan_radar_detection(rdev, wdev, +- &chandef); ++ if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_BACKGROUND])) { ++ err = cfg80211_start_background_radar_detection(rdev, wdev, ++ &chandef); + goto unlock; + } + +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -1382,17 +1382,17 @@ static inline int rdev_color_change(stru + } + + static inline int +-rdev_set_radar_offchan(struct cfg80211_registered_device *rdev, +- struct cfg80211_chan_def *chandef) ++rdev_set_radar_background(struct cfg80211_registered_device *rdev, ++ struct cfg80211_chan_def *chandef) + { + struct wiphy *wiphy = &rdev->wiphy; + int ret; + +- if (!rdev->ops->set_radar_offchan) ++ if (!rdev->ops->set_radar_background) + return -EOPNOTSUPP; + +- trace_rdev_set_radar_offchan(wiphy, chandef); +- ret = rdev->ops->set_radar_offchan(wiphy, chandef); ++ trace_rdev_set_radar_background(wiphy, chandef); ++ ret = rdev->ops->set_radar_background(wiphy, chandef); + trace_rdev_return_int(wiphy, ret); + + return ret; +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -3646,7 +3646,7 @@ TRACE_EVENT(cfg80211_bss_color_notify, + __entry->color_bitmap) + ); + +-TRACE_EVENT(rdev_set_radar_offchan, ++TRACE_EVENT(rdev_set_radar_background, + TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), + + TP_ARGS(wiphy, chandef), diff --git a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch index 3df4062ec5..d12c8ada31 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -5,7 +5,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -630,21 +630,6 @@ static int wiphy_verify_combinations(str +@@ -634,21 +634,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 3140eee5d0..2dbbb2cc96 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -8,7 +8,7 @@ * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state -@@ -4193,6 +4194,7 @@ struct cfg80211_ops { +@@ -4202,6 +4203,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -36,9 +36,9 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -2608,6 +2608,9 @@ enum nl80211_commands { - * Mandatory parameter for the transmitting interface to enable MBSSID. - * Optional for the non-transmitting interfaces. +@@ -2615,6 +2615,9 @@ enum nl80211_commands { + * switching on a different channel during CAC detection on the selected + * radar channel. * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. @@ -46,9 +46,9 @@ * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3114,6 +3117,8 @@ enum nl80211_attrs { - NL80211_ATTR_MBSSID_CONFIG, - NL80211_ATTR_MBSSID_ELEMS, +@@ -3123,6 +3126,8 @@ enum nl80211_attrs { + + NL80211_ATTR_RADAR_BACKGROUND, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + @@ -77,7 +77,7 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) { struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4399,6 +4412,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4411,6 +4424,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -129,15 +129,15 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -793,6 +793,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_MBSSID_CONFIG] = +@@ -794,6 +794,7 @@ static const struct nla_policy nl80211_p NLA_POLICY_NESTED(nl80211_mbssid_config_policy), [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, + [NL80211_ATTR_RADAR_BACKGROUND] = { .type = NLA_FLAG }, + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -3374,6 +3375,22 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3375,6 +3376,22 @@ static int nl80211_set_wiphy(struct sk_b goto out; } From e045e40671ab6f689b79a2b51ec9eb9461423d46 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 22 Dec 2021 21:04:17 +0100 Subject: [PATCH 089/144] mt76: update to the latest version 833b9d7fcf7f mt76: allow drivers to drop rx packets early f703084f31cb mt76: mt7915: process txfree and txstatus without allocating skbs 047b9a9e78b3 mt76: mt7615: in debugfs queue stats, skip wmm index 3 on mt7663 fea36e02075c mt76: only kick tx queue if frames were queued 8381e54ebfb5 linux-firmware: update firmware for MT7921 WiFi device d57dadb8c861 Revert "mt76: only kick tx queue if frames were queued" 3a21d6e2153b mt76: mt7663: disable 4addr capability f1d66cf7a6c5 mt76: connac: fix possible NULL pointer dereference in mt76_connac_get_phy_mode_v2 c9a4146404d4 sync with upstream 4ed8c910b94e mt76: mt7921: fix possible resume failure bf105aa6cd2f mt76: mt7921: fix network buffer leak by txs missing e2b454b6fb30 mt76: connac: introduce MCU_EXT macros 5a87f5497c9b mt76: connac: align MCU_EXT definitions with 7915 driver 720ddc32507d mt76: connac: remove MCU_FW_PREFIX bit da5128a59eda mt76: connac: introduce MCU_UNI_CMD macro 116109bee7cb mt76: connac: introduce MCU_CE_CMD macro f96fbdf038d5 mt76: connac: rely on MCU_CMD macro 922f0d408413 mt76: mt7915: rely on mt76_connac definitions b4ae1da1d1e0 mt76: mt7921: reduce log severity levels for informative messages db105a722b87 mt76: mt7921s: make pm->suspended usage consistent e2cc063238c0 mt76: mt7921s: fix suspend error with enlarging mcu timeout value 812b73f2f1e0 mt76: mt7915: introduce mt76_vif in mt7915_vif b041a8a30055 mt76: mt7915: add mu-mimo and ofdma debugfs knobs b851a3e7839d mt76: mt7921: remove dead definitions 266c7a9f2994 mt76: connac: rely on le16_add_cpu in mt76_connac_mcu_add_nested_tlv 19cc7d83190c mt76: mt7921: clear pm->suspended in mt7921_mac_reset_work 928c4550e413 mt76: mt7921s: make pm->suspended usage consistent [update] 8d6c68a7d0d1 mt76: mt7921: fix possible resume failure [update] 26fb105e538c mt76: mt7921s: fix cmd timeout in throughput test 9db482264389 mt76: mt7921: fix build regression 3edb87cdf138 mt7915: formatting change to sync with upstream 5cad38ba247d mt76: mt7915: add mt7915_mmio_probe() as a common probing function 15f9f88b362a mt76: mt7915: refine register definition de49cf43ef34 mt76: add MT_RXQ_MAIN_WA for mt7916 6032c35f1306 mt76: mt7915: rework dma.c to adapt mt7916 changes 074d7c5381ed mt76: mt7915: add firmware support for mt7916 27b3253318e7 mt76: mt7915: rework eeprom.c to adapt mt7916 changes 030540246088 mt76: mt7915: enlarge wcid size to 544 400129c69f91 mt76: mt7915: add txfree event v3 cbbb3f65fcd0 mt76: mt7915: update rx rate reporting for mt7916 eb51c4deef0e mt76: mt7915: update mt7915_chan_mib_offs for mt7916 fb4709222028 mt76: mt7915: add mt7916 calibrated data support e758feeaf1d6 mt76: mt7915: add device id for mt7916 115ea27a5cab mt76: connac: fix sta_rec_wtbl tag len b3f922266685 mt76: mt7915: rely on mt76_connac_mcu_alloc_sta_req bac5eda1f5b2 mt76: mt7915: rely on mt76_connac_mcu_alloc_wtbl_req b44485d5c8ac mt76: mt7915: rely on mt76_connac_mcu_add_tlv routine 9cc58e254d53 mt76: connac: move mt76_connac_mcu_get_cipher in common code 60dcd9f09ff6 mt76: connac: move mt76_connac_chan_bw in common code a8d0b7d0cc60 mt76: mt7915: rely on mt76_connac_get_phy utilities 4441db30c1c1 mt76: connac: move mt76_connac_mcu_add_key in connac module 794b6f18d0fb mt76: mt7915: fix code defect 9d2a01b6cb60 mt76: set wlan_idx_hi on mt7916 2c89977b32c2 mt76: mt7915: fix kernel build warning 6c4874839830 mt76: make mt76_sar_capa static 215fdcc7ca6c mt76: mt7915: use proper aid value in mt7915_mcu_wtbl_generic_tlv in sta mode bc254718b40e mt76: mt7915: use proper aid value in mt7915_mcu_sta_basic_tlv 22fcff5ff21a mt76: sdio: lock sdio when it is needed 4669882aa595 mt76: mt7921s: clear MT76_STATE_MCU_RUNNING immediately after reset 944545855e0f mt76: mt7921s: update mt7921s_wfsys_reset sequence 854c8d076a34 mt76: mt7915: move pci specific code back to pci.c a77da27796f2 mt76: mt7915: fix warning: variable 'base' is used uninitialized 7b5e69961c71 mt76: mt7915: fix warning: variable 'flags' set but not used b5138e7b89f9 mt76: mt7921: fix a possible race enabling/disabling runtime-pm af218fbe2500 linux-firmware: update firmware for MT7921 WiFi device 31c19c467950 mt76: mt7915: remove duplicated defs in mcu.h 9198eca1b16f mt76: connac: move mt76_connac_mcu_bss_omac_tlv in connac module 829d87a93a51 mt76: connac: move mt76_connac_mcu_bss_ext_tlv in connac module 50956cf17901 mt76: connac: move mt76_connac_mcu_bss_basic_tlv in connac module bda40f4e1d5e mt76: mt7915: rely on mt76_connac_mcu_sta_ba_tlv 4728939c1d48 mt76: mt7915: rely on mt76_connac_mcu_wtbl_ba_tlv e3ae1828068b mt76: mt7915: rely on mt76_connac_mcu_sta_ba d9e9989eca07 mt76: mt7915: rely on mt76_connac_mcu_wtbl_generic_tlv 168713595fff mt76: mt7915: rely on mt76_connac_mcu_sta_basic_tlv 60394d3e3504 mt76: mt7915: rely on mt76_connac_mcu_sta_uapsd 3a79454d078d mt76: mt7915: rely on mt76_connac_mcu_wtbl_smps_tlv 9ae9aa6c1aea mt76: mt7915: rely on mt76_connac_mcu_wtbl_ht_tlv fd8cdfab91e4 mt76: mt7915: rely on mt76_connac_mcu_wtbl_hdr_trans_tlv a92024c5a5b5 mt76: connac: move mt76_connac_mcu_wtbl_update_hdr_trans in connac module 6dc585a3a274 mt76: connac: introduce is_connac_v1 utility routine 0f29d2aa5a72 mt76: connac: move mt76_connac_mcu_set_pm in connac module dcf408ff8a5e mt76: mt7921: get rid of mt7921_mcu_get_eeprom 77b2a8601fc1 mt76: mt7915: rely on mt76_connac_mcu_start_firmware 65f78dee243a mt76: connac: move mt76_connac_mcu_restart in common module 5adf5b14040b mt76: mt7915: rely on mt76_connac_mcu_patch_sem_ctrl/mt76_connac_mcu_start_patch 69bf1dabe78f mt76: mt7915: rely on mt76_connac_mcu_init_download 951b1ddd370e mt76: connac: move mt76_connac_mcu_gen_dl_mode in mt76-connac module 0826b3992238 mt76: mt7915: rely on mt76_connac_mcu_set_rts_thresh 058de6d36fa9 mt76: connac: move mt76_connac_mcu_rdd_cmd in mt76-connac module aafda86aed2b mt76: mt7921e: make dev->fw_assert usage consistent def12bef91a3 mt76: mt7921: forbid the doze mode when coredump is in progress 009414d27d37 mt76: mt76_connac: fix MCU_CE_CMD_SET_ROC definition error 3c5856eca223 mt76: mt7921: set EDCA parameters with the MCU CE command 01a3d73b452e mt76: mt7615: fix a possible race enabling/disabling runtime-pm 123ed864d1ae mt76: mt7921e: process txfree and txstatus without allocating skbs 018f98abba68 mt76: connac: add support for passing the cipher field in bss_info 288e7443e35c mt76: mt7615: update bss_info with cipher after setting the group key 36e1577cb3d3 mt76: mt7915: update bss_info with cipher after setting the group key d42590d8fcc8 mt76: make cipher in struct mt76_vif u8 instead of enum 11602b8505c6 mt76: mt7615e: process txfree and txstatus without allocating skbs 2ef775c10bd3 linux-firmware: add firmware for MT7916 976ea3879730 mt76: mt7915: add support for passing chip/firmware debug data to user space d11bd7bd83f4 tools: add support for sending firmware debug data via udp dc8e2e8dcd34 mt76: mt7921: do not always disable fw runtime-pm 7063127f852b mt76: mt7921: fix a leftover race in runtime-pm f78f4334b0b2 mt76: mt7615: fix a leftover race in runtime-pm f1f94d19c160 mt76: mt7915: fix ht mcs in mt7915_mac_add_txs_skb() c2ff2f0d6d19 mt76: mt7921: fix ht mcs in mt7921_mac_add_txs_skb() 3e7954a0b32e mt76: mt7921s: fix mt7921s_mcu_[fw|drv]_pmctrl 3c2cc9034376 mt76: mt7921e: fix possible probe failure after reboot f7f6c6dcc6eb mt76: mt7921: fix crash when startup fails. 8656198c925b mt76: sdio: disable interrupt in mt76s_sdio_irq 6204d61ab821 mt76: mt7921: fix endianness issues in mt7921_mcu_set_tx() 68c5aa56f5f2 mt76: mt7921: toggle runtime-pm adding a monitor vif 541e4e8d3c3e mt76: mt7915: set bssinfo/starec command when adding interface 78770f741af9 mt76: mt7915: introduce mt7915_set_radar_background routine 93c03778f92e mt76: mt7915: enable radar trigger on rdd2 4c76a6c3a1f2 mt76: mt7915: introduce rdd_monitor debugfs node 5b94045f927e mt76: mt7915: report radar pattern if detected by rdd2 22094b27ff6a mt76: mt7915: enable radar background detection 4282ca57a143 mt76: connac: move mt76_connac_lmac_mapping in mt76-connac module 0f16c67657a2 mt76: mt7915: add missing DATA4_TB_SPTL_REUSE1 to mt7915_mac_decode_he_radiotap 9a16d33311a7 mt76: mt7921: remove duplicated code in mt7921_mac_decode_he_radiotap 639b55fdc95e mt76: mt7615: add support for LG LGSBWAC02 (MT7663BUN) ebbd2717a16e mt76: mt7663s: flush runtime-pm queue after waking up the device 37c3bf2256de mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update 96959bd15eef mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update 4e42e55ce636 mt76: stop the radar detector after leaving dfs channel 8b32439d5a86 mt76: mt7915: fix possible memory leak in mt7915_mcu_add_sta b4e6f0d6f15a mt76: mt7921s: fix a possible memory leak in mt7921_load_patch 15398f1e8385 mt76: mt7915: fix mcs_map in mt7915_mcu_set_sta_he_mcs() 607eda6eb032 mt76: mt7915: update max_mpdu_size in mt7915_mcu_sta_amsdu_tlv() 69d20f2e6cb0 mt76: mt7915: fix the nss setting in bitrates c3ffa536249a mt76: sdio: honor the largest Tx buffer the hardware can support e3e3562f8fa0 mt76: mt7921s: run sleep mode by default 553200cf63fd firmware: update mt7662 firmware to version 2.3 20d1fed838b9 mt76x02: improve mac error check/reset reliability 9b2ac62d6f31 mt76: mt76x02: improve tx hang detection fae295af31eb mt76: mt7915: fix/rewrite the dfs state handling logic e0f9479bf893 mt76: mt7615: fix/rewrite the dfs state handling logic 822e1135e7e1 mt76: mt76x02: use mt76_phy_dfs_state to determine radar detector state f8c0ed1e6bdf mt76: do not always copy ethhdr in reverse_frag0_hdr_trans ab9b8078427a mt76: dma: initialize skip_unmap in mt76_dma_rx_fill Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 9af329b486..67ed37ee93 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-12-03 -PKG_SOURCE_VERSION:=678071ef70297b7264661c356ddb3c8cf7f3c87b -PKG_MIRROR_HASH:=b1f8613f7c65ca6a893f83ed9efc3f7ce72b9b4904fd11b89264f57f4f2a3b5e +PKG_SOURCE_DATE:=2022-02-03 +PKG_SOURCE_VERSION:=ab9b8078427a9a886b11516d5725190f0e7763b0 +PKG_MIRROR_HASH:=60562cf2ac2e97e654a8202bd6af2c928ca96b129edb168af29f227b6ffbc873 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 @@ -221,7 +221,7 @@ endef define KernelPackage/mt7915e $(KernelPackage/mt76-default) TITLE:=MediaTek MT7915e wireless driver - DEPENDS+=@PCI_SUPPORT +kmod-mt7615-common +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT + DEPENDS+=@PCI_SUPPORT +kmod-mt7615-common +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY FILES:= $(PKG_BUILD_DIR)/mt7915/mt7915e.ko AUTOLOAD:=$(call AutoProbe,mt7915e) endef From 782d4c8306c89fc8b7e98601acc5b6da0bd596bb Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 26 Jan 2022 11:37:13 +0100 Subject: [PATCH 090/144] uboot-mvebu: update to version 2022.01 Signed-off-by: Josef Schlehofer Tested-by: Andre Heider # ESPRESSObin --- package/boot/uboot-mvebu/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index 227894cc15..3550ab0611 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2021.10 +PKG_VERSION:=2022.01 PKG_RELEASE:=$(AUTORELEASE) -PKG_HASH:=cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4 +PKG_HASH:=81b4543227db228c03f8a1bf5ddbc813b0bb8f6555ce46064ef721a6fc680413 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk From 5c804bc199e43e7d41af3242cba950f88bb29807 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Fri, 28 Jan 2022 13:37:08 +0100 Subject: [PATCH 091/144] uboot-mvebu: Add U-boot for Turris Omnia * Add U-boot support for Turris Omnia Signed-off-by: Josef Schlehofer --- package/boot/uboot-mvebu/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index 3550ab0611..566f45ffed 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -36,6 +36,14 @@ define U-Boot/helios4 UBOOT_IMAGE:=u-boot-spl.kwb endef +define U-Boot/omnia + NAME:=Turris Omnia + BUILD_DEVICES:=cznic_turris-omnia + BUILD_SUBTARGET:=cortexa9 + UBOOT_CONFIG:=turris_omnia + UBOOT_IMAGE:=u-boot-spl.kwb +endef + define U-Boot/espressobin NAME:=Marvell ESPRESSObin BUILD_SUBTARGET:=cortexa53 @@ -50,6 +58,7 @@ endef UBOOT_TARGETS:= \ clearfog \ helios4 \ + omnia \ espressobin \ uDPU From d16bd89c71da6bad5f4d37008217ced3bac4e5d6 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Fri, 28 Jan 2022 13:39:45 +0100 Subject: [PATCH 092/144] uboot-mvebu: backport two patches for Marvell A38x This solves issue with DDR training on Turris Omnia. Log: ******** DRAM initialization Failed (res 0x1) ******** DDR3 Training Sequence - FAILED ERROR ### Please RESET the board ### Signed-off-by: Josef Schlehofer --- ...0-ddr-marvell-a38x-fix-split-out-mix.patch | 116 ++++++++++++++++++ ...8x-fix-synchronous-asynchronous-mode.patch | 98 +++++++++++++++ 2 files changed, 214 insertions(+) create mode 100644 package/boot/uboot-mvebu/patches/010-ddr-marvell-a38x-fix-split-out-mix.patch create mode 100644 package/boot/uboot-mvebu/patches/011-ddr-marvell-a38x-fix-synchronous-asynchronous-mode.patch diff --git a/package/boot/uboot-mvebu/patches/010-ddr-marvell-a38x-fix-split-out-mix.patch b/package/boot/uboot-mvebu/patches/010-ddr-marvell-a38x-fix-split-out-mix.patch new file mode 100644 index 0000000000..17ff86223c --- /dev/null +++ b/package/boot/uboot-mvebu/patches/010-ddr-marvell-a38x-fix-split-out-mix.patch @@ -0,0 +1,116 @@ +From 3fc92a215b69ad448c151489228eb340df9a8703 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Wed, 12 Jan 2022 17:06:59 +0100 +Subject: [PATCH] ddr: marvell: a38x: fix SPLIT_OUT_MIX state decision +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a cleaned up and fixed version of a patch + mv_ddr: a380: fix SPLIT_OUT_MIX state decision + + in each pattern cycle the bus state can be changed + in order to avoide it, need to back to the same bus state on each + pattern cycle +by + Moti Boskula + +The original patch is not in Marvell's mv-ddr-marvell repository. It was +gives to us by Marvell to fix an issues with DDR training on some +boards, but it cannot be applied as is to mv-ddr-marvell, because it is +a very dirty draft patch that would certainly break other things, mainly +DDR4 training code in mv-ddr-marvell, since it changes common functions. + +I have cleaned up the patch and removed stuff that seemed unnecessary +(when removed, it still fixed things). Note that I don't understand +completely what the code does exactly, since I haven't studied the DDR +training code extensively (and I suspect that no one besides some few +people in Marvell understand the code completely). + +Anyway after the cleanup the patch still fixes isssues with DDR training +on the failing boards. + +There was also a problem with the original patch on some of the Allied +Telesis' x530 boards, reported by Chris Packham. I have asked Chris to +send me some logs, and managed to fix it: +- if you look at the change, you'll notice that it introduces + subtraction of cur_start_win[] and cur_end_win[] members, depending on + a bit set in the current_byte_status variable +- the original patch subtracted cur_start_win[] if either + BYTE_SPLIT_OUT_MIX or BYTE_HOMOGENEOUS_SPLIT_OUT bits were set, but + subtracted cur_end_win[] only if the first one (BYTE_SPLIT_OUT_MIX) + was set +- from Chris Packham logs I discovered that the x530 board where the + original patch introduced DDR training failure, only the + BYTE_HOMOGENEOUS_SPLIT_OUT bit was set, and on our boards where the + patch is needed only the BYTE_SPLIT_OUT_MIX is set in the + current_byte_status variable +- this led me to the hypothesis that both cur_start_win[] and + cur_end_win[] should be subtracted only if BYTE_SPLIT_OUT_MIX bit is + set, the BYTE_HOMOGENEOUS_SPLIT_OUT bit shouldn't be considered at all +- this hypothesis also gains credibility when considering the commit + title ("fix SPLIT_OUT_MIX state decision") + +Hopefully this will fix things without breaking anything else. + +Signed-off-by: Marek Behún +Reviewed-by: Stefan Roese +Tested-by: Chris Packham +--- + .../a38x/ddr3_training_centralization.c | 26 +++++++++++++++++++ + 1 file changed, 26 insertions(+) + +--- a/drivers/ddr/marvell/a38x/ddr3_training_centralization.c ++++ b/drivers/ddr/marvell/a38x/ddr3_training_centralization.c +@@ -55,6 +55,7 @@ static int ddr3_tip_centralization(u32 d + enum hws_training_ip_stat training_result[MAX_INTERFACE_NUM]; + u32 if_id, pattern_id, bit_id; + u8 bus_id; ++ u8 current_byte_status; + u8 cur_start_win[BUS_WIDTH_IN_BITS]; + u8 centralization_result[MAX_INTERFACE_NUM][BUS_WIDTH_IN_BITS]; + u8 cur_end_win[BUS_WIDTH_IN_BITS]; +@@ -166,6 +167,10 @@ static int ddr3_tip_centralization(u32 d + result[search_dir_id][7])); + } + ++ current_byte_status = ++ mv_ddr_tip_sub_phy_byte_status_get(if_id, ++ bus_id); ++ + for (bit_id = 0; bit_id < BUS_WIDTH_IN_BITS; + bit_id++) { + /* check if this code is valid for 2 edge, probably not :( */ +@@ -174,11 +179,32 @@ static int ddr3_tip_centralization(u32 d + [HWS_LOW2HIGH] + [bit_id], + EDGE_1); ++ if (current_byte_status & ++ BYTE_SPLIT_OUT_MIX) { ++ if (cur_start_win[bit_id] >= 64) ++ cur_start_win[bit_id] -= 64; ++ else ++ cur_start_win[bit_id] = 0; ++ DEBUG_CENTRALIZATION_ENGINE ++ (DEBUG_LEVEL_INFO, ++ ("pattern %d IF %d pup %d bit %d subtract 64 adll from start\n", ++ pattern_id, if_id, bus_id, bit_id)); ++ } + cur_end_win[bit_id] = + GET_TAP_RESULT(result + [HWS_HIGH2LOW] + [bit_id], + EDGE_1); ++ if (cur_end_win[bit_id] >= 64 && ++ (current_byte_status & ++ BYTE_SPLIT_OUT_MIX)) { ++ cur_end_win[bit_id] -= 64; ++ DEBUG_CENTRALIZATION_ENGINE ++ (DEBUG_LEVEL_INFO, ++ ("pattern %d IF %d pup %d bit %d subtract 64 adll from end\n", ++ pattern_id, if_id, bus_id, bit_id)); ++ } ++ + /* window length */ + current_window[bit_id] = + cur_end_win[bit_id] - diff --git a/package/boot/uboot-mvebu/patches/011-ddr-marvell-a38x-fix-synchronous-asynchronous-mode.patch b/package/boot/uboot-mvebu/patches/011-ddr-marvell-a38x-fix-synchronous-asynchronous-mode.patch new file mode 100644 index 0000000000..9da1459a7d --- /dev/null +++ b/package/boot/uboot-mvebu/patches/011-ddr-marvell-a38x-fix-synchronous-asynchronous-mode.patch @@ -0,0 +1,98 @@ +From eadc4f512fb43bba2fa4e842c982da919da664be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Tue, 4 Jan 2022 15:57:49 +0100 +Subject: [PATCH] ddr: marvell: a38x: Fix Synchronous vs Asynchronous mode + determination +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Before commit 4c289425752f ("mv_ddr: a38x: add support for ddr async +mode"), Asynchornous Mode was only used when the CPU Subsystem Clock +Options[4:0] field in the SAR1 register was set to value 0x13: CPU at +2 GHz and DDR at 933 MHz. + +Then commit 4c289425752f ("mv_ddr: a38x: add support for ddr async +mode") added support for Asynchornous Modes with frequencies other than +933 MHz (but at least 467 MHz), but the code it added to check for +whether Asynchornous Mode should be used is wrong: it checks whether the +frequency setting in board DDR topology map is set to value other than +MV_DDR_FREQ_SAR. + +Thus boards which define a specific value, greater than 400 MHz, for DDR +frequency in their board topology (e.g. Turris Omnia defines +MV_DDR_FREQ_800), are incorrectly put into Asynchornous Mode after that +commit. + +The A38x Functional Specification, section 10.12 DRAM Clocking, says: + In Synchornous mode, the DRAM and CPU clocks are edge aligned and run + in 1:2 or 1:3 CPU to DRAM frequency ratios. + +Change the check for whether Asynchornous Mode should be used according +to this explanation in Functional Specification. + +Signed-off-by: Marek Behún +Tested-by: Chris Packham +Reviewed-by: Stefan Roese +--- + drivers/ddr/marvell/a38x/mv_ddr_plat.c | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +--- a/drivers/ddr/marvell/a38x/mv_ddr_plat.c ++++ b/drivers/ddr/marvell/a38x/mv_ddr_plat.c +@@ -167,8 +167,6 @@ static u16 a38x_vco_freq_per_sar_ref_clk + }; + + +-static u32 async_mode_at_tf; +- + static u32 dq_bit_map_2_phy_pin[] = { + 1, 0, 2, 6, 9, 8, 3, 7, /* 0 */ + 8, 9, 1, 7, 2, 6, 3, 0, /* 1 */ +@@ -734,7 +732,8 @@ static int ddr3_tip_a38x_set_divider(u8 + u32 divider = 0; + u32 sar_val, ref_clk_satr; + u32 async_val; +- u32 freq = mv_ddr_freq_get(frequency); ++ u32 cpu_freq; ++ u32 ddr_freq = mv_ddr_freq_get(frequency); + + if (if_id != 0) { + DEBUG_TRAINING_ACCESS(DEBUG_LEVEL_ERROR, +@@ -751,11 +750,14 @@ static int ddr3_tip_a38x_set_divider(u8 + ref_clk_satr = reg_read(DEVICE_SAMPLE_AT_RESET2_REG); + if (((ref_clk_satr >> DEVICE_SAMPLE_AT_RESET2_REG_REFCLK_OFFSET) & 0x1) == + DEVICE_SAMPLE_AT_RESET2_REG_REFCLK_25MHZ) +- divider = a38x_vco_freq_per_sar_ref_clk_25_mhz[sar_val] / freq; ++ cpu_freq = a38x_vco_freq_per_sar_ref_clk_25_mhz[sar_val]; + else +- divider = a38x_vco_freq_per_sar_ref_clk_40_mhz[sar_val] / freq; ++ cpu_freq = a38x_vco_freq_per_sar_ref_clk_40_mhz[sar_val]; ++ ++ divider = cpu_freq / ddr_freq; + +- if ((async_mode_at_tf == 1) && (freq > 400)) { ++ if (((cpu_freq % ddr_freq != 0) || (divider != 2 && divider != 3)) && ++ (ddr_freq > 400)) { + /* Set async mode */ + dunit_write(0x20220, 0x1000, 0x1000); + dunit_write(0xe42f4, 0x200, 0x200); +@@ -869,8 +871,6 @@ int ddr3_tip_ext_write(u32 dev_num, u32 + + int mv_ddr_early_init(void) + { +- struct mv_ddr_topology_map *tm = mv_ddr_topology_map_get(); +- + /* FIXME: change this configuration per ddr type + * configure a380 and a390 to work with receiver odt timing + * the odt_config is defined: +@@ -882,9 +882,6 @@ int mv_ddr_early_init(void) + + mv_ddr_sw_db_init(0, 0); + +- if (tm->interface_params[0].memory_freq != MV_DDR_FREQ_SAR) +- async_mode_at_tf = 1; +- + return MV_OK; + } + From 7c3efd5273fde3ec53d7f80670963e16512c6f17 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 31 Jan 2022 14:39:52 +0100 Subject: [PATCH 093/144] ramips: Switch Teltonika RUT5xx to kernel GPIO-line watchdog driver The commit 04e91631e050 ("om-watchdog: add support for Teltonika RUT5xx (ramips)") used the deprecated om-watchdog daemon to handle the GPIO-line connected watchdog on the Teltonika RUT5xx. But this daemon has massive problems since commit 30f61a34b4cf ("base-files: always use staged sysupgrade"). The process will always be stopped on sysupgrades. If the sysupgrade takes slightly longer, the watchdog is not triggered at the correct time and thus the sysupgrade will interrupted hard by the watchdog sysupgrade. And this hard interrupt can easily brick the device when there is no fallback (dual-boot, ...). Signed-off-by: Sven Eckelmann --- target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts | 9 +++++++++ target/linux/ramips/image/rt305x.mk | 1 - target/linux/ramips/rt305x/config-5.10 | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts b/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts index cfdb4d6b4b..6be2590a0c 100644 --- a/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts +++ b/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts @@ -33,6 +33,15 @@ linux,code = ; }; }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + /* hw_margin_ms is actually 280s but driver limits it to 60s */ + hw_margin_ms = <60000>; + always-running; + }; }; &spi0 { diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index e817c12e76..d8ea1d5673 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -990,7 +990,6 @@ define Device/teltonika_rut5xx IMAGE_SIZE := 16064k DEVICE_VENDOR := Teltonika DEVICE_MODEL := RUT5XX - DEVICE_PACKAGES := om-watchdog SUPPORTED_DEVICES += rut5xx endef TARGET_DEVICES += teltonika_rut5xx diff --git a/target/linux/ramips/rt305x/config-5.10 b/target/linux/ramips/rt305x/config-5.10 index b62c441988..31dbec907e 100644 --- a/target/linux/ramips/rt305x/config-5.10 +++ b/target/linux/ramips/rt305x/config-5.10 @@ -60,6 +60,8 @@ CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GPIOLIB=y CONFIG_GPIO_RALINK=y +CONFIG_GPIO_WATCHDOG=y +# CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y From 8a8b7b423428309d66c96d93dc11499e21b665cb Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 31 Jan 2022 14:44:18 +0100 Subject: [PATCH 094/144] om-watchdog: Drop unused package All devices which used this package migrated to the kernel GPIO-line watchdog driver and configure it over their DT. Signed-off-by: Sven Eckelmann --- package/kernel/om-watchdog/Makefile | 36 ------------------- package/kernel/om-watchdog/files/om-watchdog | 15 -------- .../kernel/om-watchdog/files/om-watchdog.init | 36 ------------------- 3 files changed, 87 deletions(-) delete mode 100644 package/kernel/om-watchdog/Makefile delete mode 100644 package/kernel/om-watchdog/files/om-watchdog delete mode 100644 package/kernel/om-watchdog/files/om-watchdog.init diff --git a/package/kernel/om-watchdog/Makefile b/package/kernel/om-watchdog/Makefile deleted file mode 100644 index b0de3de74e..0000000000 --- a/package/kernel/om-watchdog/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (C) 2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=om-watchdog -PKG_RELEASE:=4 - -include $(INCLUDE_DIR)/package.mk - -define Package/om-watchdog - SECTION:=base - CATEGORY:=Base system - TITLE:=om watchdog - URL:=http://openwrt.org/ -endef - -define Package/om-watchdog/description - This package contains the hw watchdog script for the OM1P and OM2P device. -endef - -define Build/Compile -endef - -define Package/om-watchdog/install - $(INSTALL_DIR) $(1)/etc/init.d/ - $(INSTALL_DIR) $(1)/sbin/ - $(INSTALL_BIN) ./files/om-watchdog.init $(1)/etc/init.d/om-watchdog - $(INSTALL_BIN) ./files/om-watchdog $(1)/sbin/om-watchdog -endef - -$(eval $(call BuildPackage,om-watchdog)) diff --git a/package/kernel/om-watchdog/files/om-watchdog b/package/kernel/om-watchdog/files/om-watchdog deleted file mode 100644 index d730c68447..0000000000 --- a/package/kernel/om-watchdog/files/om-watchdog +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -GPIO=$1 - -trap "" INT HUP - -echo $GPIO > /sys/class/gpio/export -echo out > /sys/class/gpio/gpio${GPIO}/direction - -while true; do - echo 1 > /sys/class/gpio/gpio${GPIO}/value - sleep 1 - echo 0 > /sys/class/gpio/gpio${GPIO}/value - sleep 180 -done diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init deleted file mode 100644 index 8cbac043e4..0000000000 --- a/package/kernel/om-watchdog/files/om-watchdog.init +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh /etc/rc.common -# -# Copyright (C) 2011 OpenWrt.org -# - -START=11 -STOP=11 - -USE_PROCD=1 -NAME=om-watchdog -PROG=/sbin/om-watchdog - -get_gpio() { - local board=$(board_name) - - if [ "$board" = "teltonika,rut5xx" ]; then - # ramips - return 11 - else - #we assume it is om1p in this case - return 3 - fi - - return 255 -} - -start_service() { - get_gpio - gpio="$?" - [ "$gpio" != "255" ] || return - - procd_open_instance - procd_set_param command "${PROG}" "${gpio}" - procd_set_param respawn - procd_close_instance -} From fb6cf22866b3bb6dfcbee0659f785982d071c863 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 30 Jan 2022 18:57:59 -0800 Subject: [PATCH 095/144] tools/meson: update to 0.61.1 Changelog: backend_startup_project Add a man page backend to refman extract_objects() supports generated sources Python 3.6 support will be dropped in the next release Warning if check kwarg of run_command is missing meson rewrite can modify extra_files meson rewrite target info outputs target's extra_files Visual Studio 2022 backend Support for CMake <3.14 is now deprecated for CMake subprojects Added support for sccache install_symlink function Signed-off-by: Rosen Penev --- tools/meson/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/meson/Makefile b/tools/meson/Makefile index 10f29c93d8..0d69593d56 100644 --- a/tools/meson/Makefile +++ b/tools/meson/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meson -PKG_VERSION:=0.60.1 +PKG_VERSION:=0.61.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/mesonbuild/meson/releases/download/$(PKG_VERSION) -PKG_HASH:=5add789c953d984b500858b2851ee3d7add0460cf1a6f852f0a721af17384e13 +PKG_HASH:=feb2cefb325b437dbf36146df7c6b87688ddff0b0205caa31dc64055c6da410c PKG_MAINTAINER:=Andre Heider PKG_LICENSE:=Apache-2.0 From 8c1d5129ee8464b3a240d73c48eb2d166537c1a8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 4 Feb 2022 12:48:45 +0100 Subject: [PATCH 096/144] bpf-headers: fix build error from within the SDK The SDK does not ship the generic platform files. Use relative path for GENERIC_PLATFORM_DIR to make it work. This points it at the files from the feed directory instead of the base SDK path Signed-off-by: Felix Fietkau --- package/kernel/bpf-headers/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile index f3c0584007..0f0857133a 100644 --- a/package/kernel/bpf-headers/Makefile +++ b/package/kernel/bpf-headers/Makefile @@ -20,6 +20,7 @@ PKG_SOURCE_URL:=$(LINUX_SITE) PKG_HASH:=$(LINUX_KERNEL_HASH-$(strip $(PKG_VERSION))) PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/bpf-headers/$(PKG_NAME)-$(PKG_VERSION) +GENERIC_PLATFORM_DIR := $(CURDIR)/../../../target/linux/generic GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(PKG_PATCHVER)),-$(PKG_PATCHVER)) GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(PKG_PATCHVER)),-$(PKG_PATCHVER)) GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(PKG_PATCHVER)),-$(PKG_PATCHVER)) From fcd5fd49c5ceba3325de5d7615b87eeeb481f4d2 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Thu, 3 Feb 2022 22:32:18 +0100 Subject: [PATCH 097/144] kernel: usb: remove left-over LINUX_5_10 dependency symbol this should have been removed together with linux 5.4 APM821XX support. Currently, this didn't hurt or broke something. But it will in the next stable kernel release. Signed-off-by: Christian Lamparter --- package/kernel/linux/modules/usb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index f74c02a99f..c12150fc5c 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -1712,7 +1712,7 @@ define KernelPackage/usb3 +TARGET_bcm53xx:kmod-usb-bcma \ +TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 \ +TARGET_ramips_mt7621:kmod-usb-xhci-mtk \ - +(TARGET_apm821xx_nand&&LINUX_5_10):kmod-usb-xhci-pci-renesas \ + +TARGET_apm821xx_nand:kmod-usb-xhci-pci-renesas \ +TARGET_mvebu_cortexa9:kmod-usb-xhci-pci-renesas KCONFIG:= \ CONFIG_USB_PCI=y \ From 1085c4b4a72a5277a611cc4a8ac2e5742da127fc Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 16 Jan 2022 18:46:16 +0100 Subject: [PATCH 098/144] apm821xx: WNDR4700: delete dead dt definitions cooling-{min|max}-level are no longer used. Signed-off-by: Christian Lamparter --- target/linux/apm821xx/dts/netgear-wndr4700.dts | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/linux/apm821xx/dts/netgear-wndr4700.dts b/target/linux/apm821xx/dts/netgear-wndr4700.dts index 2e98a53292..3f93153d4d 100644 --- a/target/linux/apm821xx/dts/netgear-wndr4700.dts +++ b/target/linux/apm821xx/dts/netgear-wndr4700.dts @@ -263,8 +263,6 @@ fan0: fan@1b { compatible = "microchip,tc654"; reg = <0x1b>; - cooling-min-level = <0>; - cooling-max-level = <255>; #cooling-cells = <2>; /* min followed by max */ gpios = <&GPIO0 16 GPIO_ACTIVE_LOW>; /* fan status */ From f095822699cc397f86d2c24616aaaa7f814dc8d9 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 16 Jan 2022 20:13:24 +0100 Subject: [PATCH 099/144] apm821xx: convert legacy nand partition layout in order to get nvmem-cells to work on AP and routers (Netgears WNDR4700). The nvmem-cell needs to be within a fixed-partition dt-node. Signed-off-by: Christian Lamparter --- target/linux/apm821xx/dts/apm82181.dtsi | 3 --- target/linux/apm821xx/dts/meraki-mr24.dts | 24 +++++++++++-------- target/linux/apm821xx/dts/meraki-mx60.dts | 15 ++++++++---- .../linux/apm821xx/dts/netgear-wndap6x0.dtsi | 17 ++++++++----- .../linux/apm821xx/dts/netgear-wndr4700.dts | 15 +++++++----- 5 files changed, 44 insertions(+), 30 deletions(-) diff --git a/target/linux/apm821xx/dts/apm82181.dtsi b/target/linux/apm821xx/dts/apm82181.dtsi index f7c4c65401..5f80467d74 100644 --- a/target/linux/apm821xx/dts/apm82181.dtsi +++ b/target/linux/apm821xx/dts/apm82181.dtsi @@ -251,9 +251,6 @@ nand-ecc-algo = "hamming"; nand-ecc-step-size = <256>; nand-ecc-strength = <1>; - - #address-cells = <1>; - #size-cells = <1>; }; }; }; diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts b/target/linux/apm821xx/dts/meraki-mr24.dts index a876e77511..4b43c683e1 100644 --- a/target/linux/apm821xx/dts/meraki-mr24.dts +++ b/target/linux/apm821xx/dts/meraki-mr24.dts @@ -38,13 +38,17 @@ status = "okay"; }; -&EBC0 { +&ndfc { /* Ikarem has 32MB of NAND */ - ndfc@1,0 { - status = "okay"; - /* 32 MiB NAND Flash */ - nand { - nand-is-boot-medium; + status = "okay"; + + nand { + nand-is-boot-medium; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; partition@0 { label = "u-boot"; @@ -59,10 +63,10 @@ * blocks (64KiB) in order to have spares * around for bad block management */ - label = "u-boot-env"; - reg = <0x00150000 0x00010000>; - read-only; - }; + label = "u-boot-env"; + reg = <0x00150000 0x00010000>; + read-only; + }; partition@160000 { /* diff --git a/target/linux/apm821xx/dts/meraki-mx60.dts b/target/linux/apm821xx/dts/meraki-mx60.dts index 05274e9d42..79e055c2ea 100644 --- a/target/linux/apm821xx/dts/meraki-mx60.dts +++ b/target/linux/apm821xx/dts/meraki-mx60.dts @@ -42,12 +42,17 @@ dr_mode = "host"; }; -&EBC0 { +&ndfc { /* Buckminster has 1GiB of NAND */ - ndfc@1,0 { - status = "okay"; - nand { - nand-is-boot-medium; + status = "okay"; + + nand { + nand-is-boot-medium; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; partition@0 { label = "u-boot"; diff --git a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi index c18c73d956..c6f112d240 100644 --- a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi +++ b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi @@ -28,12 +28,17 @@ status = "okay"; }; -&EBC0 { - ndfc@1,0 { - status = "okay"; - /* 32 MiB SLC NAND Flash */ - nand { - nand-is-boot-medium; +&ndfc { + status = "okay"; + /* 32 MiB SLC NAND Flash */ + + nand { + nand-is-boot-medium; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; partition@0 { label = "u-boot"; diff --git a/target/linux/apm821xx/dts/netgear-wndr4700.dts b/target/linux/apm821xx/dts/netgear-wndr4700.dts index 3f93153d4d..63c96bd82a 100644 --- a/target/linux/apm821xx/dts/netgear-wndr4700.dts +++ b/target/linux/apm821xx/dts/netgear-wndr4700.dts @@ -169,13 +169,16 @@ dr_mode = "host"; }; -&EBC0 { - ndfc: ndfc@1,0 { +&ndfc { + status = "okay"; + /* 128 MiB Nand Flash */ + nand { + nand-is-boot-medium; - status = "okay"; - /* 128 MiB Nand Flash */ - nand { - nand-is-boot-medium; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; partition@0 { label = "uboot"; From a1693a8c2cdc74a5bf33cabaadc2174f2f088dbf Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 16 Jan 2022 18:42:18 +0100 Subject: [PATCH 100/144] apm821xx: WNDR4700: utilize ath9k nvmem-cells the WNDR4700 can fetch its calibration data and mac-addresses directly from the "wifi_data" partition. This allows us to get rid of the 10-ath9k-eeprom file for the apm821xx target completely. Signed-off-by: Christian Lamparter --- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 45 ------------------- .../linux/apm821xx/dts/netgear-wndr4700.dts | 27 +++++++++-- 2 files changed, 23 insertions(+), 49 deletions(-) delete mode 100644 target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom diff --git a/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom deleted file mode 100644 index dcdcf4dc45..0000000000 --- a/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -[ -e /lib/firmware/$FIRMWARE ] && exit 0 - -. /lib/functions/caldata.sh - -board=$(board_name) - -case "$FIRMWARE" in -"ath9k-eeprom-pci-0000:43:00.0.bin") - case $board in - netgear,wndr4700) - . /lib/upgrade/nand.sh - - if [ -n "$(nand_find_volume ubi0 caldata)" ]; then - caldata_extract_ubi "caldata" 0x1000 0x1000 - else - caldata_extract "wifi_data" 0x1000 0x1000 - ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0x0) - fi - ;; - *) - caldata_die "board $board is not supported yet" - ;; - esac - ;; - -"ath9k-eeprom-pci-0000:44:00.0.bin") - case $board in - netgear,wndr4700) - . /lib/upgrade/nand.sh - - if [ -n "$(nand_find_volume ubi0 caldata)" ]; then - caldata_extract_ubi "caldata" 0x5000 0x1000 - else - caldata_extract "wifi_data" 0x5000 0x1000 - ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0xc) - fi - ;; - *) - caldata_die "board $board is not supported yet" - ;; - esac - ;; -esac diff --git a/target/linux/apm821xx/dts/netgear-wndr4700.dts b/target/linux/apm821xx/dts/netgear-wndr4700.dts index 63c96bd82a..12d9dc0bfd 100644 --- a/target/linux/apm821xx/dts/netgear-wndr4700.dts +++ b/target/linux/apm821xx/dts/netgear-wndr4700.dts @@ -247,6 +247,25 @@ label = "wifi_data"; reg = <0x07fc0000 0x00040000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_wifi_0: macaddr@0 { + reg = <0x0 0x6>; + }; + macaddr_wifi_c: macaddr@c { + reg = <0xc 0x6>; + }; + + calibration_wifi_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_wifi_5000: calibration@5000 { + reg = <0x5000 0x440>; + }; }; }; }; @@ -457,8 +476,8 @@ compatible = "pci168c,0030"; reg = <0x00430000 0 0 0 0>; interrupts = <3>; /* INTC */ - qca,no-eeprom; - /* wifi CAL & MAC is stored in nvram */ + nvmem-cell-names = "mac-address", "calibration"; + nvmem-cells = <&macaddr_wifi_0>, <&calibration_wifi_1000>; /* * Because this was such a pain. @@ -480,8 +499,8 @@ compatible = "pci168c,0033"; reg = <0x00440000 0 0 0 0>; interrupts = <4>; /* INTD */ - qca,no-eeprom; - /* wifi CAL & MAC is stored in nvram */ + nvmem-cell-names = "mac-address", "calibration"; + nvmem-cells = <&macaddr_wifi_c>, <&calibration_wifi_5000>; }; }; From 20470580cd271de1e6017c88261b577ed4773476 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Tue, 28 Dec 2021 00:30:13 +0100 Subject: [PATCH 101/144] ipq806x: utilize nvmem-cells for pre-calibration data converts extraction entries from 11-ath10k-caldata into nvmem-cells in the individual board's device-tree file. The patch also moves previously existing referenced nvmem-cells data nodes which were placed at the end back into the partitions node. As well as removing some duplicated properties from qcom-ipq8065-xr500.dts's art (the included nighthawk.dtsi defines those already). Signed-off-by: Christian Lamparter --- .../etc/hotplug.d/firmware/11-ath10k-caldata | 32 ---------- .../arm/boot/dts/qcom-ipq8062-wg2600hp3.dts | 19 ++++-- .../boot/dts/qcom-ipq8064-ad7200-c2600.dtsi | 19 ++++-- .../arch/arm/boot/dts/qcom-ipq8064-d7800.dts | 43 +++++++------ .../arm/boot/dts/qcom-ipq8064-r7500v2.dts | 43 +++++++------ .../arm/boot/dts/qcom-ipq8064-vr2600v.dts | 20 +++++-- .../arm/boot/dts/qcom-ipq8064-wg2600hp.dts | 19 ++++-- .../arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts | 60 ++++++++++--------- .../arm/boot/dts/qcom-ipq8065-nighthawk.dtsi | 33 +++++----- .../arch/arm/boot/dts/qcom-ipq8065-r7800.dts | 8 +-- .../arch/arm/boot/dts/qcom-ipq8065-xr500.dts | 12 ++-- 11 files changed, 169 insertions(+), 139 deletions(-) diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 78315d4516..4a474766d5 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -23,12 +23,6 @@ case "$FIRMWARE" in asrock,g10) caldata_extract "0:art" 0x1000 0x2f20 ;; - buffalo,wxr-2533dhp |\ - nec,wg2600hp |\ - nec,wg2600hp3 |\ - tplink,vr2600v) - caldata_extract "ART" 0x1000 0x2f20 - ;; linksys,ea7500-v1 |\ linksys,ea8500) caldata_extract "art" 0x1000 0x2f20 @@ -38,16 +32,6 @@ case "$FIRMWARE" in CI_UBIPART=art caldata_extract_ubi "ART" 0x1000 0x2f20 ;; - netgear,d7800 |\ - netgear,r7500v2 |\ - netgear,r7800 |\ - netgear,xr500) - caldata_extract "art" 0x1000 0x2f20 - ;; - tplink,ad7200 |\ - tplink,c2600) - caldata_extract "radio" 0x1000 0x2f20 - ;; zyxel,nbg6817) caldata_extract "0:art" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) 1) @@ -62,12 +46,6 @@ case "$FIRMWARE" in asrock,g10) caldata_extract "0:art" 0x5000 0x2f20 ;; - buffalo,wxr-2533dhp |\ - nec,wg2600hp |\ - nec,wg2600hp3 |\ - tplink,vr2600v) - caldata_extract "ART" 0x5000 0x2f20 - ;; edgecore,ecw5410) caldata_extract "0:art" 0x1000 0x2f20 ;; @@ -81,16 +59,6 @@ case "$FIRMWARE" in CI_UBIPART=art caldata_extract_ubi "ART" 0x5000 0x2f20 ;; - netgear,d7800 |\ - netgear,r7500v2 |\ - netgear,r7800 |\ - netgear,xr500) - caldata_extract "art" 0x5000 0x2f20 - ;; - tplink,ad7200 |\ - tplink,c2600) - caldata_extract "radio" 0x5000 0x2f20 - ;; zyxel,nbg6817) caldata_extract "0:art" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_ascii 0:appsblenv ethaddr) diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts index 8f1bb74540..c1c21856ca 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts @@ -317,6 +317,17 @@ label = "ART"; reg = <0x02e0000 0x0040000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_ART_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_ART_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; partition@320000 { @@ -360,8 +371,8 @@ qcom,ath10k-calibration-variant = "NEC-Platforms-WG2600HP3"; - nvmem-cells = <&macaddr_PRODUCTDATA_12>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_PRODUCTDATA_12>, <&precal_ART_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; @@ -383,8 +394,8 @@ ieee80211-freq-limit = <2400000 2483000>; qcom,ath10k-calibration-variant = "NEC-Platforms-WG2600HP3"; - nvmem-cells = <&macaddr_PRODUCTDATA_c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_PRODUCTDATA_c>, <&precal_ART_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi index 5842c34c16..115c6d43d2 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi @@ -151,6 +151,17 @@ label = "radio"; reg = <0x1b0000 0x40000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_radio_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_radio_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; partition@1f0000 { @@ -266,8 +277,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_defaultmac_8>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_defaultmac_8>, <&precal_radio_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(-1)>; }; }; @@ -287,8 +298,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_defaultmac_8>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_defaultmac_8>, <&precal_radio_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts index 16a6ca0076..b8314a6bd0 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts @@ -193,8 +193,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_6>, <&precal_art_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(1)>; }; }; @@ -217,8 +217,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_6>, <&precal_art_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(2)>; }; }; @@ -274,10 +274,29 @@ read-only; }; - art: art@1200000 { + art@1200000 { label = "art"; reg = <0x1200000 0x0140000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; artbak: art@1340000 { @@ -369,17 +388,3 @@ &adm_dma { status = "okay"; }; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_6: macaddr@6 { - reg = <0x6 0x6>; - }; -}; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts index f2bd1705b5..b3181d8857 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts @@ -197,8 +197,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_6>, <&precal_art_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(1)>; }; }; @@ -221,8 +221,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_6>, <&precal_art_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(2)>; }; }; @@ -268,10 +268,29 @@ read-only; }; - art: art@1200000 { + art@1200000 { label = "art"; reg = <0x1200000 0x0140000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; artbak: art@1340000 { @@ -353,17 +372,3 @@ full-duplex; }; }; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_6: macaddr@6 { - reg = <0x6 0x6>; - }; -}; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts index a671202dc9..3aec856823 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts @@ -269,6 +269,18 @@ label = "ART"; reg = <0xfc0000 0x40000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_ART_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_ART_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; }; }; @@ -295,8 +307,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_defaultmac_0>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_defaultmac_0>, <&precal_ART_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(-1)>; }; }; @@ -316,8 +328,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_defaultmac_0>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_defaultmac_0>, <&precal_ART_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts index 45da4a2b11..998dad55c5 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts @@ -283,6 +283,17 @@ label = "ART"; reg = <0x2e0000 0x40000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_ART_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_ART_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; TP@320000 { @@ -331,8 +342,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_PRODUCTDATA_12>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_PRODUCTDATA_12>, <&precal_ART_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; @@ -351,8 +362,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_PRODUCTDATA_c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_PRODUCTDATA_c>, <&precal_ART_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts index 4b4e8736d4..e7ae1a25b2 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts @@ -340,10 +340,38 @@ read-only; }; - ART: ART@180000 { + ART@180000 { label = "ART"; reg = <0x180000 0x40000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_ART_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_ART_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + macaddr_ART_18: macaddr@18 { + reg = <0x18 0x6>; + }; + + macaddr_ART_1e: macaddr@1e { + reg = <0x1e 0x6>; + }; + + precal_ART_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_ART_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; BOOTCONFIG@1c0000 { @@ -406,8 +434,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_ART_1e>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_ART_1e>, <&precal_ART_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; @@ -426,8 +454,8 @@ compatible = "pci168c,0040"; reg = <0x00010000 0 0 0 0>; - nvmem-cells = <&macaddr_ART_18>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_ART_18>, <&precal_ART_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; }; }; @@ -496,25 +524,3 @@ }; }; }; - -&ART { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_ART_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_ART_6: macaddr@6 { - reg = <0x6 0x6>; - }; - - macaddr_ART_18: macaddr@18 { - reg = <0x18 0x6>; - }; - - macaddr_ART_1e: macaddr@1e { - reg = <0x1e 0x6>; - }; -}; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi index a1fde4d698..fc869c9ec0 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi @@ -255,6 +255,25 @@ label = "art"; reg = <0x1200000 0x0140000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; partition@1340000 { @@ -423,17 +442,3 @@ }; }; }; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_6: macaddr@6 { - reg = <0x6 0x6>; - }; -}; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts index 48beaf313e..bf7c963944 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts @@ -36,13 +36,13 @@ }; &wifi0 { - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_6>, <&precal_art_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(1)>; }; &wifi1 { - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_6>, <&precal_art_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; mac-address-increment = <(2)>; }; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts index b7f00a7a6f..f584735e15 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts @@ -34,20 +34,16 @@ }; &wifi0 { - nvmem-cells = <&macaddr_art_c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_c>, <&precal_art_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; &wifi1 { - nvmem-cells = <&macaddr_art_0>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_0>, <&precal_art_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; }; &art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - macaddr_art_c: macaddr@c { reg = <0xc 0x6>; }; From c2630ac910febd0be4ab8dc41f2aa7bda55e19f4 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Thu, 3 Feb 2022 23:15:36 +0100 Subject: [PATCH 102/144] linux-firmware: qca99x0 update package Kalle Valo ath10k-firmware repository no longer provides the legacy board.bin files for the qca99x0 chips. Instead he copied over the codeaurora version and add more board files. In the future, this board-2.bin should find its way to linux-firmware.git, which would allow us to remove the extra download code completely. Signed-off-by: Christian Lamparter --- package/firmware/linux-firmware/Makefile | 2 +- package/firmware/linux-firmware/qca_ath10k.mk | 45 ++----------------- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index 4786751e8c..e46c8870f1 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware PKG_VERSION:=20211216 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz diff --git a/package/firmware/linux-firmware/qca_ath10k.mk b/package/firmware/linux-firmware/qca_ath10k.mk index d2c709af7a..e6beef791b 100644 --- a/package/firmware/linux-firmware/qca_ath10k.mk +++ b/package/firmware/linux-firmware/qca_ath10k.mk @@ -1,30 +1,14 @@ -QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe +QCA99X0_BOARD_REV:=e404444dfc0baf7d0fcde21ab8ec333608c9960c QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV) define Download/qca99x0-board - URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0 - URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV) + URL:=https://github.com/kvalo/ath10k-firmware/raw/master/QCA99X0/hw2.0/ + URL_FILE:=board-2.bin FILE:=$(QCA99X0_BOARD_FILE) - HASH:=03711ac21e60ef59d3815e235eb721c0c22851b5410299411085aa6f2af45401 + HASH:=f91975dca2435fa6f8570146e6b255c2a70b9ffbdf5ef16a29d67bec7374c11a endef $(eval $(call Download,qca99x0-board)) -define Download/qca99x0-board-5g - URL:=https://github.com/kvalo/ath10k-firmware/raw/master/QCA99X0/hw2.0/ - URL_FILE:=boardData_AR900B_CUS239_5G_v2_001.bin - FILE:=boardData_AR900B_CUS239_5G_v2_001.bin - HASH:=3bf7561ee373b369025dcd366d276d038a97d3397ccae41ce841d98a58b30aff -endef -$(eval $(call Download,qca99x0-board-5g)) - -define Download/qca99x0-board-2g - URL:=https://github.com/kvalo/ath10k-firmware/raw/master/QCA99X0/hw2.0/ - URL_FILE:=boardData_AR900B_CUS260_2G_v2_002.bin - FILE:=boardData_AR900B_CUS260_2G_v2_002.bin - HASH:=fd91ddf93a271633c28fb1831a1dc5e829c345fbf2aa8980e816585cf9b9e9ed -endef -$(eval $(call Download,qca99x0-board-2g)) - Package/ath10k-board-qca4019 = $(call Package/firmware-default,ath10k qca4019 board firmware) define Package/ath10k-board-qca4019/install $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0 @@ -135,30 +119,9 @@ define Package/ath10k-board-qca99x0/install $(INSTALL_DATA) \ $(DL_DIR)/$(QCA99X0_BOARD_FILE) \ $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath10k/QCA99X0/hw2.0/board.bin \ - $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin endef $(eval $(call BuildPackage,ath10k-board-qca99x0)) -Package/ath10k-board-qca99x0-2g = $(call Package/firmware-default,ath10k qca99x0 board 2g precal firmware) -define Package/ath10k-board-qca99x0-2g/install - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 - $(INSTALL_DATA) \ - $(DL_DIR)/boardData_AR900B_CUS260_2G_v2_002.bin \ - $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2g-precal.bin -endef -$(eval $(call BuildPackage,ath10k-board-qca99x0-2g)) - -Package/ath10k-board-qca99x0-5g = $(call Package/firmware-default,ath10k qca99x0 board 5g precal firmware) -define Package/ath10k-board-qca99x0-5g/install - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 - $(INSTALL_DATA) \ - $(DL_DIR)/boardData_AR900B_CUS239_5G_v2_001.bin \ - $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-5g-precal.bin -endef -$(eval $(call BuildPackage,ath10k-board-qca99x0-5g)) - Package/ath10k-firmware-qca99x0 = $(call Package/firmware-default,ath10k qca99x0 firmware,+ath10k-board-qca99x0) define Package/ath10k-firmware-qca99x0/install $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 From 965e8783337511e2aa435935c797dc945e039b7c Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Thu, 3 Feb 2022 23:22:54 +0100 Subject: [PATCH 103/144] ipq806x: G10: use ASROCK's wifi calibration data brings back the ath10k QCA9980 wifi nodes to which it adds ASROCK's wifi calibration data. These are now provided by the ath10k_firmware.git's board-2.bin. Signed-off-by: Christian Lamparter --- .../arch/arm/boot/dts/qcom-ipq8064-g10.dts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts index d821e9b576..71dc177b1f 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts @@ -197,10 +197,36 @@ &pcie0 { status = "okay"; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi5g: wifi@1,0 { + reg = <0x00010000 0 0 0 0>; + compatible = "qcom,ath10k"; + qcom,ath10k-calibration-variant = "ASRock-G10"; + }; + }; }; &pcie1 { status = "okay"; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi2g: wifi@1,0 { + reg = <0x00010000 0 0 0 0>; + compatible = "qcom,ath10k"; + qcom,ath10k-calibration-variant = "ASRock-G10"; + }; + }; }; &qcom_pinmux { From 4d3e17e205b7abc12ad40bf6a3d32a06d8f07dc6 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Wed, 12 Jan 2022 09:00:10 +0100 Subject: [PATCH 104/144] generic: kernel: add patches with ZTE MF286D modem This patch includes patches sent upstream with ZTE MF286D modem support. It adds support for qmi and serial option driver. Links to ML: https://lore.kernel.org/linux-usb/20220111221132.14586-1-paweldembicki@gmail.com/ https://lore.kernel.org/linux-usb/20220111221205.14662-1-paweldembicki@gmail.com/ Signed-off-by: Pawel Dembicki --- ...B-serial-option-add-ZTE-MF286D-modem.patch | 62 +++++++++++++++++++ ..._wwan-add-ZTE-MF286D-modem-19d2-1485.patch | 59 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 target/linux/generic/pending-5.10/841-USB-serial-option-add-ZTE-MF286D-modem.patch create mode 100644 target/linux/generic/pending-5.10/842-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch diff --git a/target/linux/generic/pending-5.10/841-USB-serial-option-add-ZTE-MF286D-modem.patch b/target/linux/generic/pending-5.10/841-USB-serial-option-add-ZTE-MF286D-modem.patch new file mode 100644 index 0000000000..975a41bc79 --- /dev/null +++ b/target/linux/generic/pending-5.10/841-USB-serial-option-add-ZTE-MF286D-modem.patch @@ -0,0 +1,62 @@ +From 67ae6887854e4b6e736c34d4fd7087540ed31d4e Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Tue, 11 Jan 2022 21:59:50 +0100 +Subject: [PATCH] USB: serial: option: add ZTE MF286D modem + +Modem from ZTE MF286D is an Qualcomm MDM9250 based 3G/4G modem. + +T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=5000 MxCh= 0 +D: Ver= 3.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 +P: Vendor=19d2 ProdID=1485 Rev=52.87 +S: Manufacturer=ZTE,Incorporated +S: Product=ZTE Technologies MSM +S: SerialNumber=MF286DZTED000000 +C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=896mA +A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00 +I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=ff Driver=rndis_host +E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host +E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs +E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms + +Signed-off-by: Pawel Dembicki + +https://lore.kernel.org/linux-usb/20220111221205.14662-1-paweldembicki@gmail.com/ +--- + drivers/usb/serial/option.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 42420bfc983c..962e9943fc20 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1649,6 +1649,8 @@ static const struct usb_device_id option_ids[] = { + .driver_info = RSVD(2) }, + { USB_DEVICE_INTERFACE_CLASS(ZTE_VENDOR_ID, 0x1476, 0xff) }, /* GosunCn ZTE WeLink ME3630 (ECM/NCM mode) */ + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1481, 0xff, 0x00, 0x00) }, /* ZTE MF871A */ ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1485, 0xff, 0xff, 0xff), /* ZTE MF286D */ ++ .driver_info = RSVD(5) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) }, +-- +2.25.1 + diff --git a/target/linux/generic/pending-5.10/842-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch b/target/linux/generic/pending-5.10/842-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch new file mode 100644 index 0000000000..f2f0e61089 --- /dev/null +++ b/target/linux/generic/pending-5.10/842-net-qmi_wwan-add-ZTE-MF286D-modem-19d2-1485.patch @@ -0,0 +1,59 @@ +From 078c6a1cbd4cd7496048786beec2e312577bebbf Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Tue, 11 Jan 2022 23:11:32 +0100 +Subject: [PATCH] net: qmi_wwan: add ZTE MF286D modem 19d2:1485 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Modem from ZTE MF286D is an Qualcomm MDM9250 based 3G/4G modem. + +T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=5000 MxCh= 0 +D: Ver= 3.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 +P: Vendor=19d2 ProdID=1485 Rev=52.87 +S: Manufacturer=ZTE,Incorporated +S: Product=ZTE Technologies MSM +S: SerialNumber=MF286DZTED000000 +C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=896mA +A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00 +I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=ff Driver=rndis_host +E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host +E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs +E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms + +Signed-off-by: Pawel Dembicki +Acked-by: Bjørn Mork +Signed-off-by: David S. Miller +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1252,6 +1252,7 @@ static const struct usb_device_id produc + {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ + {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ + {QMI_FIXED_INTF(0x19d2, 0x1432, 3)}, /* ZTE ME3620 */ ++ {QMI_FIXED_INTF(0x19d2, 0x1485, 5)}, /* ZTE MF286D */ + {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ + {QMI_FIXED_INTF(0x2001, 0x7e16, 3)}, /* D-Link DWM-221 */ + {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ From a91ab8bc05b737d7e14976aaf929a71ea37fa1c6 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Tue, 23 Nov 2021 09:10:14 +0100 Subject: [PATCH 105/144] ipq40xx: add support for ZTE MF286D ZTE MF286D is a LTE router with four gigabit ethernet ports and integrated QMI mPCIE modem. Hardware specification: - CPU: IPQ4019 - RAM: 256MB - Flash: NAND 128MB + NOR 2MB - WLAN1: Qualcomm Atheros QCA4019 2.4GHz 802.11bgn 2x2:2 - WLAN2: Qualcomm Atheros QCA4019 5GHz 802.11anac 2x2:2 - LTE: mPCIe cat 12 card (Modem chipset MDM9250) - LAN: 4 Gigabit Ports - USB: 1x USB2.0 (regular port). 1x USB3.0 (mpcie - used by the modem) - Serial console: X8 connector 115200 8n1 Known issues: - Many LEDs are driven by the modem. Only internal LEDs and wifi LEDs are driven by cpu. - Wifi LED is triggered by phy0tpt only - No VoIP support - LAN1/WAN port is configured as WAN - ZTE gives only one MAC per device. Use +1/+2/+3 increment for WAN and WLAN0/1 Opening the case: 1. Take of battery lid (no battery support for this model, battery cage is dummy). 2. Unscrew screw placed behind battery lid. 3. Take off back cover. It attached with multiple plastic clamps. 4. Unscrew four more screws hidden behind back case. 5. Remove front panel from blue chassis. There are more plastic clamps. 6. Unscrew two boards, which secures the PCB in the chassis. 7. Extract board from blue chassis. Console connection (X8 connector): 1. Parameters: 115200 8N1 2. Pin description: (from closest pin to X8 descriptor to farthest) - VCC (3.3V) - TX - RX - GND Install Instructions: Serial + initramfs: 1. Place OpenWrt initramfs image for the device on a TFTP in the server's root. This example uses Server IP: 192.168.1.3 2. Connect serial console (115200,8n1) to X8 connector. 3. Connect TFTP server to RJ-45 port. 4. Stop in u-Boot and run u-Boot commands: setenv serverip 192.168.1.3 setenv ipaddr 192.168.1.72 set fdt_high 0x85000000 tftp openwrt-ipq40xx-generic-zte_mf286d-initramfs-fit-zImage.itb bootm $loadaddr 5. Please make backup of original partitions, if you think about revert to stock. 6. Login via ssh or serial and remove stock partitions: ubiattach -m 9 ubirmvol /dev/ubi0 -N ubi_rootfs ubirmvol /dev/ubi0 -N ubi_rootfs_data 7. Install image via "sysupgrade -n". Signed-off-by: Pawel Dembicki (cosmetic changes to the commit message) Signed-off-by: Christian Lamparter --- package/firmware/ipq-wifi/Makefile | 4 +- .../ipq-wifi/board-zte_mf286d.qca4019 | Bin 0 -> 24308 bytes .../ipq40xx/base-files/etc/board.d/02_network | 5 + .../base-files/etc/board.d/03_gpio_switches | 3 + .../base-files/lib/upgrade/platform.sh | 26 +- target/linux/ipq40xx/config-5.10 | 1 + .../arch/arm/boot/dts/qcom-ipq4019-mf286d.dts | 435 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 13 + .../901-arm-boot-add-dts-files.patch | 3 +- 9 files changed, 487 insertions(+), 3 deletions(-) create mode 100644 package/firmware/ipq-wifi/board-zte_mf286d.qca4019 create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-mf286d.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 8e1dcec20f..9842725be2 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -55,7 +55,8 @@ ALLWIFIBOARDS:= \ plasmacloud_pa1200 \ plasmacloud_pa2200 \ qxwlan_e2600ac \ - teltonika_rutx + teltonika_rutx \ + zte_mf286d ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -147,5 +148,6 @@ $(eval $(call generate-ipq-wifi-package,plasmacloud_pa1200,Plasma Cloud PA1200)) $(eval $(call generate-ipq-wifi-package,plasmacloud_pa2200,Plasma Cloud PA2200)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC)) $(eval $(call generate-ipq-wifi-package,teltonika_rutx,Teltonika RUTX)) +$(eval $(call generate-ipq-wifi-package,zte_mf286d,ZTE MF286D)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/board-zte_mf286d.qca4019 b/package/firmware/ipq-wifi/board-zte_mf286d.qca4019 new file mode 100644 index 0000000000000000000000000000000000000000..348cf954d75d93f5dcf00afa65603d6c0b4c7783 GIT binary patch literal 24308 zcmeHPdr(tX8b5>}>SE!B5E0@fgzyMLfIu}!l&6$O3KkU!um}{8q(*s#hoK90d{Bsp zU@aITXc?48Q$)t%17fkZc1D@~WB=IMnQc4!=+3OWwyWJ~XLc9&+#5ndNZJI#G{F7B zIp;g)p6{IR{O%#SH{UP!jriE$*!@Xip{c=f>9H9JKq8RTtj#m{2NlLi9?L~IbmI23MgzWgE zogJ`mphRS1V+QsDJCF~+Mn|j$02Kh2a9ktfxnag;GqIrn2oDec{`qq|K6M@V@z3X? zwaFe1ut>RYXxFBh3A}^?kImL*i$25N+PX71!H5O131r|h`_dl4eAMc?GJ5eI>jr_^ zMtt4}kDUNx_5~Xm`dz3L{aQ5D(b3Vt!NFcn0GPm5YNoise)@?9>-x#eVdlCyLz%0r zaHXtu7~3|pGJi3X!-|%=;_TF9-sDY1N1Y^le{$U9pyEt(h3Jjs?UO@Ls}yAQ9Tg3U63!vFxQW5?uEa9|74G?6LpfcMXBd^P1^vwh(#S%;eOr_7 zwH>YBBMQoK+x^)<-TUchIF(!9yfakO^?FNi4ZURSY-#Q8Vs<7Hc^CFe5OZ=|cVFul zbtW}$tMM$o{b6-aNP}0IYyQeYiSSm7fP>?PUu|+mT-`Qr@!YC?!`CaZ_t>8jI1aoZ z!ZH$xWQXPU_V8nQ-K;oXZ_EmHfAscVF3Mv0z&~H6x3>?|o5{>1uh(9aXni5dnV$c{Q3FV?( z4)-w^*@^Dt>=cBep$HG1b3%F5xH{((pFignp)NQ-=0M_#x;}G7JW)@Mryw4Ue-@9V zqN$uzK{y)zEF6hKqc~9l%}LPD@u@V>FME#d-LiL;!}`g0iK6$>VpKKu|FYP&)o@Kp ztihbKPoPAgWC8(VYnT9LUh|qnX&wSZg+PEnfIxsifIxsiU=1U%nY$VBqP)g^4N0f$ z;O;=8DeJWYG78(Tjy}-OwYUD3l?&(CpcSjlv4&3}v2+U&c(Fh%9ALS+W1$6e#N2-7 zjAcW81i7X1u_pk)vR2+Z_QbH{1P28L1qQGfsBLP{xxl~xKj@#0YS6t||7=pTp{;1t zl^B2k*KgR30E7WQ$OQ6&iRA*LGcaLg8zl@zYUp%butuX@fb9!gnatb{7U1*j!1u=h z$X|y5k{fAbE-YPK@F1g6ABe`)iNMPdCn||l1S1eIx=bRke;>*fDB9JILs?3jAPc^^ z_KtmFs`U5sW&MS>pG>NL?g!QTB@x%ow<^0o_|-MxL+heyW7Cq8-j#S_a9=*96Y zyK-GIy#XEv6;PVAkx)DaDu`>+MnUoTr-0j}jeuGXqDhO@kM4@u2CK_ab7ID6nRz9x z7ccj#ZmB;vrLQhjbgQAxP!T#x=gg2v7k>AV>faGZ6?M<#YIg2&>&+>t?k? zqj6~nN=f7Vk|dTsFS_O~c6y`1Xc}P1H4%ag6tFif@l1`lcG*yW={0 z2l5>A9e`UeEv4aa#0NFt+v`t+{gy#btibc9QmFt-TA|Ts083i2u)Yb3)^xEY6Ra~~ z8bj@+{+4>*jX~Q>Yov|nyfo3@u=yVv`P8s|e!aVUdb+#U$!R_nW_}+_YHKo#ODx)) zEnxi-``oEgKvy)9}>dhU5;_8dS~s?nIwyuhDVHG-xe*j_qB2u05tNk#6rR$ilwlo_I3< z4ntQn_Wz>a_T{Mhg0fncDGd4YwpyXAm*ok0>RZZ-vT|V}&sROF>XXaFLLMFajo7{W z{s90QbSR~=147R9i0Zujm^eeoQ;jKm#bRL^FG&5dvRx(-#_<@K!NiomKft?*WtpJV67e4O4b@d;Gc-<9-IaHVtCNxfJk{gM_i&fI zFqiH>2w(%a)E?D2rBt2|T~aDf$;)Lz)eU8jSdtXW3z@#Fx+<>|ALMyx4A_3y8rqe| zqeaUCH|p3>2g z5@pKyZNKq6cCI(GHS9P;?40)5z>)TtMqkO6Jo(6h9^QGcdWyJdAg`Ny8kJHC$FG-P zjCqG$K{@bXP}C9K=ySw9uYTyj<=`fd>Q@Q|M`}KZX$`2~Tq;+joeHaRJGg1j?SaDf zoehk)+;Tp>EgMW%_@AIjR5zqoqner3ltay3>8B&A-Gxp`H-`?r$9u<1;+EI167?jU zV@Q$wfuTwz{}i*_ML5<|(HdVLB%x(I`Y5F(sBTM%%fW$>!@Y^^tmD*@&cUOXqnrI| zsRh@%L`}P;frnjF`>!9n6m`<4f|_?}pr9+Z#k-P{ccEW&iGSLs(lz&N>%q4p#LOH@ z%;;ccciP#28u#KgyK#tx69}vV1eW^r4fqT!ofyGmq$!{0f. + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + model = "ZTE MF286D"; + compatible = "zte,mf286d"; + + aliases { + led-boot = &led_internal; + led-failsafe = &led_internal; + led-running = &led_internal; + led-upgrade = &led_internal; + }; + + chosen { + /* + * bootargs forced by u-boot bootipq command: + * 'ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs rootwait' + */ + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + gpio-restart { + compatible = "gpio-restart"; + gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>; + }; + + leds { + compatible = "gpio-leds"; + + led_internal: led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&tlmm 10 GPIO_ACTIVE_LOW>; + label = "blue:internal_led"; + default-state = "keep"; + }; + + led-1 { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + wifi { + label = "wifi"; + linux,code = ; + gpios = <&tlmm 11 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 68 GPIO_ACTIVE_LOW>; + }; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + mdio@90000 { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; + reset-delay-us = <2000>; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + status = "okay"; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb2@60f8800 { + status = "okay"; + }; + + usb3@8af8800 { + status = "okay"; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; + + flash@0 { + /* u-boot is looking for "n25q128a11" property */ + compatible = "jedec,spi-nor", "n25q128a11"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "0:QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "0:CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "0:APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = <0xf0000 0xc0000>; + read-only; + }; + + partition@1b0000 { + label = "0:reserved1"; + reg = <0x1b0000 0x50000>; + read-only; + }; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&gmac0 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_config_0>; +}; + +&gmac1 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_config_0>; + mac-address-increment = <1>; +}; + +&nand { + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + status = "okay"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = <0x0 0xa0000>; + read-only; + }; + + partition@a0000 { + label = "ART"; + reg = <0xa0000 0x80000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + + partition@120000 { + label = "mac"; + reg = <0x120000 0x80000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + partition@1a0000 { + label = "reserved2"; + reg = <0x1a0000 0xc0000>; + read-only; + }; + + partition@260000 { + label = "cfg-param"; + reg = <0x260000 0x400000>; + read-only; + }; + + partition@660000 { + label = "log"; + reg = <0x660000 0x400000>; + }; + + partition@a60000 { + label = "oops"; + reg = <0xa60000 0xa0000>; + }; + + partition@b00000 { + label = "reserved3"; + reg = <0xb00000 0x500000>; + read-only; + }; + + partition@1000000 { + label = "web"; + reg = <0x1000000 0x800000>; + }; + + partition@1800000 { + label = "rootfs"; + reg = <0x1800000 0x1d00000>; + }; + + partition@3500000 { + label = "data"; + reg = <0x3500000 0x1900000>; + }; + + partition@4e00000 { + label = "fota"; + reg = <0x4e00000 0x3200000>; + }; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&tlmm { + i2c_0_pins: i2c_0_pinmux { + mux { + pins = "gpio20", "gpio21"; + function = "blsp_i2c0"; + bias-disable; + }; + }; + + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + nand_pins: nand_pins { + pullups { + pins = "gpio52", "gpio53", "gpio58", + "gpio59"; + function = "qpic"; + bias-pull-up; + }; + + pulldowns { + pins = "gpio54", "gpio55", "gpio56", + "gpio57", "gpio60", + "gpio62", "gpio63", "gpio64", + "gpio65", "gpio66", "gpio67", + "gpio69"; + function = "qpic"; + bias-pull-down; + }; + }; + + serial_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio12"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_1000>, <&macaddr_config_0>; + mac-address-increment = <2>; + qcom,ath10k-calibration-variant = "zte,mf286d"; +}; + +&wifi1 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_5000>, <&macaddr_config_0>; + mac-address-increment = <3>; + qcom,ath10k-calibration-variant = "zte,mf286d"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index b22d261d65..15e9a24544 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -977,6 +977,19 @@ define Device/unielec_u4019-32m endef TARGET_DEVICES += unielec_u4019-32m +define Device/zte_mf286d + $(call Device/FitzImage) + DEVICE_VENDOR := ZTE + DEVICE_MODEL := MF286D + SOC := qcom-ipq4019 + DEVICE_DTS_CONFIG := config@ap.dk04.1-c1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + DEVICE_PACKAGES := ipq-wifi-zte_mf286d kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi +endef +TARGET_DEVICES += zte_mf286d + define Device/zyxel_nbg6617 $(call Device/FitImageLzma) DEVICE_VENDOR := ZyXEL diff --git a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch index 09ea4efddd..c8229f28d7 100644 --- a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -902,11 +902,73 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -902,11 +902,74 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -60,6 +60,7 @@ Signed-off-by: John Crispin + qcom-ipq4019-hap-ac3.dtb \ + qcom-ipq4019-map-ac2200.dtb \ + qcom-ipq4019-lhgg-60ad.dtb \ ++ qcom-ipq4019-mf286d.dtb \ + qcom-ipq4019-mr8300.dtb \ + qcom-ipq4019-pa2200.dtb \ + qcom-ipq4019-r619ac-64m.dtb \ From 2c1f8a665eb3dce27deb4f9f9b718eb8baf997bd Mon Sep 17 00:00:00 2001 From: Julien Cassette Date: Mon, 17 Jan 2022 19:41:32 +0100 Subject: [PATCH 106/144] ipq40xx: add Linksys MR8300 WAN port This makes the WAN interface and port appear in LuCi -> Network -> Switch on Linksys MR8300. This allows to configure a VLAN on WAN. Fixes: FS#4227 Signed-off-by: Julien Cassette --- target/linux/ipq40xx/base-files/etc/board.d/02_network | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 11ebb2ef83..f0b3adae26 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -67,12 +67,16 @@ ipq40xx_setup_interfaces() ;; avm,fritzbox-4040|\ linksys,ea6350v3|\ - linksys,ea8300|\ - linksys,mr8300) + linksys,ea8300) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" ;; + linksys,mr8300) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" + ;; avm,fritzbox-7530) ucidef_add_switch "switch0" \ "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" From 02fbdc6a47ba6d3ede3c5bb639035f3978ba5a5a Mon Sep 17 00:00:00 2001 From: John Audia Date: Sun, 23 Jan 2022 04:42:41 -0500 Subject: [PATCH 107/144] bcm27xx: update distroconfig.txt for faster RPi4 Newer RPi 4 Rev 6 (8 GB models and recent 2 GB / 4 GB models) ship with the so-called C0 processor which can run turbo mode at 1.8 GHz max rather than 1.5 GHz gracefully. Add 'arm_boost=1' to pi4 section of to enable. Note that this setting has no effect on older chips; they continue with their 1.5 GHz max unless users overclock them. Ref: https://www.raspberrypi.com/news/bullseye-bonus-1-8ghz-raspberry-pi-4 Signed-off-by: John Audia --- target/linux/bcm27xx/image/distroconfig.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/bcm27xx/image/distroconfig.txt b/target/linux/bcm27xx/image/distroconfig.txt index 54cf44346f..103c5d2e82 100644 --- a/target/linux/bcm27xx/image/distroconfig.txt +++ b/target/linux/bcm27xx/image/distroconfig.txt @@ -12,3 +12,5 @@ dtoverlay=disable-bt dtoverlay=disable-bt [pi4] dtoverlay=disable-bt +# Run as fast as firmware / board allows +arm_boost=1 From 54e82f5c9a21b52f99daf4465c3039e2901406ff Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 11 Jan 2022 00:13:02 +0100 Subject: [PATCH 108/144] ath79: kernel: drop _machine_restart again Backport patch ("MIPS: ath79: drop _machine_restart again"), which is required to support GPIO restart handler on ZTE MF286, broken due to _machine_restart being restored in kernel accidentally, wich causes any registered restart handlers to not execute, including one from ath79-reset driver. Signed-off-by: Lech Perczak --- ...PS-ath79-drop-_machine_restart-again.patch | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 target/linux/generic/backport-5.10/860-v5.17-MIPS-ath79-drop-_machine_restart-again.patch diff --git a/target/linux/generic/backport-5.10/860-v5.17-MIPS-ath79-drop-_machine_restart-again.patch b/target/linux/generic/backport-5.10/860-v5.17-MIPS-ath79-drop-_machine_restart-again.patch new file mode 100644 index 0000000000..28c69e36fa --- /dev/null +++ b/target/linux/generic/backport-5.10/860-v5.17-MIPS-ath79-drop-_machine_restart-again.patch @@ -0,0 +1,54 @@ +From d3115128bdafb62628ab41861a4f06f6d02ac320 Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Mon, 10 Jan 2022 23:48:44 +0100 +Subject: MIPS: ath79: drop _machine_restart again + +Commit 81424d0ad0d4 ("MIPS: ath79: Use the reset controller to restart +OF machines") removed setup of _machine_restart on OF machines to use +reset handler in reset controller driver. +While removing remnants of non-OF machines in commit 3a77e0d75eed +("MIPS: ath79: drop machfiles"), this was introduced again, making it +impossible to use additional restart handlers registered through device +tree. Drop setting _machine_restart altogether, and ath79_restart +function, which is no longer used after this. + +Fixes: 3a77e0d75eed ("MIPS: ath79: drop machfiles") +Cc: John Crispin +Cc: Florian Fainelli +Signed-off-by: Lech Perczak +Signed-off-by: Thomas Bogendoerfer +--- + arch/mips/ath79/setup.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c +index 891f495c4c3c01..0ac435fe2dc9aa 100644 +--- a/arch/mips/ath79/setup.c ++++ b/arch/mips/ath79/setup.c +@@ -34,15 +34,6 @@ + + static char ath79_sys_type[ATH79_SYS_TYPE_LEN]; + +-static void ath79_restart(char *command) +-{ +- local_irq_disable(); +- ath79_device_reset_set(AR71XX_RESET_FULL_CHIP); +- for (;;) +- if (cpu_wait) +- cpu_wait(); +-} +- + static void ath79_halt(void) + { + while (1) +@@ -234,7 +225,6 @@ void __init plat_mem_setup(void) + + detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); + +- _machine_restart = ath79_restart; + _machine_halt = ath79_halt; + pm_power_off = ath79_halt; + } +-- +cgit + From 8c78a13bfc1f34ea12076eb9864cd14bd7fe70e9 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 9 Jan 2022 20:46:53 +0100 Subject: [PATCH 109/144] ath79: support ZTE MF286 ZTE MF286 is an indoor LTE category 6 CPE router with simultaneous dual-band 802.11ac plus 802.11n Wi-Fi radios and quad-port gigabit Ethernet switch, FXS and external USB 2.0 port. Hardware highlights: - CPU: QCA9563 SoC at 775MHz, - RAM: 128MB DDR2, - NOR Flash: MX25L1606E 2MB SPI Flash, for U-boot only, - NAND Flash: GD5F1G04UBYIG 128MB SPI NAND-Flash, for all other data, - Wi-Fi 5GHz: QCA9882 2x2 MIMO 802.11ac radio, - WI-Fi 2.4GHz: QCA9563 3x3 MIMO 802.11n radio, - Switch: QCA8337v2 4-port gigabit Ethernet, with single SGMII CPU port, - WWAN: MDM9230-based category 6 internal LTE modem in extended mini-PCIE form factor, with 3 internal antennas and 2 external antenna connections, single mini-SIM slot. Modem model identified as MF270, - FXS: one external ATA port (handled entirely by modem part) with two physical connections in parallel, - USB: Single external USB 2.0 port, - Switches: power switch, WPS, Wi-Fi and reset buttons, - LEDs: Wi-Fi, Test (internal). Rest of LEDs (Phone, WWAN, Battery, Signal state) handled entirely by modem. 4 link status LEDs handled by the switch on the backside. - Battery: 3Ah 1-cell Li-Ion replaceable battery, with charging and monitoring handled by modem. - Label MAC device: eth0 Console connection: connector X2 is the console port, with the following pinout, starting from pin 1, which is the topmost pin when the board is upright: - VCC (3.3V). Do not use unless you need to source power for the converer from it. - TX - RX - GND Default port configuration in U-boot as well as in stock firmware is 115200-8-N-1. Installation: Due to different flash layout from stock firmware, sysupgrade from within stock firmware is impossible, despite it's based on QSDK which itself is based on OpenWrt. STEP 0: Stock firmware update: As installing OpenWrt cuts you off from official firmware updates for the modem part, it is recommended to update the stock firmware to latest version before installation, to have built-in modem at the latest firmware version. STEP 1: gaining root shell: Method 1: This works if busybox has telnetd compiled in the binary. If this does not work, try method 2. Using well-known exploit to start telnetd on your router - works only if Busybox on stock firmware has telnetd included: - Open stock firmware web interface - Navigate to "URL filtering" section by going to "Advanced settings", then "Firewall" and finally "URL filter". - Add an entry ending with "&&telnetd&&", for example "http://hostname/&&telnetd&&". - telnetd will immediately listen on port 4719. - After connecting to telnetd use "admin/admin" as credentials. Method 2: This works if busybox does not have telnetd compiled in. Notably, this is the case in DNA.fi firmware. If this does not work, try method 3. - Set IP of your computer to 192.168.1.22. - Have a TFTP server running at that address - Download MIPS build of busybox including telnetd, for example from: https://busybox.net/downloads/binaries/1.21.1/busybox-mips and put it in it's root directory. Rename it as "telnetd". - As previously, login to router's web UI and navigate to "URL filtering" - Using "Inspect" feature, extend "maxlength" property of the input field named "addURLFilter", so it looks like this: - Stay on the page - do not navigate anywhere - Enter "http://aa&zte_debug.sh 192.168.1.22 telnetd" as a filter. - Save the settings. This will download the telnetd binary over tftp and execute it. You should be able to log in at port 23, using "admin/admin" as credentials. Method 3: If the above doesn't work, use the serial console - it exposes root shell directly without need for login. Some stock firmwares, notably one from finnish DNA operator lack telnetd in their builds. STEP 2: Backing up original software: As the stock firmware may be customized by the carrier and is not officially available in the Internet, IT IS IMPERATIVE to back up the stock firmware, if you ever plan to returning to stock firmware. Method 1: after booting OpenWrt initramfs image via TFTP: PLEASE NOTE: YOU CANNOT DO THIS IF USING INTERMEDIATE FIRMWARE FOR INSTALLATION. - Dump stock firmware located on stock kernel and ubi partitions: ssh root@192.168.1.1: cat /dev/mtd4 > mtd4_kernel.bin ssh root@192.168.1.1: cat /dev/mtd8 > mtd8_ubi.bin And keep them in a safe place, should a restore be needed in future. Method 2: using stock firmware: - Connect an external USB drive formatted with FAT or ext4 to the USB port. - The drive will be auto-mounted to /var/usb_disk - Check the flash layout of the device: cat /proc/mtd It should show the following: mtd0: 00080000 00010000 "uboot" mtd1: 00020000 00010000 "uboot-env" mtd2: 00140000 00020000 "fota-flag" mtd3: 00140000 00020000 "caldata" mtd4: 00140000 00020000 "mac" mtd5: 00600000 00020000 "cfg-param" mtd6: 00140000 00020000 "oops" mtd7: 00800000 00020000 "web" mtd8: 00300000 00020000 "kernel" mtd9: 01f00000 00020000 "rootfs" mtd10: 01900000 00020000 "data" mtd11: 03200000 00020000 "fota" Differences might indicate that this is NOT a vanilla MF286 device but one of its later derivatives. - Copy over all MTD partitions, for example by executing the following: for i in 0 1 2 3 4 5 6 7 8 9 10 11; do cat /dev/mtd$i > \ /var/usb_disk/mtd$i; done - If the count of MTD partitions is different, this might indicate that this is not a standard MF286 device, but one of its later derivatives. - (optionally) rename the files according to MTD partition names from /proc/mtd - Unmount the filesystem: umount /var/usb_disk; sync and then remove the drive. - Store the files in safe place if you ever plan to return to stock firmware. This is especially important, because stock firmware for this device is not available officially, and is usually customized by the mobile providers. STEP 3: Booting initramfs image: Method 1: using serial console (RECOMMENDED): - Have TFTP server running, exposing the OpenWrt initramfs image, and set your computer's IP address as 192.168.1.22. This is the default expected by U-boot. You may wish to change that, and alter later commands accordingly. - Connect the serial console if you haven't done so already, - Interrupt boot sequence by pressing any key in U-boot when prompted - Use the following commands to boot OpenWrt initramfs through TFTP: setenv serverip 192.168.1.22 setenv ipaddr 192.168.1.1 tftpboot 0x81000000 openwrt-ath79-nand-zte_mf286-initramfs-kernel.bin bootm 0x81000000 (Replace server IP and router IP as needed). There is no emergency TFTP boot sequence triggered by buttons, contrary to MF283+. - When OpenWrt initramfs finishes booting, proceed to actual installation. Method 2: using initramfs image as temporary boot kernel This exploits the fact, that kernel and rootfs MTD devices are consecutive on NAND flash, so from within stock image, an initramfs can be written to this area and booted by U-boot on next reboot, because it uses "nboot" command which isn't limited by kernel partition size. - Download the initramfs-kernel.bin image - Split the image into two parts on 3MB partition size boundary, which is the size of kernel partition. Pad the output of second file to eraseblock size: dd if=openwrt-ath79-nand-zte_mf286-initramfs-kernel.bin \ bs=128k count=24 \ of=openwrt-ath79-zte_mf286-intermediate-kernel.bin dd if=openwrt-ath79-nand-zte_mf286-initramfs-kernel.bin \ bs=128k skip=24 conv=sync \ of=openwrt-ath79-zte_mf286-intermediate-rootfs.bin - Copy over /usr/bin/flash_eraseall and /usr/bin/nandwrite utilities to /tmp. This is CRITICAL for installation, as erasing rootfs will cut you off from those tools on flash! - After backing up the previous MTD contents, write the images to the respective MTD devices: /tmp/flash_eraseall /dev/ /tmp/nandwrite /dev/ \ /var/usb_disk/openwrt-ath79-zte_mf286-intermediate-kernel.bin /tmp/flash_eraseall /dev/ /tmp/nandwrite /dev/ \ /var/usb_disk/openwrt-ath79-zte_mf286-intermediate-rootfs.bin - Ensure that no bad blocks were present on the devices while writing. If they were present, you may need to vary the split between kernel and rootfs parts, so U-boot reads a valid uImage after skipping the bad blocks. If it fails, you will be left with method 3 (below). - If write is OK, reboot the device, it will reboot to OpenWrt initramfs: reboot -f - After rebooting, SSH into the device and use sysupgrade to perform proper installation. Method 3: using built-in TFTP recovery (LAST RESORT): - With that method, ensure you have complete backup of system's NAND flash first. It involves deliberately erasing the kernel. - Download "-initramfs-kernel.bin" image for the device. - Prepare the recovery image by prepending 8MB of zeroes to the image, and name it root_uImage: dd if=/dev/zero of=padding.bin bs=8M count=1 cat padding.bin openwrt-ath79-nand-zte_mf286-initramfs-kernel.bin > root_uImage - Set up a TFTP server at 192.0.0.1/8. Router will use random address from that range. - Put the previously generated "root_uImage" into TFTP server root directory. - Deliberately erase "kernel" partition" using stock firmware after taking backup. THIS IS POINT OF NO RETURN. - Restart the device. U-boot will attempt flashing the recovery initramfs image, which will let you perform actual installation using sysupgrade. This might take a considerable time, sometimes the router doesn't establish Ethernet link properly right after booting. Be patient. - After U-boot finishes flashing, the LEDs of switch ports will all light up. At this moment, perform power-on reset, and wait for OpenWrt initramfs to finish booting. Then proceed to actual installation. STEP 4: Actual installation: - scp the sysupgrade image to the device: scp openwrt-ath79-nand-zte_mf286-squashfs-sysupgrade.bin \ root@192.168.1.1:/tmp/ - ssh into the device and execute sysupgrade: sysupgrade -n /tmp/openwrt-ath79-nand-zte_mf286-squashfs-sysupgrade.bin - Wait for router to reboot to full OpenWrt. STEP 5: WAN connection establishment Since the router is equipped with LTE modem as its main WAN interface, it might be useful to connect to the Internet right away after installation. To do so, please put the following entries in /etc/config/network, replacing the specific configuration entries with one needed for your ISP: config interface 'wan' option proto 'qmi' option device '/dev/cdc-wdm0' option auth '' # As required, usually 'none' option pincode '' # If required by SIM option apn '' # As required by ISP option pdptype '' # Typically 'ipv4', or 'ipv4v6' or 'ipv6' For example, the following works for most polish ISPs config interface 'wan' option proto 'qmi' option device '/dev/cdc-wdm0' option auth 'none' option apn 'internet' option pdptype 'ipv4' If you have build with LuCI, installing luci-proto-qmi helps with this task. Restoring the stock firmware: Preparation: If you took your backup using stock firmware, you will need to reassemble the partitions into images to be restored onto the flash. The layout might differ from ISP to ISP, this example is based on generic stock firmware. The only partitions you really care about are "web", "kernel", and "rootfs". For easy padding and possibly restoring configuration, you can concatenate most of them into images written into "ubi" meta-partition in OpenWrt. To do so, execute something like: cat mtd5_cfg-param.bin mtd6-oops.bin mtd7-web.bin mtd9-rootfs.bin > \ mtd8-ubi_restore.bin You can skip the "fota" partition altogether, it is used only for stock firmware update purposes and can be overwritten safely anyway. The same is true for "data" partition which on my device was found to be unused at all. Restoring mtd5_cfg-param.bin will restore the stock firmware configuration you had before. Method 1: Using initramfs: - Boot to initramfs as in step 3: - Completely detach ubi0 partition using ubidetach /dev/ubi0_0 - Look up the kernel and ubi partitions in /proc/mtd - Copy over the stock kernel image using scp to /tmp - Erase kernel and restore stock kernel: (scp mtd4_kernel.bin root@192.168.1.1:/tmp/) mtd write mtd4_kernel.bin rm mtd4_kernel.bin - Copy over the stock partition backups one-by-one using scp to /tmp, and restore them individually. Otherwise you might run out of space in tmpfs: (scp mtd3_ubiconcat0.bin root@192.168.1.1:/tmp/) mtd write mtd3_ubiconcat0.bin rm mtd3_ubiconcat0.bin (scp mtd5_ubiconcat1.bin root@192.168.1.1:/tmp/) mtd write mtd5_ubiconcat1.bin rm mtd5_ubiconcat1.bin - If the write was correct, force a device reboot with reboot -f Method 2: Using live OpenWrt system (NOT RECOMMENDED): - Prepare a USB flash drive contatining MTD backup files - Ensure you have kmod-usb-storage and filesystem driver installed for your drive - Mount your flash drive mkdir /tmp/usb mount /dev/sda1 /tmp/usb - Remount your UBI volume at /overlay to R/O mount -o remount,ro /overlay - Write back the kernel and ubi partitions from USB drive cd /tmp/usb mtd write mtd4_kernel.bin /dev/ mtd write mtd8_ubi.bin /dev/ - If everything went well, force a device reboot with reboot -f Last image may be truncated a bit due to lack of space in RAM, but this will happen over "fota" MTD partition which may be safely erased after reboot anyway. Method 3: using built-in TFTP recovery (LAST RESORT): - Assemble a recovery rootfs image from backup of stock partitions by concatenating "web", "kernel", "rootfs" images dumped from the device, as "root_uImage" - Use it in place of "root_uImage" recovery initramfs image as in the TFTP pre-installation method. Quirks and known issues - Kernel partition size is increased to 4MB compared to stock 3MB, to accomodate future kernel updates - at this moment OpenWrt 5.10 kernel image is at 2.5MB which is dangerously close to the limit. This has no effect on booting the system - but keep that in mind when reassembling an image to restore stock firmware. - uqmi seems to be unable to change APN manually, so please use the one you used before in stock firmware first. If you need to change it, please use protocok '3g' to establish connection once, or use the following command to change APN (and optionally IP type) manually: echo -ne 'AT+CGDCONT=1,"IP","' > /dev/ttyUSB0 - The only usable LED as a "system LED" is the green debug LED hidden inside the case. All other LEDs are controlled by modem, on which the router part has some influence only on Wi-Fi LED. - Wi-Fi LED currently doesn't work while under OpenWrt, despite having correct GPIO mapping. All other LEDs are controlled by modem, including this one in stock firmware. GPIO19, mapped there only acts as a gate, while the actual signal source seems to be 5GHz Wi-Fi radio, however it seems it is not the LED exposed by ath10k as ath10k-phy0. - GPIO5 used for modem reset is a suicide switch, causing a hardware reset of whole board, not only the modem. It is attached to gpio-restart driver, to restart the modem on reboot as well, to ensure QMI connectivity after reboot, which tends to fail otherwise. - Modem, as in MF283+, exposes root shell over ADB - while not needed for OpenWrt operation at all - have fun lurking around. - MAC address shift for 5GHz Wi-Fi used in stock firmware is 0x320000000000, which is impossible to encode in the device tree, so I took the liberty of using MAC address increment of 1 for it, to ensure different BSSID for both Wi-Fi interfaces. Signed-off-by: Lech Perczak --- package/boot/uboot-envtools/files/ath79 | 3 + target/linux/ath79/dts/qca9563_zte_mf286.dts | 256 ++++++++++++++++++ target/linux/ath79/image/nand.mk | 14 + .../nand/base-files/etc/board.d/02_network | 4 + target/linux/ath79/nand/config-default | 2 + 5 files changed, 279 insertions(+) create mode 100644 target/linux/ath79/dts/qca9563_zte_mf286.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 7aa992e458..8cc0f59764 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -121,6 +121,9 @@ qihoo,c301) wallys,dr531) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x10000" ;; +zte,mf286) + ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x20000" "0x10000" + ;; esac config_load ubootenv diff --git a/target/linux/ath79/dts/qca9563_zte_mf286.dts b/target/linux/ath79/dts/qca9563_zte_mf286.dts new file mode 100644 index 0000000000..c4ebdebd10 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_zte_mf286.dts @@ -0,0 +1,256 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// Copyright (c) 2021 Cezary Jackiewicz +// Copyright (c) 2021, 2022 Lech Perczak +#include "qca956x.dtsi" + +#include +#include +#include + +/ { + model = "ZTE MF286"; + compatible = "zte,mf286", "qca,qca9563"; + + aliases { + led-boot = &led_debug; + led-failsafe = &led_debug; + led-running = &led_debug; + led-upgrade = &led_debug; + label-mac-device = ð0; + }; + + leds { + compatible = "gpio-leds"; + + /* Hidden green SMD LED below signal strength LEDs + * Visible through slits underside of the case, + * and slightly through the case below signal state LEDs */ + led_debug: led-0 { + color = ; + function = LED_FUNCTION_DEBUG; + label = "green:debug"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wifi { + label = "wifi"; + linux,code = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + /* This GPIO is used to reset whole board _including_ the modem */ + gpio-restart { + compatible = "gpio-restart"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + active-delay = <3000>; + inactive-delay = <1000>; + }; + + ubi-concat { + compatible = "mtd-concat"; + devices = <&ubiconcat0 &ubiconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x7840000>; + label = "ubi"; + }; + }; + }; +}; + +&gpio { + /* GPIO19 is used as a mask to enable WLAN LED + * in stock firmware, which is controlled directly + * by 5GHz Wi-Fi chip, which currently is inactive + * in OpenWrt */ + led-wlan { + gpio-hog; + gpios = <19 GPIO_ACTIVE_LOW>; + output-high; + line-name = "led:wlan"; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x080000>; + read-only; + }; + + partition@80000 { + label = "u-boot-env"; + reg = <0x080000 0x020000>; + read-only; + }; + }; + }; + + flash@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = <0x000000 0x140000>; + read-only; + }; + + caldata: partition@140000 { + label = "caldata"; + reg = <0x140000 0x140000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + cal_caldata_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + cal_caldata_5000: cal@5000 { + reg = <0x5000 0x844>; + }; + }; + + mac: partition@280000 { + label = "mac"; + reg = <0x280000 0x140000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mac_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + /* This encompasses stock cfg-param, oops, web partitions, + * which can be overwritten safely */ + ubiconcat0: partition@3c0000 { + label = "ubiconcat0"; + reg = <0x3c0000 0xf40000>; + }; + + /* Kernel MTD size is increased to 4MB from stock 3MB */ + partition@1300000 { + label = "kernel"; + reg = <0x1300000 0x400000>; + }; + + /* This encompasses stock rootfs, data, fota partitions, + * which can be overwritten safely */ + ubiconcat1: partition@1600000 { + label = "ubiconcat1"; + reg = <0x1700000 0x6900000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0>; + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + + qca,ar8327-initvals = < + 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_mac_0>; + nvmem-cell-names = "mac-address"; + phy-mode = "sgmii"; + phy-handle = <&phy0>; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0 0 0 0 0>; + + nvmem-cells = <&macaddr_mac_0>, <&cal_caldata_5000>; + nvmem-cell-names = "mac-address", "calibration"; + mac-address-increment = <1>; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&macaddr_mac_0>, <&cal_caldata_1000>; + nvmem-cell-names = "mac-address", "calibration"; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; +}; + +&usb_phy1 { + status = "okay"; +}; + +&usb1 { + status = "okay"; +}; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 1e1152551b..2d7892db94 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -305,6 +305,20 @@ define Device/netgear_wndr4500-v3 endef TARGET_DEVICES += netgear_wndr4500-v3 +define Device/zte_mf286 + SOC := qca9563 + DEVICE_VENDOR := ZTE + DEVICE_MODEL := MF286 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \ + ath10k-firmware-qca988x-ct kmod-usb-net-qmi-wwan kmod-usb-serial-option \ + uqmi + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += zte_mf286 + define Device/zyxel_nbg6716 SOC := qca9558 DEVICE_VENDOR := ZyXEL diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index 76cdab18f8..2c85245bee 100644 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -42,6 +42,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" ;; + zte,mf286) + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "5:lan:1" + ;; zyxel,nbg6716) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1" diff --git a/target/linux/ath79/nand/config-default b/target/linux/ath79/nand/config-default index 6d8ff2d576..c04a3d1990 100644 --- a/target/linux/ath79/nand/config-default +++ b/target/linux/ath79/nand/config-default @@ -16,6 +16,8 @@ CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_PCI_AR71XX is not set CONFIG_PHY_AR7200_USB=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_SGL_ALLOC=y CONFIG_UBIFS_FS=y CONFIG_ZLIB_DEFLATE=y From 7a1ce08bdbd36a132fbd0d4114346fb5e4d3aa36 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sat, 29 Jan 2022 16:09:24 +0100 Subject: [PATCH 110/144] octeontx: switch to 5.10 Kernel Tested by multiple users and seems to work fine. Acked-by: Hauke Mehrtens Tested-by: Daniel Danzberger Signed-off-by: Paul Spooren --- target/linux/octeontx/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile index 44bbc76a43..eb90529740 100644 --- a/target/linux/octeontx/Makefile +++ b/target/linux/octeontx/Makefile @@ -9,8 +9,7 @@ BOARD:=octeontx BOARDNAME:=Octeon-TX FEATURES:=targz pcie gpio rtc usb fpu -KERNEL_PATCHVER:=5.4 -KERNEL_TESTING_PATCHVER:=5.10 +KERNEL_PATCHVER:=5.10 define Target/Description Build images for Octeon-TX CN80XX/CN81XX based boards From 637a3aaa6f889bb8c846a48b3407daf72fe89037 Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Thu, 3 Feb 2022 20:07:00 +0800 Subject: [PATCH 111/144] kernel: backport MediaTek jumbo frame support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow MTU up to 2026 on mediatek, ramips/mt7621 targets. Signed-off-by: DENG Qingfang Tested-by: Arınç ÜNAL Tested-by: Stijn Tintel --- ...thernet-mediatek-support-setting-MTU.patch | 138 ++++++++++++++++++ ...1-net-dsa-mt7530-support-setting-MTU.patch | 112 ++++++++++++++ ...-dsa-mt7530-enable-MTU-normalization.patch | 36 +++++ 3 files changed, 286 insertions(+) create mode 100644 target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch create mode 100644 target/linux/generic/backport-5.10/762-v5.11-net-dsa-mt7530-support-setting-MTU.patch create mode 100644 target/linux/generic/backport-5.10/763-v5.11-net-dsa-mt7530-enable-MTU-normalization.patch diff --git a/target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch b/target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch new file mode 100644 index 0000000000..289d140f34 --- /dev/null +++ b/target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch @@ -0,0 +1,138 @@ +From 4fd59792097a6b2fb949d41264386a7ecade469e Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Mon, 25 Jan 2021 12:20:46 +0800 +Subject: [PATCH] net: ethernet: mediatek: support setting MTU + +MT762x HW, except for MT7628, supports frame length up to 2048 +(maximum length on GDM), so allow setting MTU up to 2030. + +Also set the default frame length to the hardware default 1518. + +Signed-off-by: DENG Qingfang +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/20210125042046.5599-1-dqfext@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 43 ++++++++++++++++++--- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 12 ++++-- + 2 files changed, 47 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -355,7 +355,7 @@ static void mtk_mac_config(struct phylin + /* Setup gmac */ + mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); + mcr_new = mcr_cur; +- mcr_new |= MAC_MCR_MAX_RX_1536 | MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE | ++ mcr_new |= MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE | + MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK; + + /* Only update control register when needed! */ +@@ -782,8 +782,8 @@ static void mtk_get_stats64(struct net_d + static inline int mtk_max_frag_size(int mtu) + { + /* make sure buf_size will be at least MTK_MAX_RX_LENGTH */ +- if (mtu + MTK_RX_ETH_HLEN < MTK_MAX_RX_LENGTH) +- mtu = MTK_MAX_RX_LENGTH - MTK_RX_ETH_HLEN; ++ if (mtu + MTK_RX_ETH_HLEN < MTK_MAX_RX_LENGTH_2K) ++ mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; + + return SKB_DATA_ALIGN(MTK_RX_HLEN + mtu) + + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); +@@ -794,7 +794,7 @@ static inline int mtk_max_buf_size(int f + int buf_size = frag_size - NET_SKB_PAD - NET_IP_ALIGN - + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + +- WARN_ON(buf_size < MTK_MAX_RX_LENGTH); ++ WARN_ON(buf_size < MTK_MAX_RX_LENGTH_2K); + + return buf_size; + } +@@ -2606,6 +2606,35 @@ static void mtk_uninit(struct net_device + mtk_rx_irq_disable(eth, ~0); + } + ++static int mtk_change_mtu(struct net_device *dev, int new_mtu) ++{ ++ int length = new_mtu + MTK_RX_ETH_HLEN; ++ struct mtk_mac *mac = netdev_priv(dev); ++ struct mtk_eth *eth = mac->hw; ++ u32 mcr_cur, mcr_new; ++ ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { ++ mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); ++ mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK; ++ ++ if (length <= 1518) ++ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1518); ++ else if (length <= 1536) ++ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1536); ++ else if (length <= 1552) ++ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1552); ++ else ++ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_2048); ++ ++ if (mcr_new != mcr_cur) ++ mtk_w32(mac->hw, mcr_new, MTK_MAC_MCR(mac->id)); ++ } ++ ++ dev->mtu = new_mtu; ++ ++ return 0; ++} ++ + static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) + { + struct mtk_mac *mac = netdev_priv(dev); +@@ -2902,6 +2931,7 @@ static const struct net_device_ops mtk_n + .ndo_set_mac_address = mtk_set_mac_address, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = mtk_do_ioctl, ++ .ndo_change_mtu = mtk_change_mtu, + .ndo_tx_timeout = mtk_tx_timeout, + .ndo_get_stats64 = mtk_get_stats64, + .ndo_fix_features = mtk_fix_features, +@@ -3004,7 +3034,10 @@ static int mtk_add_mac(struct mtk_eth *e + eth->netdev[id]->irq = eth->irq[0]; + eth->netdev[id]->dev.of_node = np; + +- eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH - MTK_RX_ETH_HLEN; ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) ++ eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH - MTK_RX_ETH_HLEN; ++ else ++ eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; + + return 0; + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -20,12 +20,13 @@ + #include "mtk_ppe.h" + + #define MTK_QDMA_PAGE_SIZE 2048 +-#define MTK_MAX_RX_LENGTH 1536 ++#define MTK_MAX_RX_LENGTH 1536 ++#define MTK_MAX_RX_LENGTH_2K 2048 + #define MTK_TX_DMA_BUF_LEN 0x3fff + #define MTK_DMA_SIZE 512 + #define MTK_NAPI_WEIGHT 64 + #define MTK_MAC_COUNT 2 +-#define MTK_RX_ETH_HLEN (VLAN_ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN) ++#define MTK_RX_ETH_HLEN (ETH_HLEN + ETH_FCS_LEN) + #define MTK_RX_HLEN (NET_SKB_PAD + MTK_RX_ETH_HLEN + NET_IP_ALIGN) + #define MTK_DMA_DUMMY_DESC 0xffffffff + #define MTK_DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | \ +@@ -352,7 +353,12 @@ + + /* Mac control registers */ + #define MTK_MAC_MCR(x) (0x10100 + (x * 0x100)) +-#define MAC_MCR_MAX_RX_1536 BIT(24) ++#define MAC_MCR_MAX_RX_MASK GENMASK(25, 24) ++#define MAC_MCR_MAX_RX(_x) (MAC_MCR_MAX_RX_MASK & ((_x) << 24)) ++#define MAC_MCR_MAX_RX_1518 0x0 ++#define MAC_MCR_MAX_RX_1536 0x1 ++#define MAC_MCR_MAX_RX_1552 0x2 ++#define MAC_MCR_MAX_RX_2048 0x3 + #define MAC_MCR_IPG_CFG (BIT(18) | BIT(16)) + #define MAC_MCR_FORCE_MODE BIT(15) + #define MAC_MCR_TX_EN BIT(14) diff --git a/target/linux/generic/backport-5.10/762-v5.11-net-dsa-mt7530-support-setting-MTU.patch b/target/linux/generic/backport-5.10/762-v5.11-net-dsa-mt7530-support-setting-MTU.patch new file mode 100644 index 0000000000..eb487cdfb5 --- /dev/null +++ b/target/linux/generic/backport-5.10/762-v5.11-net-dsa-mt7530-support-setting-MTU.patch @@ -0,0 +1,112 @@ +From 9470174e7581e75a8ebd78964997314dfc2e706c Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Tue, 3 Nov 2020 13:06:18 +0800 +Subject: [PATCH] net: dsa: mt7530: support setting MTU + +MT7530/7531 has a global RX packet length register, which can be used +to set MTU. + +Supported packet length values are 1522 (1518 if untagged), 1536, +1552, and multiple of 1024 (from 2048 to 15360). + +Signed-off-by: DENG Qingfang +Link: https://lore.kernel.org/r/20201103050618.11419-1-dqfext@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/mt7530.c | 49 ++++++++++++++++++++++++++++++++++++++++ + drivers/net/dsa/mt7530.h | 12 ++++++++++ + 2 files changed, 61 insertions(+) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1015,6 +1015,53 @@ mt7530_port_disable(struct dsa_switch *d + mutex_unlock(&priv->reg_mutex); + } + ++static int ++mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ struct mii_bus *bus = priv->bus; ++ int length; ++ u32 val; ++ ++ /* When a new MTU is set, DSA always set the CPU port's MTU to the ++ * largest MTU of the slave ports. Because the switch only has a global ++ * RX length register, only allowing CPU port here is enough. ++ */ ++ if (!dsa_is_cpu_port(ds, port)) ++ return 0; ++ ++ mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); ++ ++ val = mt7530_mii_read(priv, MT7530_GMACCR); ++ val &= ~MAX_RX_PKT_LEN_MASK; ++ ++ /* RX length also includes Ethernet header, MTK tag, and FCS length */ ++ length = new_mtu + ETH_HLEN + MTK_HDR_LEN + ETH_FCS_LEN; ++ if (length <= 1522) { ++ val |= MAX_RX_PKT_LEN_1522; ++ } else if (length <= 1536) { ++ val |= MAX_RX_PKT_LEN_1536; ++ } else if (length <= 1552) { ++ val |= MAX_RX_PKT_LEN_1552; ++ } else { ++ val &= ~MAX_RX_JUMBO_MASK; ++ val |= MAX_RX_JUMBO(DIV_ROUND_UP(length, 1024)); ++ val |= MAX_RX_PKT_LEN_JUMBO; ++ } ++ ++ mt7530_mii_write(priv, MT7530_GMACCR, val); ++ ++ mutex_unlock(&bus->mdio_lock); ++ ++ return 0; ++} ++ ++static int ++mt7530_port_max_mtu(struct dsa_switch *ds, int port) ++{ ++ return MT7530_MAX_MTU; ++} ++ + static void + mt7530_stp_state_set(struct dsa_switch *ds, int port, u8 state) + { +@@ -2652,6 +2699,8 @@ static const struct dsa_switch_ops mt753 + .get_sset_count = mt7530_get_sset_count, + .port_enable = mt7530_port_enable, + .port_disable = mt7530_port_disable, ++ .port_change_mtu = mt7530_port_change_mtu, ++ .port_max_mtu = mt7530_port_max_mtu, + .port_stp_state_set = mt7530_stp_state_set, + .port_bridge_join = mt7530_port_bridge_join, + .port_bridge_leave = mt7530_port_bridge_leave, +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -11,6 +11,9 @@ + #define MT7530_NUM_FDB_RECORDS 2048 + #define MT7530_ALL_MEMBERS 0xff + ++#define MTK_HDR_LEN 4 ++#define MT7530_MAX_MTU (15 * 1024 - ETH_HLEN - ETH_FCS_LEN - MTK_HDR_LEN) ++ + enum mt753x_id { + ID_MT7530 = 0, + ID_MT7621 = 1, +@@ -301,6 +304,15 @@ enum mt7530_vlan_port_attr { + #define MT7531_DBG_CNT(x) (0x3018 + (x) * 0x100) + #define MT7531_DIS_CLR BIT(31) + ++#define MT7530_GMACCR 0x30e0 ++#define MAX_RX_JUMBO(x) ((x) << 2) ++#define MAX_RX_JUMBO_MASK GENMASK(5, 2) ++#define MAX_RX_PKT_LEN_MASK GENMASK(1, 0) ++#define MAX_RX_PKT_LEN_1522 0x0 ++#define MAX_RX_PKT_LEN_1536 0x1 ++#define MAX_RX_PKT_LEN_1552 0x2 ++#define MAX_RX_PKT_LEN_JUMBO 0x3 ++ + /* Register for MIB */ + #define MT7530_PORT_MIB_COUNTER(x) (0x4000 + (x) * 0x100) + #define MT7530_MIB_CCR 0x4fe0 diff --git a/target/linux/generic/backport-5.10/763-v5.11-net-dsa-mt7530-enable-MTU-normalization.patch b/target/linux/generic/backport-5.10/763-v5.11-net-dsa-mt7530-enable-MTU-normalization.patch new file mode 100644 index 0000000000..b0ad7b9f87 --- /dev/null +++ b/target/linux/generic/backport-5.10/763-v5.11-net-dsa-mt7530-enable-MTU-normalization.patch @@ -0,0 +1,36 @@ +From 771c8901568dd8776a260aa93db41be88a60389e Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Fri, 11 Dec 2020 01:03:22 +0800 +Subject: [PATCH] net: dsa: mt7530: enable MTU normalization + +MT7530 has a global RX length register, so we are actually changing its +MRU. +Enable MTU normalization for this reason. + +Signed-off-by: DENG Qingfang +Acked-by: Landen Chao +Reviewed-by: Vladimir Oltean +Link: https://lore.kernel.org/r/20201210170322.3433-1-dqfext@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/mt7530.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1703,6 +1703,7 @@ mt7530_setup(struct dsa_switch *ds) + */ + dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; + ds->configure_vlan_while_not_filtering = true; ++ ds->mtu_enforcement_ingress = true; + + if (priv->id == ID_MT7530) { + regulator_set_voltage(priv->core_pwr, 1000000, 1000000); +@@ -1947,6 +1948,7 @@ mt7531_setup(struct dsa_switch *ds) + } + + ds->configure_vlan_while_not_filtering = true; ++ ds->mtu_enforcement_ingress = true; + + /* Flush the FDB table */ + ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); From 4834565bb4ebb9a0089afb047eea091346a91952 Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Thu, 3 Feb 2022 20:07:01 +0800 Subject: [PATCH 112/144] kernel: backport MT7530 ageing time support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow setting ageing time from 1 to 1,048,576 seconds. Signed-off-by: DENG Qingfang Tested-by: Arınç ÜNAL Tested-by: Stijn Tintel --- ...a-mt7530-support-setting-ageing-time.patch | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 target/linux/generic/backport-5.10/764-v5.11-net-dsa-mt7530-support-setting-ageing-time.patch diff --git a/target/linux/generic/backport-5.10/764-v5.11-net-dsa-mt7530-support-setting-ageing-time.patch b/target/linux/generic/backport-5.10/764-v5.11-net-dsa-mt7530-support-setting-ageing-time.patch new file mode 100644 index 0000000000..44fa40eabe --- /dev/null +++ b/target/linux/generic/backport-5.10/764-v5.11-net-dsa-mt7530-support-setting-ageing-time.patch @@ -0,0 +1,99 @@ +From ea6d5c924e391872d402acac38461a5f8261e57f Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Tue, 8 Dec 2020 15:00:28 +0800 +Subject: [PATCH] net: dsa: mt7530: support setting ageing time + +MT7530 has a global address age control register, so use it to set +ageing time. + +The applied timer is (AGE_CNT + 1) * (AGE_UNIT + 1) seconds + +Signed-off-by: DENG Qingfang +Reviewed-by: Andrew Lunn +Reviewed-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 41 ++++++++++++++++++++++++++++++++++++++++ + drivers/net/dsa/mt7530.h | 13 +++++++++++++ + 2 files changed, 54 insertions(+) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -870,6 +870,46 @@ mt7530_get_sset_count(struct dsa_switch + return ARRAY_SIZE(mt7530_mib); + } + ++static int ++mt7530_set_ageing_time(struct dsa_switch *ds, unsigned int msecs) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ unsigned int secs = msecs / 1000; ++ unsigned int tmp_age_count; ++ unsigned int error = -1; ++ unsigned int age_count; ++ unsigned int age_unit; ++ ++ /* Applied timer is (AGE_CNT + 1) * (AGE_UNIT + 1) seconds */ ++ if (secs < 1 || secs > (AGE_CNT_MAX + 1) * (AGE_UNIT_MAX + 1)) ++ return -ERANGE; ++ ++ /* iterate through all possible age_count to find the closest pair */ ++ for (tmp_age_count = 0; tmp_age_count <= AGE_CNT_MAX; ++tmp_age_count) { ++ unsigned int tmp_age_unit = secs / (tmp_age_count + 1) - 1; ++ ++ if (tmp_age_unit <= AGE_UNIT_MAX) { ++ unsigned int tmp_error = secs - ++ (tmp_age_count + 1) * (tmp_age_unit + 1); ++ ++ /* found a closer pair */ ++ if (error > tmp_error) { ++ error = tmp_error; ++ age_count = tmp_age_count; ++ age_unit = tmp_age_unit; ++ } ++ ++ /* found the exact match, so break the loop */ ++ if (!error) ++ break; ++ } ++ } ++ ++ mt7530_write(priv, MT7530_AAC, AGE_CNT(age_count) | AGE_UNIT(age_unit)); ++ ++ return 0; ++} ++ + static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) + { + struct mt7530_priv *priv = ds->priv; +@@ -2699,6 +2739,7 @@ static const struct dsa_switch_ops mt753 + .phy_write = mt753x_phy_write, + .get_ethtool_stats = mt7530_get_ethtool_stats, + .get_sset_count = mt7530_get_sset_count, ++ .set_ageing_time = mt7530_set_ageing_time, + .port_enable = mt7530_port_enable, + .port_disable = mt7530_port_disable, + .port_change_mtu = mt7530_port_change_mtu, +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -161,6 +161,19 @@ enum mt7530_vlan_egress_attr { + MT7530_VLAN_EGRESS_STACK = 3, + }; + ++/* Register for address age control */ ++#define MT7530_AAC 0xa0 ++/* Disable ageing */ ++#define AGE_DIS BIT(20) ++/* Age count */ ++#define AGE_CNT_MASK GENMASK(19, 12) ++#define AGE_CNT_MAX 0xff ++#define AGE_CNT(x) (AGE_CNT_MASK & ((x) << 12)) ++/* Age unit */ ++#define AGE_UNIT_MASK GENMASK(11, 0) ++#define AGE_UNIT_MAX 0xfff ++#define AGE_UNIT(x) (AGE_UNIT_MASK & (x)) ++ + /* Register for port STP state control */ + #define MT7530_SSP_P(x) (0x2000 + ((x) * 0x100)) + #define FID_PST(x) ((x) & 0x3) From ee6ba216d8ba1b02154c287e64d709a8bc7b0054 Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Thu, 3 Feb 2022 20:07:02 +0800 Subject: [PATCH 113/144] kernel: backport MT7530 VLAN fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix FDB learning bugs when VLAN filtering is enabled. Signed-off-by: DENG Qingfang Tested-by: Arınç ÜNAL Tested-by: Stijn Tintel --- ...disable-learning-on-standalone-ports.patch | 65 +++++ ...enable-assisted-learning-on-CPU-port.patch | 102 +++++++ ...se-independent-VLAN-learning-on-VLAN.patch | 262 ++++++++++++++++++ ...-mt7530-set-STP-state-on-filter-ID-1.patch | 40 +++ ...lways-install-FDB-entries-with-IVL-a.patch | 54 ++++ 5 files changed, 523 insertions(+) create mode 100644 target/linux/generic/backport-5.10/765-v5.15-net-dsa-mt7530-disable-learning-on-standalone-ports.patch create mode 100644 target/linux/generic/backport-5.10/766-v5.15-net-dsa-mt7530-enable-assisted-learning-on-CPU-port.patch create mode 100644 target/linux/generic/backport-5.10/767-v5.15-net-dsa-mt7530-use-independent-VLAN-learning-on-VLAN.patch create mode 100644 target/linux/generic/backport-5.10/768-v5.15-net-dsa-mt7530-set-STP-state-on-filter-ID-1.patch create mode 100644 target/linux/generic/backport-5.10/769-v5.15-net-dsa-mt7530-always-install-FDB-entries-with-IVL-a.patch diff --git a/target/linux/generic/backport-5.10/765-v5.15-net-dsa-mt7530-disable-learning-on-standalone-ports.patch b/target/linux/generic/backport-5.10/765-v5.15-net-dsa-mt7530-disable-learning-on-standalone-ports.patch new file mode 100644 index 0000000000..a0bb7fa888 --- /dev/null +++ b/target/linux/generic/backport-5.10/765-v5.15-net-dsa-mt7530-disable-learning-on-standalone-ports.patch @@ -0,0 +1,65 @@ +From ba2203f36b981235556504fb7b62baee28512a40 Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Tue, 24 Aug 2021 11:37:50 +0800 +Subject: [PATCH] net: dsa: mt7530: disable learning on standalone ports + +This is a partial backport of commit 5a30833b9a16f8d1aa15de06636f9317ca51f9df +("net: dsa: mt7530: support MDB and bridge flag operations") upstream. + +Make sure that the standalone ports start up with learning disabled. + +Signed-off-by: DENG Qingfang +--- + drivers/net/dsa/mt7530.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1163,6 +1163,8 @@ mt7530_port_bridge_join(struct dsa_switc + PCR_MATRIX_MASK, PCR_MATRIX(port_bitmap)); + priv->ports[port].pm |= PCR_MATRIX(port_bitmap); + ++ mt7530_clear(priv, MT7530_PSC_P(port), SA_DIS); ++ + mutex_unlock(&priv->reg_mutex); + + return 0; +@@ -1260,6 +1262,8 @@ mt7530_port_bridge_leave(struct dsa_swit + PCR_MATRIX(BIT(MT7530_CPU_PORT))); + priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT)); + ++ mt7530_set(priv, MT7530_PSC_P(port), SA_DIS); ++ + mutex_unlock(&priv->reg_mutex); + } + +@@ -1817,9 +1821,13 @@ mt7530_setup(struct dsa_switch *ds) + ret = mt753x_cpu_port_enable(ds, i); + if (ret) + return ret; +- } else ++ } else { + mt7530_port_disable(ds, i); + ++ /* Disable learning by default on all user ports */ ++ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); ++ } ++ + /* Enable consistent egress tag */ + mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, + PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); +@@ -1979,9 +1987,13 @@ mt7531_setup(struct dsa_switch *ds) + ret = mt753x_cpu_port_enable(ds, i); + if (ret) + return ret; +- } else ++ } else { + mt7530_port_disable(ds, i); + ++ /* Disable learning by default on all user ports */ ++ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); ++ } ++ + /* Enable consistent egress tag */ + mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, + PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); diff --git a/target/linux/generic/backport-5.10/766-v5.15-net-dsa-mt7530-enable-assisted-learning-on-CPU-port.patch b/target/linux/generic/backport-5.10/766-v5.15-net-dsa-mt7530-enable-assisted-learning-on-CPU-port.patch new file mode 100644 index 0000000000..f376ff949a --- /dev/null +++ b/target/linux/generic/backport-5.10/766-v5.15-net-dsa-mt7530-enable-assisted-learning-on-CPU-port.patch @@ -0,0 +1,102 @@ +From 59c8adbc8e2c7f6b46385f36962eadaad3ea2daa Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Wed, 4 Aug 2021 00:04:01 +0800 +Subject: [PATCH] net: dsa: mt7530: enable assisted learning on CPU port + +Consider the following bridge configuration, where bond0 is not +offloaded: + + +-- br0 --+ + / / | \ + / / | \ + / | | bond0 + / | | / \ + swp0 swp1 swp2 swp3 swp4 + . . . + . . . + A B C + +Address learning is enabled on offloaded ports (swp0~2) and the CPU +port, so when client A sends a packet to C, the following will happen: + +1. The switch learns that client A can be reached at swp0. +2. The switch probably already knows that client C can be reached at the + CPU port, so it forwards the packet to the CPU. +3. The bridge core knows client C can be reached at bond0, so it + forwards the packet back to the switch. +4. The switch learns that client A can be reached at the CPU port. +5. The switch forwards the packet to either swp3 or swp4, according to + the packet's tag. + +That makes client A's MAC address flap between swp0 and the CPU port. If +client B sends a packet to A, it is possible that the packet is +forwarded to the CPU. With offload_fwd_mark = 1, the bridge core won't +forward it back to the switch, resulting in packet loss. + +As we have the assisted_learning_on_cpu_port in DSA core now, enable +that and disable hardware learning on the CPU port. + +Signed-off-by: DENG Qingfang +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1747,6 +1747,7 @@ mt7530_setup(struct dsa_switch *ds) + */ + dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; + ds->configure_vlan_while_not_filtering = true; ++ ds->assisted_learning_on_cpu_port = true; + ds->mtu_enforcement_ingress = true; + + if (priv->id == ID_MT7530) { +@@ -1817,15 +1818,15 @@ mt7530_setup(struct dsa_switch *ds) + mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, + PCR_MATRIX_CLR); + ++ /* Disable learning by default on all ports */ ++ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); ++ + if (dsa_is_cpu_port(ds, i)) { + ret = mt753x_cpu_port_enable(ds, i); + if (ret) + return ret; + } else { + mt7530_port_disable(ds, i); +- +- /* Disable learning by default on all user ports */ +- mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); + } + + /* Enable consistent egress tag */ +@@ -1981,6 +1982,9 @@ mt7531_setup(struct dsa_switch *ds) + mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, + PCR_MATRIX_CLR); + ++ /* Disable learning by default on all ports */ ++ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); ++ + mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); + + if (dsa_is_cpu_port(ds, i)) { +@@ -1989,9 +1993,6 @@ mt7531_setup(struct dsa_switch *ds) + return ret; + } else { + mt7530_port_disable(ds, i); +- +- /* Disable learning by default on all user ports */ +- mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); + } + + /* Enable consistent egress tag */ +@@ -2000,6 +2001,7 @@ mt7531_setup(struct dsa_switch *ds) + } + + ds->configure_vlan_while_not_filtering = true; ++ ds->assisted_learning_on_cpu_port = true; + ds->mtu_enforcement_ingress = true; + + /* Flush the FDB table */ diff --git a/target/linux/generic/backport-5.10/767-v5.15-net-dsa-mt7530-use-independent-VLAN-learning-on-VLAN.patch b/target/linux/generic/backport-5.10/767-v5.15-net-dsa-mt7530-use-independent-VLAN-learning-on-VLAN.patch new file mode 100644 index 0000000000..f9fe0ef858 --- /dev/null +++ b/target/linux/generic/backport-5.10/767-v5.15-net-dsa-mt7530-use-independent-VLAN-learning-on-VLAN.patch @@ -0,0 +1,262 @@ +From e3a402764c5753698e7a9e45d4d21f093faa7852 Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Wed, 4 Aug 2021 00:04:02 +0800 +Subject: [PATCH] net: dsa: mt7530: use independent VLAN learning on + VLAN-unaware bridges + +Consider the following bridge configuration, where bond0 is not +offloaded: + + +-- br0 --+ + / / | \ + / / | \ + / | | bond0 + / | | / \ + swp0 swp1 swp2 swp3 swp4 + . . . + . . . + A B C + +Ideally, when the switch receives a packet from swp3 or swp4, it should +forward the packet to the CPU, according to the port matrix and unknown +unicast flood settings. + +But packet loss will happen if the destination address is at one of the +offloaded ports (swp0~2). For example, when client C sends a packet to +A, the FDB lookup will indicate that it should be forwarded to swp0, but +the port matrix of swp3 and swp4 is configured to only allow the CPU to +be its destination, so it is dropped. + +However, this issue does not happen if the bridge is VLAN-aware. That is +because VLAN-aware bridges use independent VLAN learning, i.e. use VID +for FDB lookup, on offloaded ports. As swp3 and swp4 are not offloaded, +shared VLAN learning with default filter ID of 0 is used instead. So the +lookup for A with filter ID 0 never hits and the packet can be forwarded +to the CPU. + +In the current code, only two combinations were used to toggle user +ports' VLAN awareness: one is PCR.PORT_VLAN set to port matrix mode with +PVC.VLAN_ATTR set to transparent port, the other is PCR.PORT_VLAN set to +security mode with PVC.VLAN_ATTR set to user port. + +It turns out that only PVC.VLAN_ATTR contributes to VLAN awareness, and +port matrix mode just skips the VLAN table lookup. The reference manual +is somehow misleading when describing PORT_VLAN modes. It states that +PORT_MEM (VLAN port member) is used for destination if the VLAN table +lookup hits, but actually **PORT_MEM & PORT_MATRIX** (bitwise AND of +VLAN port member and port matrix) is used instead, which means we can +have two or more separate VLAN-aware bridges with the same PVID and +traffic won't leak between them. + +Therefore, to solve this, enable independent VLAN learning with PVID 0 +on VLAN-unaware bridges, by setting their PCR.PORT_VLAN to fallback +mode, while leaving standalone ports in port matrix mode. The CPU port +is always set to fallback mode to serve those bridges. + +During testing, it is found that FDB lookup with filter ID of 0 will +also hit entries with VID 0 even with independent VLAN learning. To +avoid that, install all VLANs with filter ID of 1. + +Signed-off-by: DENG Qingfang +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 72 +++++++++++++++++++++++++++++----------- + drivers/net/dsa/mt7530.h | 9 ++++- + 2 files changed, 60 insertions(+), 21 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1011,6 +1011,10 @@ mt753x_cpu_port_enable(struct dsa_switch + mt7530_write(priv, MT7530_PCR_P(port), + PCR_MATRIX(dsa_user_ports(priv->ds))); + ++ /* Set to fallback mode for independent VLAN learning */ ++ mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, ++ MT7530_PORT_FALLBACK_MODE); ++ + return 0; + } + +@@ -1165,6 +1169,10 @@ mt7530_port_bridge_join(struct dsa_switc + + mt7530_clear(priv, MT7530_PSC_P(port), SA_DIS); + ++ /* Set to fallback mode for independent VLAN learning */ ++ mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, ++ MT7530_PORT_FALLBACK_MODE); ++ + mutex_unlock(&priv->reg_mutex); + + return 0; +@@ -1177,16 +1185,21 @@ mt7530_port_set_vlan_unaware(struct dsa_ + bool all_user_ports_removed = true; + int i; + +- /* When a port is removed from the bridge, the port would be set up +- * back to the default as is at initial boot which is a VLAN-unaware +- * port. ++ /* This is called after .port_bridge_leave when leaving a VLAN-aware ++ * bridge. Don't set standalone ports to fallback mode. + */ +- mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, +- MT7530_PORT_MATRIX_MODE); ++ if (dsa_to_port(ds, port)->bridge_dev) ++ mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, ++ MT7530_PORT_FALLBACK_MODE); ++ + mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK, + VLAN_ATTR(MT7530_VLAN_TRANSPARENT) | + PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); + ++ /* Set PVID to 0 */ ++ mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, ++ G0_PORT_VID_DEF); ++ + for (i = 0; i < MT7530_NUM_PORTS; i++) { + if (dsa_is_user_port(ds, i) && + dsa_port_is_vlan_filtering(dsa_to_port(ds, i))) { +@@ -1212,15 +1225,14 @@ mt7530_port_set_vlan_aware(struct dsa_sw + struct mt7530_priv *priv = ds->priv; + + /* Trapped into security mode allows packet forwarding through VLAN +- * table lookup. CPU port is set to fallback mode to let untagged +- * frames pass through. ++ * table lookup. + */ +- if (dsa_is_cpu_port(ds, port)) +- mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, +- MT7530_PORT_FALLBACK_MODE); +- else ++ if (dsa_is_user_port(ds, port)) { + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, + MT7530_PORT_SECURITY_MODE); ++ mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, ++ G0_PORT_VID(priv->ports[port].pvid)); ++ } + + /* Set the port as a user port which is to be able to recognize VID + * from incoming packets before fetching entry within the VLAN table. +@@ -1264,6 +1276,13 @@ mt7530_port_bridge_leave(struct dsa_swit + + mt7530_set(priv, MT7530_PSC_P(port), SA_DIS); + ++ /* When a port is removed from the bridge, the port would be set up ++ * back to the default as is at initial boot which is a VLAN-unaware ++ * port. ++ */ ++ mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, ++ MT7530_PORT_MATRIX_MODE); ++ + mutex_unlock(&priv->reg_mutex); + } + +@@ -1406,7 +1425,8 @@ mt7530_hw_vlan_add(struct mt7530_priv *p + /* Validate the entry with independent learning, create egress tag per + * VLAN and joining the port as one of the port members. + */ +- val = IVL_MAC | VTAG_EN | PORT_MEM(new_members) | VLAN_VALID; ++ val = IVL_MAC | VTAG_EN | PORT_MEM(new_members) | FID(FID_BRIDGED) | ++ VLAN_VALID; + mt7530_write(priv, MT7530_VAWD1, val); + + /* Decide whether adding tag or not for those outgoing packets from the +@@ -1499,9 +1519,13 @@ mt7530_port_vlan_add(struct dsa_switch * + } + + if (pvid) { +- mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, +- G0_PORT_VID(vlan->vid_end)); + priv->ports[port].pvid = vlan->vid_end; ++ ++ /* Only configure PVID if VLAN filtering is enabled */ ++ if (dsa_port_is_vlan_filtering(dsa_to_port(ds, port))) ++ mt7530_rmw(priv, MT7530_PPBV1_P(port), ++ G0_PORT_VID_MASK, ++ G0_PORT_VID(vlan->vid_end)); + } + + mutex_unlock(&priv->reg_mutex); +@@ -1513,11 +1537,10 @@ mt7530_port_vlan_del(struct dsa_switch * + { + struct mt7530_hw_vlan_entry target_entry; + struct mt7530_priv *priv = ds->priv; +- u16 vid, pvid; ++ u16 vid; + + mutex_lock(&priv->reg_mutex); + +- pvid = priv->ports[port].pvid; + for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { + mt7530_hw_vlan_entry_init(&target_entry, port, 0); + mt7530_hw_vlan_update(priv, vid, &target_entry, +@@ -1526,12 +1549,13 @@ mt7530_port_vlan_del(struct dsa_switch * + /* PVID is being restored to the default whenever the PVID port + * is being removed from the VLAN. + */ +- if (pvid == vid) +- pvid = G0_PORT_VID_DEF; ++ if (priv->ports[port].pvid == vid) { ++ priv->ports[port].pvid = G0_PORT_VID_DEF; ++ mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, ++ G0_PORT_VID_DEF); ++ } + } + +- mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, pvid); +- priv->ports[port].pvid = pvid; + + mutex_unlock(&priv->reg_mutex); + +@@ -1827,6 +1851,10 @@ mt7530_setup(struct dsa_switch *ds) + return ret; + } else { + mt7530_port_disable(ds, i); ++ ++ /* Set default PVID to 0 on all user ports */ ++ mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, ++ G0_PORT_VID_DEF); + } + + /* Enable consistent egress tag */ +@@ -1993,6 +2021,10 @@ mt7531_setup(struct dsa_switch *ds) + return ret; + } else { + mt7530_port_disable(ds, i); ++ ++ /* Set default PVID to 0 on all user ports */ ++ mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, ++ G0_PORT_VID_DEF); + } + + /* Enable consistent egress tag */ +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -145,11 +145,18 @@ enum mt7530_vlan_cmd { + #define VTAG_EN BIT(28) + /* VLAN Member Control */ + #define PORT_MEM(x) (((x) & 0xff) << 16) ++/* Filter ID */ ++#define FID(x) (((x) & 0x7) << 1) + /* VLAN Entry Valid */ + #define VLAN_VALID BIT(0) + #define PORT_MEM_SHFT 16 + #define PORT_MEM_MASK 0xff + ++enum mt7530_fid { ++ FID_STANDALONE = 0, ++ FID_BRIDGED = 1, ++}; ++ + #define MT7530_VAWD2 0x98 + /* Egress Tag Control */ + #define ETAG_CTRL_P(p, x) (((x) & 0x3) << ((p) << 1)) +@@ -244,7 +251,7 @@ enum mt7530_vlan_port_attr { + #define MT7530_PPBV1_P(x) (0x2014 + ((x) * 0x100)) + #define G0_PORT_VID(x) (((x) & 0xfff) << 0) + #define G0_PORT_VID_MASK G0_PORT_VID(0xfff) +-#define G0_PORT_VID_DEF G0_PORT_VID(1) ++#define G0_PORT_VID_DEF G0_PORT_VID(0) + + /* Register for port MAC control register */ + #define MT7530_PMCR_P(x) (0x3000 + ((x) * 0x100)) diff --git a/target/linux/generic/backport-5.10/768-v5.15-net-dsa-mt7530-set-STP-state-on-filter-ID-1.patch b/target/linux/generic/backport-5.10/768-v5.15-net-dsa-mt7530-set-STP-state-on-filter-ID-1.patch new file mode 100644 index 0000000000..2c1958bd43 --- /dev/null +++ b/target/linux/generic/backport-5.10/768-v5.15-net-dsa-mt7530-set-STP-state-on-filter-ID-1.patch @@ -0,0 +1,40 @@ +From c5ffcefcb40420528d04c63e7dfc88f2845c9831 Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Wed, 4 Aug 2021 00:04:03 +0800 +Subject: [PATCH] net: dsa: mt7530: set STP state on filter ID 1 + +As filter ID 1 is the only one used for bridges, set STP state on it. + +Signed-off-by: DENG Qingfang +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 3 ++- + drivers/net/dsa/mt7530.h | 4 ++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1131,7 +1131,8 @@ mt7530_stp_state_set(struct dsa_switch * + break; + } + +- mt7530_rmw(priv, MT7530_SSP_P(port), FID_PST_MASK, stp_state); ++ mt7530_rmw(priv, MT7530_SSP_P(port), FID_PST_MASK(FID_BRIDGED), ++ FID_PST(FID_BRIDGED, stp_state)); + } + + static int +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -183,8 +183,8 @@ enum mt7530_vlan_egress_attr { + + /* Register for port STP state control */ + #define MT7530_SSP_P(x) (0x2000 + ((x) * 0x100)) +-#define FID_PST(x) ((x) & 0x3) +-#define FID_PST_MASK FID_PST(0x3) ++#define FID_PST(fid, state) (((state) & 0x3) << ((fid) * 2)) ++#define FID_PST_MASK(fid) FID_PST(fid, 0x3) + + enum mt7530_stp_state { + MT7530_STP_DISABLED = 0, diff --git a/target/linux/generic/backport-5.10/769-v5.15-net-dsa-mt7530-always-install-FDB-entries-with-IVL-a.patch b/target/linux/generic/backport-5.10/769-v5.15-net-dsa-mt7530-always-install-FDB-entries-with-IVL-a.patch new file mode 100644 index 0000000000..97824068f0 --- /dev/null +++ b/target/linux/generic/backport-5.10/769-v5.15-net-dsa-mt7530-always-install-FDB-entries-with-IVL-a.patch @@ -0,0 +1,54 @@ +From 138c126a33f7564edb66b1da5b847e4a60740bfc Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Wed, 4 Aug 2021 00:04:04 +0800 +Subject: [PATCH] net: dsa: mt7530: always install FDB entries with IVL and FID + 1 + +This reverts commit 7e777021780e ("mt7530 mt7530_fdb_write only set ivl +bit vid larger than 1"). + +Before this series, the default value of all ports' PVID is 1, which is +copied into the FDB entry, even if the ports are VLAN unaware. So +`bridge fdb show` will show entries like `dev swp0 vlan 1 self` even on +a VLAN-unaware bridge. + +The blamed commit does not solve that issue completely, instead it may +cause a new issue that FDB is inaccessible in a VLAN-aware bridge with +PVID 1. + +This series sets PVID to 0 on VLAN-unaware ports, so `bridge fdb show` +will no longer print `vlan 1` on VLAN-unaware bridges, and that special +case in fdb_write is not required anymore. + +Set FDB entries' filter ID to 1 to match the VLAN table. + +Signed-off-by: DENG Qingfang +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/mt7530.c | 2 ++ + drivers/net/dsa/mt7530.h | 2 ++ + 2 files changed, 4 insertions(+) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -361,6 +361,8 @@ mt7530_fdb_write(struct mt7530_priv *pri + int i; + + reg[1] |= vid & CVID_MASK; ++ reg[1] |= ATA2_IVL; ++ reg[1] |= ATA2_FID(FID_BRIDGED); + reg[2] |= (aging & AGE_TIMER_MASK) << AGE_TIMER; + reg[2] |= (port_mask & PORT_MAP_MASK) << PORT_MAP; + /* STATIC_ENT indicate that entry is static wouldn't +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -77,6 +77,8 @@ enum mt753x_bpdu_port_fw { + #define STATIC_EMP 0 + #define STATIC_ENT 3 + #define MT7530_ATA2 0x78 ++#define ATA2_IVL BIT(15) ++#define ATA2_FID(x) (((x) & 0x7) << 12) + + /* Register for address table write data */ + #define MT7530_ATWD 0x7c From d5f447250953288aca213c43a45f127b2c303baa Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Thu, 3 Feb 2022 20:07:03 +0800 Subject: [PATCH 114/144] kernel: backport MT7530 MDB operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use hardware to forward multicast traffic instead of trapping to the host. Signed-off-by: DENG Qingfang Tested-by: Arınç ÜNAL Tested-by: Stijn Tintel --- ...et-dsa-mt7530-support-MDB-operations.patch | 171 ++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 target/linux/generic/backport-5.10/770-v5.15-net-dsa-mt7530-support-MDB-operations.patch diff --git a/target/linux/generic/backport-5.10/770-v5.15-net-dsa-mt7530-support-MDB-operations.patch b/target/linux/generic/backport-5.10/770-v5.15-net-dsa-mt7530-support-MDB-operations.patch new file mode 100644 index 0000000000..5d91d5a657 --- /dev/null +++ b/target/linux/generic/backport-5.10/770-v5.15-net-dsa-mt7530-support-MDB-operations.patch @@ -0,0 +1,171 @@ +From 1f11a07a33bc26997c18b633d63f088bf75d11f2 Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Tue, 24 Aug 2021 11:37:50 +0800 +Subject: [PATCH] net: dsa: mt7530: support MDB operations + +This is a partial backport of commit 5a30833b9a16f8d1aa15de06636f9317ca51f9df +("net: dsa: mt7530: support MDB and bridge flag operations") upstream. + +Signed-off-by: DENG Qingfang +--- + drivers/net/dsa/mt7530.c | 78 ++++++++++++++++++++++++++++++++++++++-- + net/dsa/tag_mtk.c | 14 +------- + 2 files changed, 76 insertions(+), 16 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1000,9 +1000,6 @@ mt753x_cpu_port_enable(struct dsa_switch + mt7530_write(priv, MT7530_PVC_P(port), + PORT_SPEC_TAG); + +- /* Unknown multicast frame forwarding to the cpu port */ +- mt7530_rmw(priv, MT7530_MFC, UNM_FFP_MASK, UNM_FFP(BIT(port))); +- + /* Set CPU port number */ + if (priv->id == ID_MT7621) + mt7530_rmw(priv, MT7530_MFC, CPU_MASK, CPU_EN | CPU_PORT(port)); +@@ -1138,6 +1135,20 @@ mt7530_stp_state_set(struct dsa_switch * + } + + static int ++mt7530_port_egress_floods(struct dsa_switch *ds, int port, ++ bool unicast, bool multicast) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ ++ mt7530_rmw(priv, MT7530_MFC, ++ UNU_FFP(BIT(port)) | UNM_FFP(BIT(port)), ++ (unicast ? UNU_FFP(BIT(port)) : 0) | ++ (multicast ? UNM_FFP(BIT(port)) : 0)); ++ ++ return 0; ++} ++ ++static int + mt7530_port_bridge_join(struct dsa_switch *ds, int port, + struct net_device *bridge) + { +@@ -1357,6 +1368,63 @@ err: + } + + static int ++mt7530_port_mdb_prepare(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ return 0; ++} ++ ++static void ++mt7530_port_mdb_add(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ const u8 *addr = mdb->addr; ++ u16 vid = mdb->vid; ++ u8 port_mask = 0; ++ ++ mutex_lock(&priv->reg_mutex); ++ ++ mt7530_fdb_write(priv, vid, 0, addr, 0, STATIC_EMP); ++ if (!mt7530_fdb_cmd(priv, MT7530_FDB_READ, NULL)) ++ port_mask = (mt7530_read(priv, MT7530_ATRD) >> PORT_MAP) ++ & PORT_MAP_MASK; ++ ++ port_mask |= BIT(port); ++ mt7530_fdb_write(priv, vid, port_mask, addr, -1, STATIC_ENT); ++ mt7530_fdb_cmd(priv, MT7530_FDB_WRITE, NULL); ++ ++ mutex_unlock(&priv->reg_mutex); ++} ++ ++static int ++mt7530_port_mdb_del(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ const u8 *addr = mdb->addr; ++ u16 vid = mdb->vid; ++ u8 port_mask = 0; ++ int ret; ++ ++ mutex_lock(&priv->reg_mutex); ++ ++ mt7530_fdb_write(priv, vid, 0, addr, 0, STATIC_EMP); ++ if (!mt7530_fdb_cmd(priv, MT7530_FDB_READ, NULL)) ++ port_mask = (mt7530_read(priv, MT7530_ATRD) >> PORT_MAP) ++ & PORT_MAP_MASK; ++ ++ port_mask &= ~BIT(port); ++ mt7530_fdb_write(priv, vid, port_mask, addr, -1, ++ port_mask ? STATIC_ENT : STATIC_EMP); ++ ret = mt7530_fdb_cmd(priv, MT7530_FDB_WRITE, NULL); ++ ++ mutex_unlock(&priv->reg_mutex); ++ ++ return ret; ++} ++ ++static int + mt7530_vlan_cmd(struct mt7530_priv *priv, enum mt7530_vlan_cmd cmd, u16 vid) + { + struct mt7530_dummy_poll p; +@@ -2794,11 +2862,15 @@ static const struct dsa_switch_ops mt753 + .port_change_mtu = mt7530_port_change_mtu, + .port_max_mtu = mt7530_port_max_mtu, + .port_stp_state_set = mt7530_stp_state_set, ++ .port_egress_floods = mt7530_port_egress_floods, + .port_bridge_join = mt7530_port_bridge_join, + .port_bridge_leave = mt7530_port_bridge_leave, + .port_fdb_add = mt7530_port_fdb_add, + .port_fdb_del = mt7530_port_fdb_del, + .port_fdb_dump = mt7530_port_fdb_dump, ++ .port_mdb_prepare = mt7530_port_mdb_prepare, ++ .port_mdb_add = mt7530_port_mdb_add, ++ .port_mdb_del = mt7530_port_mdb_del, + .port_vlan_filtering = mt7530_port_vlan_filtering, + .port_vlan_prepare = mt7530_port_vlan_prepare, + .port_vlan_add = mt7530_port_vlan_add, +--- a/net/dsa/tag_mtk.c ++++ b/net/dsa/tag_mtk.c +@@ -24,9 +24,6 @@ static struct sk_buff *mtk_tag_xmit(stru + struct dsa_port *dp = dsa_slave_to_port(dev); + u8 xmit_tpid; + u8 *mtk_tag; +- unsigned char *dest = eth_hdr(skb)->h_dest; +- bool is_multicast_skb = is_multicast_ether_addr(dest) && +- !is_broadcast_ether_addr(dest); + + /* Build the special tag after the MAC Source Address. If VLAN header + * is present, it's required that VLAN header and special tag is +@@ -55,10 +52,6 @@ static struct sk_buff *mtk_tag_xmit(stru + mtk_tag[0] = xmit_tpid; + mtk_tag[1] = (1 << dp->index) & MTK_HDR_XMIT_DP_BIT_MASK; + +- /* Disable SA learning for multicast frames */ +- if (unlikely(is_multicast_skb)) +- mtk_tag[1] |= MTK_HDR_XMIT_SA_DIS; +- + /* Tag control information is kept for 802.1Q */ + if (xmit_tpid == MTK_HDR_XMIT_UNTAGGED) { + mtk_tag[2] = 0; +@@ -74,9 +67,6 @@ static struct sk_buff *mtk_tag_rcv(struc + u16 hdr; + int port; + __be16 *phdr; +- unsigned char *dest = eth_hdr(skb)->h_dest; +- bool is_multicast_skb = is_multicast_ether_addr(dest) && +- !is_broadcast_ether_addr(dest); + + if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN))) + return NULL; +@@ -102,9 +92,7 @@ static struct sk_buff *mtk_tag_rcv(struc + if (!skb->dev) + return NULL; + +- /* Only unicast or broadcast frames are offloaded */ +- if (likely(!is_multicast_skb)) +- dsa_default_offload_fwd_mark(skb); ++ dsa_default_offload_fwd_mark(skb); + + return skb; + } From 8b4cba53a9402f44da2dced4a78ca065b15dca94 Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Thu, 3 Feb 2022 20:07:04 +0800 Subject: [PATCH 115/144] kernel: backport MediaTek Ethernet PHY driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for MediaTek Gigabit Ethernet PHYs found in MT7530. Fix some link up/down issues. Signed-off-by: DENG Qingfang Tested-by: Arınç ÜNAL Tested-by: Stijn Tintel --- ...MediaTek-Gigabit-Ethernet-PHY-driver.patch | 162 ++++++++++++++++++ target/linux/generic/config-5.10 | 1 + target/linux/mediatek/mt7622/config-5.10 | 1 + target/linux/mediatek/mt7623/config-5.10 | 1 + target/linux/ramips/mt7621/config-5.10 | 1 + 5 files changed, 166 insertions(+) create mode 100644 target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch diff --git a/target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch b/target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch new file mode 100644 index 0000000000..9e09e7ede3 --- /dev/null +++ b/target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch @@ -0,0 +1,162 @@ +From e40d2cca01893c1941f5959b14bb0cd0d4f4d099 Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Wed, 19 May 2021 11:31:59 +0800 +Subject: [PATCH] net: phy: add MediaTek Gigabit Ethernet PHY driver + +Add support for MediaTek Gigabit Ethernet PHYs found in MT7530 and +MT7531 switches. +The initialization procedure is from the vendor driver, but due to lack +of documentation, the function of some register values remains unknown. + +Signed-off-by: DENG Qingfang +Signed-off-by: David S. Miller +--- + drivers/net/phy/Kconfig | 5 ++ + drivers/net/phy/Makefile | 1 + + drivers/net/phy/mediatek-ge.c | 116 ++++++++++++++++++++++++++++++++++ + 3 files changed, 122 insertions(+) + create mode 100644 drivers/net/phy/mediatek-ge.c + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -201,6 +201,11 @@ config MARVELL_10G_PHY + help + Support for the Marvell Alaska MV88X3310 and compatible PHYs. + ++config MEDIATEK_GE_PHY ++ tristate "MediaTek PHYs" ++ help ++ Supports the MediaTek switch integrated PHYs. ++ + config MICREL_PHY + tristate "Micrel PHYs" + help +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -63,6 +63,7 @@ obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c + obj-$(CONFIG_LXT_PHY) += lxt.o + obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o + obj-$(CONFIG_MARVELL_PHY) += marvell.o ++obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o + obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o + obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o + obj-$(CONFIG_MICREL_PHY) += micrel.o +--- /dev/null ++++ b/drivers/net/phy/mediatek-ge.c +@@ -0,0 +1,116 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++#include ++#include ++#include ++ ++#define MTK_T10_TEST_CONTROL 0x145 ++#define MTK_PHY_TP_MASK GENMASK(4, 3) ++#define MTK_PHY_TP_AUTO 0 ++#define MTK_PHY_TP_MDI 2 ++#define MTK_PHY_TP_MDIX 3 ++ ++#define MTK_EXT_PAGE_ACCESS 0x1f ++#define MTK_PHY_PAGE_STANDARD 0x0000 ++#define MTK_PHY_PAGE_EXTENDED 0x0001 ++#define MTK_PHY_PAGE_EXTENDED_2 0x0002 ++#define MTK_PHY_PAGE_EXTENDED_3 0x0003 ++#define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30 ++#define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 ++ ++static int mtk_gephy_read_page(struct phy_device *phydev) ++{ ++ return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); ++} ++ ++static int mtk_gephy_write_page(struct phy_device *phydev, int page) ++{ ++ return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page); ++} ++ ++static void mtk_gephy_config_init(struct phy_device *phydev) ++{ ++ /* Disable EEE */ ++ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0); ++ ++ /* Enable HW auto downshift */ ++ phy_modify_paged(phydev, MTK_PHY_PAGE_EXTENDED, 0x14, 0, BIT(4)); ++ ++ /* Increase SlvDPSready time */ ++ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); ++ __phy_write(phydev, 0x10, 0xafae); ++ __phy_write(phydev, 0x12, 0x2f); ++ __phy_write(phydev, 0x10, 0x8fae); ++ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); ++ ++ /* Adjust 100_mse_threshold */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x123, 0xffff); ++ ++ /* Disable mcc */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0xa6, 0x300); ++} ++ ++static int mt7530_phy_config_init(struct phy_device *phydev) ++{ ++ mtk_gephy_config_init(phydev); ++ ++ /* Increase post_update_timer */ ++ phy_write_paged(phydev, MTK_PHY_PAGE_EXTENDED_3, 0x11, 0x4b); ++ ++ return 0; ++} ++ ++static int mt7531_phy_config_init(struct phy_device *phydev) ++{ ++ if (phydev->interface != PHY_INTERFACE_MODE_INTERNAL) ++ return -EINVAL; ++ ++ mtk_gephy_config_init(phydev); ++ ++ /* PHY link down power saving enable */ ++ phy_set_bits(phydev, 0x17, BIT(4)); ++ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, 0xc6, 0x300); ++ ++ /* Set TX Pair delay selection */ ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x13, 0x404); ++ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x14, 0x404); ++ ++ return 0; ++} ++ ++static struct phy_driver mtk_gephy_driver[] = { ++ { ++ PHY_ID_MATCH_EXACT(0x03a29412), ++ .name = "MediaTek MT7530 PHY", ++ .config_init = mt7530_phy_config_init, ++ /* Interrupts are handled by the switch, not the PHY ++ * itself. ++ */ ++ .config_intr = genphy_no_config_intr, ++ .ack_interrupt = genphy_no_ack_interrupt, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = mtk_gephy_read_page, ++ .write_page = mtk_gephy_write_page, ++ }, ++ { ++ PHY_ID_MATCH_EXACT(0x03a29441), ++ .name = "MediaTek MT7531 PHY", ++ .config_init = mt7531_phy_config_init, ++ /* Interrupts are handled by the switch, not the PHY ++ * itself. ++ */ ++ .config_intr = genphy_no_config_intr, ++ .ack_interrupt = genphy_no_ack_interrupt, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_page = mtk_gephy_read_page, ++ .write_page = mtk_gephy_write_page, ++ }, ++}; ++ ++module_phy_driver(mtk_gephy_driver); ++ ++static struct mdio_device_id __maybe_unused mtk_gephy_tbl[] = { ++ { PHY_ID_MATCH_VENDOR(0x03a29400) }, ++ { } ++}; diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index 30c48d521b..b04e25e4a4 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -3178,6 +3178,7 @@ CONFIG_MAY_USE_DEVLINK=y # CONFIG_MDIO_THUNDER is not set # CONFIG_MDIO_XPCS is not set # CONFIG_MD_FAULTY is not set +# CONFIG_MEDIATEK_GE_PHY is not set # CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set # CONFIG_MEDIA_ATTACH is not set # CONFIG_MEDIA_CAMERA_SUPPORT is not set diff --git a/target/linux/mediatek/mt7622/config-5.10 b/target/linux/mediatek/mt7622/config-5.10 index da1b283f70..85db8d142f 100644 --- a/target/linux/mediatek/mt7622/config-5.10 +++ b/target/linux/mediatek/mt7622/config-5.10 @@ -228,6 +228,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y diff --git a/target/linux/mediatek/mt7623/config-5.10 b/target/linux/mediatek/mt7623/config-5.10 index 09ecc16ef2..142ffd7998 100644 --- a/target/linux/mediatek/mt7623/config-5.10 +++ b/target/linux/mediatek/mt7623/config-5.10 @@ -368,6 +368,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_GPIO=y +CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y diff --git a/target/linux/ramips/mt7621/config-5.10 b/target/linux/ramips/mt7621/config-5.10 index 8a5e778e7e..fb56bd142a 100644 --- a/target/linux/ramips/mt7621/config-5.10 +++ b/target/linux/ramips/mt7621/config-5.10 @@ -114,6 +114,7 @@ CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y +CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y From 3f4301e123f29348b4ad87578d62b7d1f5f210c6 Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Thu, 3 Feb 2022 20:07:05 +0800 Subject: [PATCH 116/144] kernel: backport MT7530 IRQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support MT7530 PHY link change interrupts, and enable for MT7621. Signed-off-by: DENG Qingfang Tested-by: Arınç ÜNAL Tested-by: Stijn Tintel --- ...net-dsa-mt7530-add-interrupt-support.patch | 428 ++++++++++++++++++ target/linux/ramips/dts/mt7621.dtsi | 3 + 2 files changed, 431 insertions(+) create mode 100644 target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch diff --git a/target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch b/target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch new file mode 100644 index 0000000000..b0b3abf7a6 --- /dev/null +++ b/target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch @@ -0,0 +1,428 @@ +From ba751e28d44255744a30190faad0ca09b455c44d Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Wed, 19 May 2021 11:32:00 +0800 +Subject: [PATCH] net: dsa: mt7530: add interrupt support + +Add support for MT7530 interrupt controller to handle internal PHYs. +In order to assign an IRQ number to each PHY, the registration of MDIO bus +is also done in this driver. + +Signed-off-by: DENG Qingfang +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/Kconfig | 1 + + drivers/net/dsa/mt7530.c | 263 +++++++++++++++++++++++++++++++++++---- + drivers/net/dsa/mt7530.h | 21 +++- + 3 files changed, 256 insertions(+), 29 deletions(-) + +--- a/drivers/net/dsa/Kconfig ++++ b/drivers/net/dsa/Kconfig +@@ -36,6 +36,7 @@ config NET_DSA_MT7530 + tristate "MediaTek MT753x and MT7621 Ethernet switch support" + depends on NET_DSA + select NET_DSA_TAG_MTK ++ select MEDIATEK_GE_PHY + help + This enables support for the MediaTek MT7530, MT7531, and MT7621 + Ethernet switch chips. +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -602,18 +603,14 @@ mt7530_mib_reset(struct dsa_switch *ds) + mt7530_write(priv, MT7530_MIB_CCR, CCR_MIB_ACTIVATE); + } + +-static int mt7530_phy_read(struct dsa_switch *ds, int port, int regnum) ++static int mt7530_phy_read(struct mt7530_priv *priv, int port, int regnum) + { +- struct mt7530_priv *priv = ds->priv; +- + return mdiobus_read_nested(priv->bus, port, regnum); + } + +-static int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum, ++static int mt7530_phy_write(struct mt7530_priv *priv, int port, int regnum, + u16 val) + { +- struct mt7530_priv *priv = ds->priv; +- + return mdiobus_write_nested(priv->bus, port, regnum, val); + } + +@@ -791,9 +788,8 @@ out: + } + + static int +-mt7531_ind_phy_read(struct dsa_switch *ds, int port, int regnum) ++mt7531_ind_phy_read(struct mt7530_priv *priv, int port, int regnum) + { +- struct mt7530_priv *priv = ds->priv; + int devad; + int ret; + +@@ -809,10 +805,9 @@ mt7531_ind_phy_read(struct dsa_switch *d + } + + static int +-mt7531_ind_phy_write(struct dsa_switch *ds, int port, int regnum, ++mt7531_ind_phy_write(struct mt7530_priv *priv, int port, int regnum, + u16 data) + { +- struct mt7530_priv *priv = ds->priv; + int devad; + int ret; + +@@ -828,6 +823,22 @@ mt7531_ind_phy_write(struct dsa_switch * + return ret; + } + ++static int ++mt753x_phy_read(struct mii_bus *bus, int port, int regnum) ++{ ++ struct mt7530_priv *priv = bus->priv; ++ ++ return priv->info->phy_read(priv, port, regnum); ++} ++ ++static int ++mt753x_phy_write(struct mii_bus *bus, int port, int regnum, u16 val) ++{ ++ struct mt7530_priv *priv = bus->priv; ++ ++ return priv->info->phy_write(priv, port, regnum, val); ++} ++ + static void + mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset, + uint8_t *data) +@@ -1991,6 +2002,211 @@ mt7530_setup(struct dsa_switch *ds) + return 0; + } + ++static irqreturn_t ++mt7530_irq_thread_fn(int irq, void *dev_id) ++{ ++ struct mt7530_priv *priv = dev_id; ++ bool handled = false; ++ u32 val; ++ int p; ++ ++ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ val = mt7530_mii_read(priv, MT7530_SYS_INT_STS); ++ mt7530_mii_write(priv, MT7530_SYS_INT_STS, val); ++ mutex_unlock(&priv->bus->mdio_lock); ++ ++ for (p = 0; p < MT7530_NUM_PHYS; p++) { ++ if (BIT(p) & val) { ++ unsigned int irq; ++ ++ irq = irq_find_mapping(priv->irq_domain, p); ++ handle_nested_irq(irq); ++ handled = true; ++ } ++ } ++ ++ return IRQ_RETVAL(handled); ++} ++ ++static void ++mt7530_irq_mask(struct irq_data *d) ++{ ++ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); ++ ++ priv->irq_enable &= ~BIT(d->hwirq); ++} ++ ++static void ++mt7530_irq_unmask(struct irq_data *d) ++{ ++ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); ++ ++ priv->irq_enable |= BIT(d->hwirq); ++} ++ ++static void ++mt7530_irq_bus_lock(struct irq_data *d) ++{ ++ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); ++ ++ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++} ++ ++static void ++mt7530_irq_bus_sync_unlock(struct irq_data *d) ++{ ++ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); ++ ++ mt7530_mii_write(priv, MT7530_SYS_INT_EN, priv->irq_enable); ++ mutex_unlock(&priv->bus->mdio_lock); ++} ++ ++static struct irq_chip mt7530_irq_chip = { ++ .name = KBUILD_MODNAME, ++ .irq_mask = mt7530_irq_mask, ++ .irq_unmask = mt7530_irq_unmask, ++ .irq_bus_lock = mt7530_irq_bus_lock, ++ .irq_bus_sync_unlock = mt7530_irq_bus_sync_unlock, ++}; ++ ++static int ++mt7530_irq_map(struct irq_domain *domain, unsigned int irq, ++ irq_hw_number_t hwirq) ++{ ++ irq_set_chip_data(irq, domain->host_data); ++ irq_set_chip_and_handler(irq, &mt7530_irq_chip, handle_simple_irq); ++ irq_set_nested_thread(irq, true); ++ irq_set_noprobe(irq); ++ ++ return 0; ++} ++ ++static const struct irq_domain_ops mt7530_irq_domain_ops = { ++ .map = mt7530_irq_map, ++ .xlate = irq_domain_xlate_onecell, ++}; ++ ++static void ++mt7530_setup_mdio_irq(struct mt7530_priv *priv) ++{ ++ struct dsa_switch *ds = priv->ds; ++ int p; ++ ++ for (p = 0; p < MT7530_NUM_PHYS; p++) { ++ if (BIT(p) & ds->phys_mii_mask) { ++ unsigned int irq; ++ ++ irq = irq_create_mapping(priv->irq_domain, p); ++ ds->slave_mii_bus->irq[p] = irq; ++ } ++ } ++} ++ ++static int ++mt7530_setup_irq(struct mt7530_priv *priv) ++{ ++ struct device *dev = priv->dev; ++ struct device_node *np = dev->of_node; ++ int ret; ++ ++ if (!of_property_read_bool(np, "interrupt-controller")) { ++ dev_info(dev, "no interrupt support\n"); ++ return 0; ++ } ++ ++ priv->irq = of_irq_get(np, 0); ++ if (priv->irq <= 0) { ++ dev_err(dev, "failed to get parent IRQ: %d\n", priv->irq); ++ return priv->irq ? : -EINVAL; ++ } ++ ++ priv->irq_domain = irq_domain_add_linear(np, MT7530_NUM_PHYS, ++ &mt7530_irq_domain_ops, priv); ++ if (!priv->irq_domain) { ++ dev_err(dev, "failed to create IRQ domain\n"); ++ return -ENOMEM; ++ } ++ ++ /* This register must be set for MT7530 to properly fire interrupts */ ++ if (priv->id != ID_MT7531) ++ mt7530_set(priv, MT7530_TOP_SIG_CTRL, TOP_SIG_CTRL_NORMAL); ++ ++ ret = request_threaded_irq(priv->irq, NULL, mt7530_irq_thread_fn, ++ IRQF_ONESHOT, KBUILD_MODNAME, priv); ++ if (ret) { ++ irq_domain_remove(priv->irq_domain); ++ dev_err(dev, "failed to request IRQ: %d\n", ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static void ++mt7530_free_mdio_irq(struct mt7530_priv *priv) ++{ ++ int p; ++ ++ for (p = 0; p < MT7530_NUM_PHYS; p++) { ++ if (BIT(p) & priv->ds->phys_mii_mask) { ++ unsigned int irq; ++ ++ irq = irq_find_mapping(priv->irq_domain, p); ++ irq_dispose_mapping(irq); ++ } ++ } ++} ++ ++ ++static void ++mt7530_free_irq_common(struct mt7530_priv *priv) ++{ ++ free_irq(priv->irq, priv); ++ irq_domain_remove(priv->irq_domain); ++} ++ ++static void ++mt7530_free_irq(struct mt7530_priv *priv) ++{ ++ mt7530_free_mdio_irq(priv); ++ mt7530_free_irq_common(priv); ++} ++ ++static int ++mt7530_setup_mdio(struct mt7530_priv *priv) ++{ ++ struct dsa_switch *ds = priv->ds; ++ struct device *dev = priv->dev; ++ struct mii_bus *bus; ++ static int idx; ++ int ret; ++ ++ bus = devm_mdiobus_alloc(dev); ++ if (!bus) ++ return -ENOMEM; ++ ++ ds->slave_mii_bus = bus; ++ bus->priv = priv; ++ bus->name = KBUILD_MODNAME "-mii"; ++ snprintf(bus->id, MII_BUS_ID_SIZE, KBUILD_MODNAME "-%d", idx++); ++ bus->read = mt753x_phy_read; ++ bus->write = mt753x_phy_write; ++ bus->parent = dev; ++ bus->phy_mask = ~ds->phys_mii_mask; ++ ++ if (priv->irq) ++ mt7530_setup_mdio_irq(priv); ++ ++ ret = mdiobus_register(bus); ++ if (ret) { ++ dev_err(dev, "failed to register MDIO bus: %d\n", ret); ++ if (priv->irq) ++ mt7530_free_mdio_irq(priv); ++ } ++ ++ return ret; ++} ++ + static int + mt7531_setup(struct dsa_switch *ds) + { +@@ -2798,24 +3014,19 @@ static int + mt753x_setup(struct dsa_switch *ds) + { + struct mt7530_priv *priv = ds->priv; ++ int ret = priv->info->sw_setup(ds); ++ if (ret) ++ return ret; + +- return priv->info->sw_setup(ds); +-} +- +-static int +-mt753x_phy_read(struct dsa_switch *ds, int port, int regnum) +-{ +- struct mt7530_priv *priv = ds->priv; +- +- return priv->info->phy_read(ds, port, regnum); +-} ++ ret = mt7530_setup_irq(priv); ++ if (ret) ++ return ret; + +-static int +-mt753x_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val) +-{ +- struct mt7530_priv *priv = ds->priv; ++ ret = mt7530_setup_mdio(priv); ++ if (ret && priv->irq) ++ mt7530_free_irq_common(priv); + +- return priv->info->phy_write(ds, port, regnum, val); ++ return ret; + } + + static int mt753x_get_mac_eee(struct dsa_switch *ds, int port, +@@ -2852,8 +3063,6 @@ static const struct dsa_switch_ops mt753 + .get_tag_protocol = mtk_get_tag_protocol, + .setup = mt753x_setup, + .get_strings = mt7530_get_strings, +- .phy_read = mt753x_phy_read, +- .phy_write = mt753x_phy_write, + .get_ethtool_stats = mt7530_get_ethtool_stats, + .get_sset_count = mt7530_get_sset_count, + .set_ageing_time = mt7530_set_ageing_time, +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -7,6 +7,7 @@ + #define __MT7530_H + + #define MT7530_NUM_PORTS 7 ++#define MT7530_NUM_PHYS 5 + #define MT7530_CPU_PORT 6 + #define MT7530_NUM_FDB_RECORDS 2048 + #define MT7530_ALL_MEMBERS 0xff +@@ -401,6 +402,12 @@ enum mt7531_sgmii_force_duplex { + #define SYS_CTRL_SW_RST BIT(1) + #define SYS_CTRL_REG_RST BIT(0) + ++/* Register for system interrupt */ ++#define MT7530_SYS_INT_EN 0x7008 ++ ++/* Register for system interrupt status */ ++#define MT7530_SYS_INT_STS 0x700c ++ + /* Register for PHY Indirect Access Control */ + #define MT7531_PHY_IAC 0x701C + #define MT7531_PHY_ACS_ST BIT(31) +@@ -722,6 +729,9 @@ static const char *p5_intf_modes(unsigne + } + } + ++/* Forward declaration */ ++struct mt7530_priv; ++ + /* struct mt753x_info - This is the main data structure for holding the specific + * part for each supported device + * @sw_setup: Holding the handler to a device initialization +@@ -746,8 +756,8 @@ struct mt753x_info { + enum mt753x_id id; + + int (*sw_setup)(struct dsa_switch *ds); +- int (*phy_read)(struct dsa_switch *ds, int port, int regnum); +- int (*phy_write)(struct dsa_switch *ds, int port, int regnum, u16 val); ++ int (*phy_read)(struct mt7530_priv *priv, int port, int regnum); ++ int (*phy_write)(struct mt7530_priv *priv, int port, int regnum, u16 val); + int (*pad_setup)(struct dsa_switch *ds, phy_interface_t interface); + int (*cpu_port_config)(struct dsa_switch *ds, int port); + bool (*phy_mode_supported)(struct dsa_switch *ds, int port, +@@ -781,6 +791,10 @@ struct mt753x_info { + * registers + * @p6_interface Holding the current port 6 interface + * @p5_intf_sel: Holding the current port 5 interface select ++ * ++ * @irq: IRQ number of the switch ++ * @irq_domain: IRQ domain of the switch irq_chip ++ * @irq_enable: IRQ enable bits, synced to SYS_INT_EN + */ + struct mt7530_priv { + struct device *dev; +@@ -802,6 +816,9 @@ struct mt7530_priv { + struct mt7530_port ports[MT7530_NUM_PORTS]; + /* protect among processes for registers access*/ + struct mutex reg_mutex; ++ int irq; ++ struct irq_domain *irq_domain; ++ u32 irq_enable; + }; + + struct mt7530_hw_vlan_entry { diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index 4a3327a364..b784a9d60c 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -487,6 +487,9 @@ mediatek,mcm; resets = <&rstctrl 2>; reset-names = "mcm"; + interrupt-controller; + #interrupt-cells = <1>; + interrupts = ; ports { #address-cells = <1>; From 2c929f8105237d3ebd645ea4e3387585c139b6ab Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 27 Mar 2020 12:40:33 +0200 Subject: [PATCH 117/144] util-linux: package ipcs command Add a package for util-linux' ipcs command, to show information about System V inter-process communication facilities. Signed-off-by: Stijn Tintel --- package/utils/util-linux/Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index f2d58b413f..ce3cd171e0 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -265,6 +265,18 @@ define Package/hwclock/description hwclock is a tool for accessing the Hardware Clock endef +define Package/ipcs +$(call Package/util-linux/Default) + TITLE:=show information on IPC facilities +endef + +define Package/ipcs/description + ipcs shows information on the inter-process communication facilities for + which the calling process has read access. By default it shows information + about all three resources: shared memory segments, message queues, and + semaphore arrays. +endef + define Package/logger $(call Package/util-linux/Default) TITLE:=a shell command interface to the syslog system log module @@ -690,6 +702,11 @@ define Package/hwclock/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hwclock $(1)/usr/sbin/ endef +define Package/ipcs/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ipcs $(1)/usr/bin/ +endef + define Package/logger/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/logger $(1)/usr/bin/util-linux-logger @@ -842,6 +859,7 @@ $(eval $(call BuildPackage,flock)) $(eval $(call BuildPackage,fstrim)) $(eval $(call BuildPackage,getopt)) $(eval $(call BuildPackage,hwclock)) +$(eval $(call BuildPackage,ipcs)) $(eval $(call BuildPackage,logger)) $(eval $(call BuildPackage,look)) $(eval $(call BuildPackage,losetup)) From 781f2f73004344fc5cd74e0bc205ed890101f51e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 5 Feb 2022 18:52:32 +0100 Subject: [PATCH 118/144] Revert "kernel: backport MT7530 IRQ support" This reverts commit 3f4301e123f29348b4ad87578d62b7d1f5f210c6. This broke the mt7530 on Linksys e8450 (mt7622) for me. [ 1.300554] mt7530 mdio-bus:00: no interrupt support Signed-off-by: Hauke Mehrtens --- ...net-dsa-mt7530-add-interrupt-support.patch | 428 ------------------ target/linux/ramips/dts/mt7621.dtsi | 3 - 2 files changed, 431 deletions(-) delete mode 100644 target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch diff --git a/target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch b/target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch deleted file mode 100644 index b0b3abf7a6..0000000000 --- a/target/linux/generic/backport-5.10/772-v5.14-net-dsa-mt7530-add-interrupt-support.patch +++ /dev/null @@ -1,428 +0,0 @@ -From ba751e28d44255744a30190faad0ca09b455c44d Mon Sep 17 00:00:00 2001 -From: DENG Qingfang -Date: Wed, 19 May 2021 11:32:00 +0800 -Subject: [PATCH] net: dsa: mt7530: add interrupt support - -Add support for MT7530 interrupt controller to handle internal PHYs. -In order to assign an IRQ number to each PHY, the registration of MDIO bus -is also done in this driver. - -Signed-off-by: DENG Qingfang -Reviewed-by: Andrew Lunn -Reviewed-by: Florian Fainelli -Reviewed-by: Vladimir Oltean -Signed-off-by: David S. Miller ---- - drivers/net/dsa/Kconfig | 1 + - drivers/net/dsa/mt7530.c | 263 +++++++++++++++++++++++++++++++++++---- - drivers/net/dsa/mt7530.h | 21 +++- - 3 files changed, 256 insertions(+), 29 deletions(-) - ---- a/drivers/net/dsa/Kconfig -+++ b/drivers/net/dsa/Kconfig -@@ -36,6 +36,7 @@ config NET_DSA_MT7530 - tristate "MediaTek MT753x and MT7621 Ethernet switch support" - depends on NET_DSA - select NET_DSA_TAG_MTK -+ select MEDIATEK_GE_PHY - help - This enables support for the MediaTek MT7530, MT7531, and MT7621 - Ethernet switch chips. ---- a/drivers/net/dsa/mt7530.c -+++ b/drivers/net/dsa/mt7530.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -602,18 +603,14 @@ mt7530_mib_reset(struct dsa_switch *ds) - mt7530_write(priv, MT7530_MIB_CCR, CCR_MIB_ACTIVATE); - } - --static int mt7530_phy_read(struct dsa_switch *ds, int port, int regnum) -+static int mt7530_phy_read(struct mt7530_priv *priv, int port, int regnum) - { -- struct mt7530_priv *priv = ds->priv; -- - return mdiobus_read_nested(priv->bus, port, regnum); - } - --static int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum, -+static int mt7530_phy_write(struct mt7530_priv *priv, int port, int regnum, - u16 val) - { -- struct mt7530_priv *priv = ds->priv; -- - return mdiobus_write_nested(priv->bus, port, regnum, val); - } - -@@ -791,9 +788,8 @@ out: - } - - static int --mt7531_ind_phy_read(struct dsa_switch *ds, int port, int regnum) -+mt7531_ind_phy_read(struct mt7530_priv *priv, int port, int regnum) - { -- struct mt7530_priv *priv = ds->priv; - int devad; - int ret; - -@@ -809,10 +805,9 @@ mt7531_ind_phy_read(struct dsa_switch *d - } - - static int --mt7531_ind_phy_write(struct dsa_switch *ds, int port, int regnum, -+mt7531_ind_phy_write(struct mt7530_priv *priv, int port, int regnum, - u16 data) - { -- struct mt7530_priv *priv = ds->priv; - int devad; - int ret; - -@@ -828,6 +823,22 @@ mt7531_ind_phy_write(struct dsa_switch * - return ret; - } - -+static int -+mt753x_phy_read(struct mii_bus *bus, int port, int regnum) -+{ -+ struct mt7530_priv *priv = bus->priv; -+ -+ return priv->info->phy_read(priv, port, regnum); -+} -+ -+static int -+mt753x_phy_write(struct mii_bus *bus, int port, int regnum, u16 val) -+{ -+ struct mt7530_priv *priv = bus->priv; -+ -+ return priv->info->phy_write(priv, port, regnum, val); -+} -+ - static void - mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset, - uint8_t *data) -@@ -1991,6 +2002,211 @@ mt7530_setup(struct dsa_switch *ds) - return 0; - } - -+static irqreturn_t -+mt7530_irq_thread_fn(int irq, void *dev_id) -+{ -+ struct mt7530_priv *priv = dev_id; -+ bool handled = false; -+ u32 val; -+ int p; -+ -+ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); -+ val = mt7530_mii_read(priv, MT7530_SYS_INT_STS); -+ mt7530_mii_write(priv, MT7530_SYS_INT_STS, val); -+ mutex_unlock(&priv->bus->mdio_lock); -+ -+ for (p = 0; p < MT7530_NUM_PHYS; p++) { -+ if (BIT(p) & val) { -+ unsigned int irq; -+ -+ irq = irq_find_mapping(priv->irq_domain, p); -+ handle_nested_irq(irq); -+ handled = true; -+ } -+ } -+ -+ return IRQ_RETVAL(handled); -+} -+ -+static void -+mt7530_irq_mask(struct irq_data *d) -+{ -+ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); -+ -+ priv->irq_enable &= ~BIT(d->hwirq); -+} -+ -+static void -+mt7530_irq_unmask(struct irq_data *d) -+{ -+ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); -+ -+ priv->irq_enable |= BIT(d->hwirq); -+} -+ -+static void -+mt7530_irq_bus_lock(struct irq_data *d) -+{ -+ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); -+ -+ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); -+} -+ -+static void -+mt7530_irq_bus_sync_unlock(struct irq_data *d) -+{ -+ struct mt7530_priv *priv = irq_data_get_irq_chip_data(d); -+ -+ mt7530_mii_write(priv, MT7530_SYS_INT_EN, priv->irq_enable); -+ mutex_unlock(&priv->bus->mdio_lock); -+} -+ -+static struct irq_chip mt7530_irq_chip = { -+ .name = KBUILD_MODNAME, -+ .irq_mask = mt7530_irq_mask, -+ .irq_unmask = mt7530_irq_unmask, -+ .irq_bus_lock = mt7530_irq_bus_lock, -+ .irq_bus_sync_unlock = mt7530_irq_bus_sync_unlock, -+}; -+ -+static int -+mt7530_irq_map(struct irq_domain *domain, unsigned int irq, -+ irq_hw_number_t hwirq) -+{ -+ irq_set_chip_data(irq, domain->host_data); -+ irq_set_chip_and_handler(irq, &mt7530_irq_chip, handle_simple_irq); -+ irq_set_nested_thread(irq, true); -+ irq_set_noprobe(irq); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops mt7530_irq_domain_ops = { -+ .map = mt7530_irq_map, -+ .xlate = irq_domain_xlate_onecell, -+}; -+ -+static void -+mt7530_setup_mdio_irq(struct mt7530_priv *priv) -+{ -+ struct dsa_switch *ds = priv->ds; -+ int p; -+ -+ for (p = 0; p < MT7530_NUM_PHYS; p++) { -+ if (BIT(p) & ds->phys_mii_mask) { -+ unsigned int irq; -+ -+ irq = irq_create_mapping(priv->irq_domain, p); -+ ds->slave_mii_bus->irq[p] = irq; -+ } -+ } -+} -+ -+static int -+mt7530_setup_irq(struct mt7530_priv *priv) -+{ -+ struct device *dev = priv->dev; -+ struct device_node *np = dev->of_node; -+ int ret; -+ -+ if (!of_property_read_bool(np, "interrupt-controller")) { -+ dev_info(dev, "no interrupt support\n"); -+ return 0; -+ } -+ -+ priv->irq = of_irq_get(np, 0); -+ if (priv->irq <= 0) { -+ dev_err(dev, "failed to get parent IRQ: %d\n", priv->irq); -+ return priv->irq ? : -EINVAL; -+ } -+ -+ priv->irq_domain = irq_domain_add_linear(np, MT7530_NUM_PHYS, -+ &mt7530_irq_domain_ops, priv); -+ if (!priv->irq_domain) { -+ dev_err(dev, "failed to create IRQ domain\n"); -+ return -ENOMEM; -+ } -+ -+ /* This register must be set for MT7530 to properly fire interrupts */ -+ if (priv->id != ID_MT7531) -+ mt7530_set(priv, MT7530_TOP_SIG_CTRL, TOP_SIG_CTRL_NORMAL); -+ -+ ret = request_threaded_irq(priv->irq, NULL, mt7530_irq_thread_fn, -+ IRQF_ONESHOT, KBUILD_MODNAME, priv); -+ if (ret) { -+ irq_domain_remove(priv->irq_domain); -+ dev_err(dev, "failed to request IRQ: %d\n", ret); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static void -+mt7530_free_mdio_irq(struct mt7530_priv *priv) -+{ -+ int p; -+ -+ for (p = 0; p < MT7530_NUM_PHYS; p++) { -+ if (BIT(p) & priv->ds->phys_mii_mask) { -+ unsigned int irq; -+ -+ irq = irq_find_mapping(priv->irq_domain, p); -+ irq_dispose_mapping(irq); -+ } -+ } -+} -+ -+ -+static void -+mt7530_free_irq_common(struct mt7530_priv *priv) -+{ -+ free_irq(priv->irq, priv); -+ irq_domain_remove(priv->irq_domain); -+} -+ -+static void -+mt7530_free_irq(struct mt7530_priv *priv) -+{ -+ mt7530_free_mdio_irq(priv); -+ mt7530_free_irq_common(priv); -+} -+ -+static int -+mt7530_setup_mdio(struct mt7530_priv *priv) -+{ -+ struct dsa_switch *ds = priv->ds; -+ struct device *dev = priv->dev; -+ struct mii_bus *bus; -+ static int idx; -+ int ret; -+ -+ bus = devm_mdiobus_alloc(dev); -+ if (!bus) -+ return -ENOMEM; -+ -+ ds->slave_mii_bus = bus; -+ bus->priv = priv; -+ bus->name = KBUILD_MODNAME "-mii"; -+ snprintf(bus->id, MII_BUS_ID_SIZE, KBUILD_MODNAME "-%d", idx++); -+ bus->read = mt753x_phy_read; -+ bus->write = mt753x_phy_write; -+ bus->parent = dev; -+ bus->phy_mask = ~ds->phys_mii_mask; -+ -+ if (priv->irq) -+ mt7530_setup_mdio_irq(priv); -+ -+ ret = mdiobus_register(bus); -+ if (ret) { -+ dev_err(dev, "failed to register MDIO bus: %d\n", ret); -+ if (priv->irq) -+ mt7530_free_mdio_irq(priv); -+ } -+ -+ return ret; -+} -+ - static int - mt7531_setup(struct dsa_switch *ds) - { -@@ -2798,24 +3014,19 @@ static int - mt753x_setup(struct dsa_switch *ds) - { - struct mt7530_priv *priv = ds->priv; -+ int ret = priv->info->sw_setup(ds); -+ if (ret) -+ return ret; - -- return priv->info->sw_setup(ds); --} -- --static int --mt753x_phy_read(struct dsa_switch *ds, int port, int regnum) --{ -- struct mt7530_priv *priv = ds->priv; -- -- return priv->info->phy_read(ds, port, regnum); --} -+ ret = mt7530_setup_irq(priv); -+ if (ret) -+ return ret; - --static int --mt753x_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val) --{ -- struct mt7530_priv *priv = ds->priv; -+ ret = mt7530_setup_mdio(priv); -+ if (ret && priv->irq) -+ mt7530_free_irq_common(priv); - -- return priv->info->phy_write(ds, port, regnum, val); -+ return ret; - } - - static int mt753x_get_mac_eee(struct dsa_switch *ds, int port, -@@ -2852,8 +3063,6 @@ static const struct dsa_switch_ops mt753 - .get_tag_protocol = mtk_get_tag_protocol, - .setup = mt753x_setup, - .get_strings = mt7530_get_strings, -- .phy_read = mt753x_phy_read, -- .phy_write = mt753x_phy_write, - .get_ethtool_stats = mt7530_get_ethtool_stats, - .get_sset_count = mt7530_get_sset_count, - .set_ageing_time = mt7530_set_ageing_time, ---- a/drivers/net/dsa/mt7530.h -+++ b/drivers/net/dsa/mt7530.h -@@ -7,6 +7,7 @@ - #define __MT7530_H - - #define MT7530_NUM_PORTS 7 -+#define MT7530_NUM_PHYS 5 - #define MT7530_CPU_PORT 6 - #define MT7530_NUM_FDB_RECORDS 2048 - #define MT7530_ALL_MEMBERS 0xff -@@ -401,6 +402,12 @@ enum mt7531_sgmii_force_duplex { - #define SYS_CTRL_SW_RST BIT(1) - #define SYS_CTRL_REG_RST BIT(0) - -+/* Register for system interrupt */ -+#define MT7530_SYS_INT_EN 0x7008 -+ -+/* Register for system interrupt status */ -+#define MT7530_SYS_INT_STS 0x700c -+ - /* Register for PHY Indirect Access Control */ - #define MT7531_PHY_IAC 0x701C - #define MT7531_PHY_ACS_ST BIT(31) -@@ -722,6 +729,9 @@ static const char *p5_intf_modes(unsigne - } - } - -+/* Forward declaration */ -+struct mt7530_priv; -+ - /* struct mt753x_info - This is the main data structure for holding the specific - * part for each supported device - * @sw_setup: Holding the handler to a device initialization -@@ -746,8 +756,8 @@ struct mt753x_info { - enum mt753x_id id; - - int (*sw_setup)(struct dsa_switch *ds); -- int (*phy_read)(struct dsa_switch *ds, int port, int regnum); -- int (*phy_write)(struct dsa_switch *ds, int port, int regnum, u16 val); -+ int (*phy_read)(struct mt7530_priv *priv, int port, int regnum); -+ int (*phy_write)(struct mt7530_priv *priv, int port, int regnum, u16 val); - int (*pad_setup)(struct dsa_switch *ds, phy_interface_t interface); - int (*cpu_port_config)(struct dsa_switch *ds, int port); - bool (*phy_mode_supported)(struct dsa_switch *ds, int port, -@@ -781,6 +791,10 @@ struct mt753x_info { - * registers - * @p6_interface Holding the current port 6 interface - * @p5_intf_sel: Holding the current port 5 interface select -+ * -+ * @irq: IRQ number of the switch -+ * @irq_domain: IRQ domain of the switch irq_chip -+ * @irq_enable: IRQ enable bits, synced to SYS_INT_EN - */ - struct mt7530_priv { - struct device *dev; -@@ -802,6 +816,9 @@ struct mt7530_priv { - struct mt7530_port ports[MT7530_NUM_PORTS]; - /* protect among processes for registers access*/ - struct mutex reg_mutex; -+ int irq; -+ struct irq_domain *irq_domain; -+ u32 irq_enable; - }; - - struct mt7530_hw_vlan_entry { diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index b784a9d60c..4a3327a364 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -487,9 +487,6 @@ mediatek,mcm; resets = <&rstctrl 2>; reset-names = "mcm"; - interrupt-controller; - #interrupt-cells = <1>; - interrupts = ; ports { #address-cells = <1>; From 1b311aab3141bbea5667be4517e2599e6235cca0 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 5 Feb 2022 18:52:36 +0100 Subject: [PATCH 119/144] Revert "kernel: backport MediaTek Ethernet PHY driver" This reverts commit 8b4cba53a9402f44da2dced4a78ca065b15dca94. This broke the mt7530 on Linksys e8450 (mt7622) for me. [ 1.312943] mt7530 mdio-bus:00 lan1 (uninitialized): failed to connect to PHY: -EINVAL [ 1.320890] mt7530 mdio-bus:00 lan1 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 0 [ 1.331163] mt7530 mdio-bus:00 lan2 (uninitialized): failed to connect to PHY: -EINVAL [ 1.339085] mt7530 mdio-bus:00 lan2 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 1 [ 1.349321] mt7530 mdio-bus:00 lan3 (uninitialized): failed to connect to PHY: -EINVAL [ 1.357241] mt7530 mdio-bus:00 lan3 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 2 [ 1.367452] mt7530 mdio-bus:00 lan4 (uninitialized): failed to connect to PHY: -EINVAL [ 1.375367] mt7530 mdio-bus:00 lan4 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 3 [ 1.385750] mt7530 mdio-bus:00 wan (uninitialized): failed to connect to PHY: -EINVAL [ 1.393575] mt7530 mdio-bus:00 wan (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 4 Signed-off-by: Hauke Mehrtens --- ...MediaTek-Gigabit-Ethernet-PHY-driver.patch | 162 ------------------ target/linux/generic/config-5.10 | 1 - target/linux/mediatek/mt7622/config-5.10 | 1 - target/linux/mediatek/mt7623/config-5.10 | 1 - target/linux/ramips/mt7621/config-5.10 | 1 - 5 files changed, 166 deletions(-) delete mode 100644 target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch diff --git a/target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch b/target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch deleted file mode 100644 index 9e09e7ede3..0000000000 --- a/target/linux/generic/backport-5.10/771-v5.14-net-phy-add-MediaTek-Gigabit-Ethernet-PHY-driver.patch +++ /dev/null @@ -1,162 +0,0 @@ -From e40d2cca01893c1941f5959b14bb0cd0d4f4d099 Mon Sep 17 00:00:00 2001 -From: DENG Qingfang -Date: Wed, 19 May 2021 11:31:59 +0800 -Subject: [PATCH] net: phy: add MediaTek Gigabit Ethernet PHY driver - -Add support for MediaTek Gigabit Ethernet PHYs found in MT7530 and -MT7531 switches. -The initialization procedure is from the vendor driver, but due to lack -of documentation, the function of some register values remains unknown. - -Signed-off-by: DENG Qingfang -Signed-off-by: David S. Miller ---- - drivers/net/phy/Kconfig | 5 ++ - drivers/net/phy/Makefile | 1 + - drivers/net/phy/mediatek-ge.c | 116 ++++++++++++++++++++++++++++++++++ - 3 files changed, 122 insertions(+) - create mode 100644 drivers/net/phy/mediatek-ge.c - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -201,6 +201,11 @@ config MARVELL_10G_PHY - help - Support for the Marvell Alaska MV88X3310 and compatible PHYs. - -+config MEDIATEK_GE_PHY -+ tristate "MediaTek PHYs" -+ help -+ Supports the MediaTek switch integrated PHYs. -+ - config MICREL_PHY - tristate "Micrel PHYs" - help ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -63,6 +63,7 @@ obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c - obj-$(CONFIG_LXT_PHY) += lxt.o - obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o - obj-$(CONFIG_MARVELL_PHY) += marvell.o -+obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o - obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o - obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o - obj-$(CONFIG_MICREL_PHY) += micrel.o ---- /dev/null -+++ b/drivers/net/phy/mediatek-ge.c -@@ -0,0 +1,116 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+#include -+#include -+#include -+ -+#define MTK_T10_TEST_CONTROL 0x145 -+#define MTK_PHY_TP_MASK GENMASK(4, 3) -+#define MTK_PHY_TP_AUTO 0 -+#define MTK_PHY_TP_MDI 2 -+#define MTK_PHY_TP_MDIX 3 -+ -+#define MTK_EXT_PAGE_ACCESS 0x1f -+#define MTK_PHY_PAGE_STANDARD 0x0000 -+#define MTK_PHY_PAGE_EXTENDED 0x0001 -+#define MTK_PHY_PAGE_EXTENDED_2 0x0002 -+#define MTK_PHY_PAGE_EXTENDED_3 0x0003 -+#define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30 -+#define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 -+ -+static int mtk_gephy_read_page(struct phy_device *phydev) -+{ -+ return __phy_read(phydev, MTK_EXT_PAGE_ACCESS); -+} -+ -+static int mtk_gephy_write_page(struct phy_device *phydev, int page) -+{ -+ return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page); -+} -+ -+static void mtk_gephy_config_init(struct phy_device *phydev) -+{ -+ /* Disable EEE */ -+ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0); -+ -+ /* Enable HW auto downshift */ -+ phy_modify_paged(phydev, MTK_PHY_PAGE_EXTENDED, 0x14, 0, BIT(4)); -+ -+ /* Increase SlvDPSready time */ -+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5); -+ __phy_write(phydev, 0x10, 0xafae); -+ __phy_write(phydev, 0x12, 0x2f); -+ __phy_write(phydev, 0x10, 0x8fae); -+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); -+ -+ /* Adjust 100_mse_threshold */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x123, 0xffff); -+ -+ /* Disable mcc */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0xa6, 0x300); -+} -+ -+static int mt7530_phy_config_init(struct phy_device *phydev) -+{ -+ mtk_gephy_config_init(phydev); -+ -+ /* Increase post_update_timer */ -+ phy_write_paged(phydev, MTK_PHY_PAGE_EXTENDED_3, 0x11, 0x4b); -+ -+ return 0; -+} -+ -+static int mt7531_phy_config_init(struct phy_device *phydev) -+{ -+ if (phydev->interface != PHY_INTERFACE_MODE_INTERNAL) -+ return -EINVAL; -+ -+ mtk_gephy_config_init(phydev); -+ -+ /* PHY link down power saving enable */ -+ phy_set_bits(phydev, 0x17, BIT(4)); -+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, 0xc6, 0x300); -+ -+ /* Set TX Pair delay selection */ -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x13, 0x404); -+ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x14, 0x404); -+ -+ return 0; -+} -+ -+static struct phy_driver mtk_gephy_driver[] = { -+ { -+ PHY_ID_MATCH_EXACT(0x03a29412), -+ .name = "MediaTek MT7530 PHY", -+ .config_init = mt7530_phy_config_init, -+ /* Interrupts are handled by the switch, not the PHY -+ * itself. -+ */ -+ .config_intr = genphy_no_config_intr, -+ .ack_interrupt = genphy_no_ack_interrupt, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_gephy_read_page, -+ .write_page = mtk_gephy_write_page, -+ }, -+ { -+ PHY_ID_MATCH_EXACT(0x03a29441), -+ .name = "MediaTek MT7531 PHY", -+ .config_init = mt7531_phy_config_init, -+ /* Interrupts are handled by the switch, not the PHY -+ * itself. -+ */ -+ .config_intr = genphy_no_config_intr, -+ .ack_interrupt = genphy_no_ack_interrupt, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_gephy_read_page, -+ .write_page = mtk_gephy_write_page, -+ }, -+}; -+ -+module_phy_driver(mtk_gephy_driver); -+ -+static struct mdio_device_id __maybe_unused mtk_gephy_tbl[] = { -+ { PHY_ID_MATCH_VENDOR(0x03a29400) }, -+ { } -+}; diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index b04e25e4a4..30c48d521b 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -3178,7 +3178,6 @@ CONFIG_MAY_USE_DEVLINK=y # CONFIG_MDIO_THUNDER is not set # CONFIG_MDIO_XPCS is not set # CONFIG_MD_FAULTY is not set -# CONFIG_MEDIATEK_GE_PHY is not set # CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set # CONFIG_MEDIA_ATTACH is not set # CONFIG_MEDIA_CAMERA_SUPPORT is not set diff --git a/target/linux/mediatek/mt7622/config-5.10 b/target/linux/mediatek/mt7622/config-5.10 index 85db8d142f..da1b283f70 100644 --- a/target/linux/mediatek/mt7622/config-5.10 +++ b/target/linux/mediatek/mt7622/config-5.10 @@ -228,7 +228,6 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y -CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y diff --git a/target/linux/mediatek/mt7623/config-5.10 b/target/linux/mediatek/mt7623/config-5.10 index 142ffd7998..09ecc16ef2 100644 --- a/target/linux/mediatek/mt7623/config-5.10 +++ b/target/linux/mediatek/mt7623/config-5.10 @@ -368,7 +368,6 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_GPIO=y -CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y diff --git a/target/linux/ramips/mt7621/config-5.10 b/target/linux/ramips/mt7621/config-5.10 index fb56bd142a..8a5e778e7e 100644 --- a/target/linux/ramips/mt7621/config-5.10 +++ b/target/linux/ramips/mt7621/config-5.10 @@ -114,7 +114,6 @@ CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y -CONFIG_MEDIATEK_GE_PHY=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y From 4d904524effc9eb0cc5094574c55d3a520803223 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Sat, 22 Jan 2022 21:27:49 +0100 Subject: [PATCH 120/144] kernel: bpf-headers: fix build error when testing kernel is used Now that we have separate files for each kernel version, only the version/hash for the target kernel are available. This cause a missing hash error (and wrong kernel version) for bpf-headers when a testing kernel version is used for the current target. Fix this error by manually including the kernel version/hash file for the specific kernel version requested. Signed-off-by: Ansuel Smith --- package/kernel/bpf-headers/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile index 0f0857133a..4d603707af 100644 --- a/package/kernel/bpf-headers/Makefile +++ b/package/kernel/bpf-headers/Makefile @@ -14,6 +14,9 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=linux PKG_PATCHVER:=5.10 +# Manually include kernel version and hash from kernel details file +include $(INCLUDE_DIR)/kernel-$(PKG_PATCHVER) + PKG_VERSION:=$(PKG_PATCHVER)$(strip $(LINUX_VERSION-$(PKG_PATCHVER))) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=$(LINUX_SITE) From f6a01d7f5c3d945f031cf24ab66066806dd62db3 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 6 Feb 2022 14:24:32 +0100 Subject: [PATCH 121/144] ipq806x: convert TP-Link Archer VR2600v to denx,uimage The recent device-tree modification that added pre-cal nvmem-cells pushed the device's kernel+dtb over the allotted 3072k KERNEL_SIZE. > WARNING: Image file tplink_vr2600v-uImage is too big: 3147214 > 3145728 There was a previous kernel partition size upgrade: commit 0c967d92b3d9 ("ipq806x: increase kernel partition size for the TP-Link Archer VR2600v") It has been seemingly upgraded from a 2048k KERNEL_SIZE in the past. The commit talks about using the MTD_SPLIT_TPLINK_FW. But looking at the image make recipe, there is no code that adds a TPLINK header. So instead the board will use "denx,umimage". This requires MTD_SPLIT_UIMAGE_FW, but this is present thanks to some NEC devices. (Maybe the MTD_CONFIG_ARGS can be removed as well? But it could be there because of the padding at the beginning. This needs testing.) Signed-off-by: Christian Lamparter --- .../linux/ipq806x/base-files/lib/upgrade/platform.sh | 1 - .../files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts | 12 +++++------- target/linux/ipq806x/image/generic.mk | 5 ++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index 3d96457dbd..84ffcd8a15 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -57,7 +57,6 @@ platform_do_upgrade() { default_do_upgrade "$1" ;; tplink,vr2600v) - PART_NAME="kernel:rootfs" MTD_CONFIG_ARGS="-s 0x200000" default_do_upgrade "$1" ;; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts index 3aec856823..23fe3c9f78 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts @@ -249,15 +249,13 @@ read-only; }; - kernel@320000 { - label = "kernel"; - reg = <0x320000 0x300000>; + partition@320000 { + label = "firmware"; + reg = <0x320000 0xc60000>; + compatible = "denx,uimage"; }; - rootfs@620000 { - label = "rootfs"; - reg = <0x620000 0x960000>; - }; + /* hole 0xf80000 - 0xfaf100 */ defaultmac: default-mac@0xfaf100 { label = "default-mac"; diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk index 524eb98226..4fdf656b4b 100644 --- a/target/linux/ipq806x/image/generic.mk +++ b/target/linux/ipq806x/image/generic.mk @@ -408,7 +408,7 @@ define Device/tplink_vr2600v KERNEL_SUFFIX := -uImage KERNEL = kernel-bin | append-dtb | uImage none KERNEL_NAME := zImage - KERNEL_SIZE := 3072k + IMAGE_SIZE := 12672k SOC := qcom-ipq8064 BLOCKSIZE := 128k PAGESIZE := 2048 @@ -416,8 +416,7 @@ define Device/tplink_vr2600v SUPPORTED_DEVICES += vr2600v DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | \ - pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | \ - append-metadata + append-rootfs | pad-rootfs | append-metadata endef TARGET_DEVICES += tplink_vr2600v From 7994461a5a1c2cdd8bf4cc3fa38c4d496534f080 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 5 Feb 2022 09:38:53 -0800 Subject: [PATCH 122/144] base-files: replace fgrep with grep -F fgrep is deprecated and replaced by grep -F. The latter is used throughout the tree whereas this is the only usage of the former. Signed-off-by: Rosen Penev --- package/base-files/files/etc/profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index 0beff1608f..76b149b9fa 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -3,7 +3,7 @@ [ -f /etc/banner ] && cat /etc/banner [ -n "$FAILSAFE" ] && cat /etc/banner.failsafe -fgrep -sq '/ overlay ro,' /proc/mounts && { +grep -Fsq '/ overlay ro,' /proc/mounts && { echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.' echo 'Please try to remove files from /overlay/upper/... and reboot!' } From 8cfce165a7e3605c22b045cdc1f745b4d6b49fb9 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 5 Feb 2022 09:42:42 -0800 Subject: [PATCH 123/144] target/linux: replace egrep with grep -E egrep is deprecated and replaced by grep -E. The latter is used throughout the tree. Signed-off-by: Rosen Penev --- target/linux/bcm4908/base-files/lib/upgrade/platform.sh | 8 ++++---- target/linux/ipq806x/base-files/lib/upgrade/linksys.sh | 2 +- target/linux/kirkwood/base-files/lib/upgrade/linksys.sh | 2 +- .../mvebu/cortexa9/base-files/lib/upgrade/linksys.sh | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/bcm4908/base-files/lib/upgrade/platform.sh b/target/linux/bcm4908/base-files/lib/upgrade/platform.sh index e7d4bfe4de..1b94801fb0 100644 --- a/target/linux/bcm4908/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm4908/base-files/lib/upgrade/platform.sh @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause -RAMFS_COPY_BIN="bcm4908img expr egrep fdtget fw_printenv fw_setenv tr" +RAMFS_COPY_BIN="bcm4908img expr grep fdtget fw_printenv fw_setenv tr" PART_NAME=firmware @@ -112,19 +112,19 @@ platform_pkgtb_get_image() { local image_name=$(platform_pkgtb_get_image_name "$1" "$cmd" "$3") - $cmd < $1 | fdtget -p - /images/$image_name | egrep -q "^data$" && { + $cmd < $1 | fdtget -p - /images/$image_name | grep -Eq "^data$" && { $cmd < $1 | fdtget -t r - /images/$image_name data return } - $cmd < $1 | fdtget -p - /images/$image_name | egrep -q "^data-position$" && { + $cmd < $1 | fdtget -p - /images/$image_name | grep -Eq "^data-position$" && { local data_position=$($cmd < $1 | fdtget - /images/$image_name data-position) local data_size=$($cmd < $1 | fdtget - /images/$image_name data-size) $cmd < $1 2>/dev/null | dd skip=$data_position count=$data_size iflag=skip_bytes,count_bytes return } - $cmd < $1 | fdtget -p - /images/$image_name | egrep -q "^data-offset" && { + $cmd < $1 | fdtget -p - /images/$image_name | grep -Eq "^data-offset" && { local data_offset=$($cmd < $1 | fdtget - /images/$image_name data-offset) local totalsize=$(get_hex_u32_be "$1" 4) local data_position=$(((0x$totalsize + data_offset + 3) & ~3)) diff --git a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh index 29f4763451..1feffc7aa2 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh @@ -9,7 +9,7 @@ linksys_get_target_firmware() { cur_boot_part=$(/usr/sbin/fw_printenv -n boot_part) if [ -z "${cur_boot_part}" ] ; then mtd_ubi0=$(cat /sys/devices/virtual/ubi/ubi0/mtd_num) - case $(egrep ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in + case $(grep -E ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in kernel1|rootfs1) cur_boot_part=1 ;; diff --git a/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh index 1f2596ea88..7e20276fe5 100644 --- a/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh +++ b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh @@ -9,7 +9,7 @@ linksys_get_target_firmware() { cur_boot_part=$(/usr/sbin/fw_printenv -n boot_part) if [ -z "${cur_boot_part}" ] ; then mtd_ubi0=$(cat /sys/devices/virtual/ubi/ubi0/mtd_num) - case $(egrep ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in + case $(grep -E ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in kernel|rootfs) cur_boot_part=1 ;; diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh index aaa32eb4ea..826bf8c9b5 100644 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/linksys.sh @@ -9,7 +9,7 @@ linksys_get_target_firmware() { cur_boot_part=$(/usr/sbin/fw_printenv -n boot_part) if [ -z "${cur_boot_part}" ] ; then mtd_ubi0=$(cat /sys/devices/virtual/ubi/ubi0/mtd_num) - case $(egrep ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in + case $(grep -E ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in kernel1|rootfs1) cur_boot_part=1 ;; From 4c42e2d9dda739baa6a144cdb009aef1a33824a0 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 30 Jan 2022 18:52:15 -0800 Subject: [PATCH 124/144] include/meson: fix host build directory When using a non default MESON_HOST_BUILD_DIR, HOST_BUILD_DIR is not appropriate to use. This change matches the target configure section. Signed-off-by: Rosen Penev --- include/meson.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/meson.mk b/include/meson.mk index e101de4d89..102e74b542 100644 --- a/include/meson.mk +++ b/include/meson.mk @@ -98,7 +98,7 @@ define Host/Configure/Meson --native-file $(HOST_BUILD_DIR)/openwrt-native.txt \ $(MESON_HOST_ARGS) \ $(MESON_HOST_BUILD_DIR) \ - $(HOST_BUILD_DIR), \ + $(MESON_HOST_BUILD_DIR)/.., \ $(MESON_HOST_VARS)) endef From 8de901ccf7e2b227bd970e9c477f00c15ce6aae9 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 30 Jan 2022 19:03:41 -0800 Subject: [PATCH 125/144] tools/zstd: update to 1.5.2 Switched to building with meson as it's faster and does not need a dependency on cmake, which takes a long time to build. Signed-off-by: Rosen Penev --- tools/Makefile | 2 +- tools/zstd/Makefile | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 681344a014..0950f3aee1 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -74,7 +74,7 @@ $(curdir)/sdcc/compile := $(curdir)/bison/compile $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile $(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zlib/compile := $(curdir)/cmake/compile -$(curdir)/zstd/compile := $(curdir)/cmake/compile +$(curdir)/zstd/compile := $(curdir)/meson/compile ifneq ($(HOST_OS),Linux) $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile index b93a5d2b52..93f6745976 100644 --- a/tools/zstd/Makefile +++ b/tools/zstd/Makefile @@ -1,25 +1,35 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zstd -PKG_VERSION:=1.5.0 +PKG_VERSION:=1.5.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION) -PKG_HASH:=5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94 +PKG_HASH:=7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:facebook:zstandard -CMAKE_SOURCE_SUBDIR:=build/cmake - include $(INCLUDE_DIR)/host-build.mk -include $(INCLUDE_DIR)/cmake.mk +include $(INCLUDE_DIR)/meson.mk -CMAKE_HOST_OPTIONS += \ - -DBUILD_TESTING=OFF \ - -DCMAKE_C_COMPILER_LAUNCHER="" \ - -DCMAKE_C_COMPILER=$(HOSTCC_NOCACHE) \ - -DZSTD_LEGACY_SUPPORT=OFF +MESON_HOST_BUILD_DIR:=$(HOST_BUILD_DIR)/build/meson/openwrt-build + +HOSTCC:= $(HOSTCC_NOCACHE) +HOST_LDFLAGS += -Wl,-rpath,$(STAGING_DIR_HOST)/lib + +MESON_HOST_ARGS += \ + -Dlegacy_level=7 \ + -Ddebug_level=0 \ + -Dbacktrace=false \ + -Dstatic_runtime=false \ + -Dbin_programs=true \ + -Dbin_tests=false \ + -Dbin_contrib=false \ + -Dmulti_thread=enabled \ + -Dzlib=disabled \ + -Dlzma=disabled \ + -Dlz4=disabled $(eval $(call HostBuild)) From 43ec6d64bb368253f159ec9e6d8343fdbb0d97e4 Mon Sep 17 00:00:00 2001 From: Saiful Islam Date: Sat, 25 Sep 2021 07:39:52 +0600 Subject: [PATCH 126/144] ath79: add support for TP-Link TL-WR841HP v2 Specifications: - AR9344 SoC, 8 MB nor flash, 64 MB DDR2 RAM - 2x2 9dBi antenna, wifi 2.4Ghz 300Mbps - 4x Ethernet LAN 10/100, 1x Ethernet WAN 10/100 - 1x WAN, 4x LAN, Wifi, PWR, WPS, SYSTEM Leds - Reset/WPS button - Serial UART at J4 onboard: 3.3v GND RX TX, 1152008N1 MAC addresses as verified by OEM firmware: vendor OpenWrt address LAN eth0 label WAN eth1 label + 1 WLAN phy0 label The label MAC address was found in u-boot 0x1fc00. Installation: To install openwrt, - set the device's SSID to each of the following lines, making sure to include the backticks. - set the ssid and click save between each line. `echo "httpd -k"> /tmp/s` `echo "sleep 10">> /tmp/s` `echo "httpd -r&">> /tmp/s` `echo "sleep 10">> /tmp/s` `echo "httpd -k">> /tmp/s` `echo "sleep 10">> /tmp/s` `echo "httpd -f">> /tmp/s` `sh /tmp/s` - Now, wait 60 sec. - After the reboot sequence, the router may have fallen back to its default IP address with the default credentials (admin:admin). - Log in to the web interface and go the the firmware upload page. Select "openwrt-ath79-generic-tplink_tl-wr841hp-v2-squashfs-factory.bin" and you're done : the system now accepts the openwrt. Forum support topic: https://forum.openwrt.org/t/support-for-tplink-tl-wr841hp-v2/69445/ Signed-off-by: Saiful Islam --- .../ath79/dts/ar9344_tplink_tl-wr841hp-v2.dts | 170 ++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 1 + .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic-tp-link.mk | 9 + 4 files changed, 181 insertions(+) create mode 100644 target/linux/ath79/dts/ar9344_tplink_tl-wr841hp-v2.dts diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wr841hp-v2.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wr841hp-v2.dts new file mode 100644 index 0000000000..360443565b --- /dev/null +++ b/target/linux/ath79/dts/ar9344_tplink_tl-wr841hp-v2.dts @@ -0,0 +1,170 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include + +/ { + model = "TP-Link TL-WR841HP v2"; + compatible = "tplink,tl-wr841hp-v2", "qca,ar9344"; + + aliases { + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + label-mac-device = &wmac; + }; + + keys { + compatible = "gpio-keys"; + + reset { + linux,code = ; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + wan { + label = "green:wan"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + lan1 { + label = "green:lan1"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + lan2 { + label = "green:lan2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + lan3 { + label = "green:lan3"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + lan4 { + label = "green:lan4"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "green:wps"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "green:wlan"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_system: system { + label = "green:system"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x020000 0x7d0000>; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; + }; + }; +}; + +&gpio { + gpio_ext_lna0 { + gpio-hog; + gpios = <18 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "tp-link:ext:lna0"; + }; + + gpio_ext_lna1 { + gpio-hog; + gpios = <19 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "tp-link:ext:lna1"; + }; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + + nvmem-cells = <&macaddr_uboot_1fc00>; + nvmem-cell-names = "mac-address"; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy0>; + + nvmem-cells = <&macaddr_uboot_1fc00>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_uboot_1fc00>; + nvmem-cell-names = "mac-address"; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <1>; + }; +}; + +&uboot { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_uboot_1fc00: macaddr@1fc00 { + reg = <0x1fc00 0x6>; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 03750856ab..c8717ce0cc 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -396,6 +396,7 @@ tplink,tl-wpa8630p-v2.0-eu|\ tplink,tl-wpa8630p-v2.1-eu) ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x3c" ;; +tplink,tl-wr841hp-v2|\ tplink,tl-wr842n-v2) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x04" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 54c4152757..83e74f0651 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -441,6 +441,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4" ;; + tplink,tl-wr841hp-v2|\ tplink,tl-wr842n-v2|\ tplink,tl-wr941hp-v1) ucidef_set_interface_wan "eth1" diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index ac01767fcc..2880dbda1d 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -787,6 +787,15 @@ define Device/tplink_tl-wr810n-v2 endef TARGET_DEVICES += tplink_tl-wr810n-v2 +define Device/tplink_tl-wr841hp-v2 + $(Device/tplink-8mlzma) + SOC := ar9344 + DEVICE_MODEL := TL-WR841HP + DEVICE_VARIANT := v2 + TPLINK_HWID := 0x08411002 +endef +TARGET_DEVICES += tplink_tl-wr841hp-v2 + define Device/tplink_tl-wr841hp-v3 $(Device/tplink-8mlzma) SOC := qca9533 From 6ede645282f94c32a33a2c6858375b8c2f609922 Mon Sep 17 00:00:00 2001 From: Wenli Looi Date: Tue, 15 Jun 2021 02:21:01 -0700 Subject: [PATCH 127/144] ath79: add support for booting QCN5502 SoC Based on wikidevi, QCN5502 is a "Dragonfly" like QCA9561 and QCA9563. Treating it as QCA956x seems to work. Signed-off-by: Wenli Looi --- ...th79-add-support-for-booting-QCN550x.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 target/linux/ath79/patches-5.10/940-ath79-add-support-for-booting-QCN550x.patch diff --git a/target/linux/ath79/patches-5.10/940-ath79-add-support-for-booting-QCN550x.patch b/target/linux/ath79/patches-5.10/940-ath79-add-support-for-booting-QCN550x.patch new file mode 100644 index 0000000000..cf77433634 --- /dev/null +++ b/target/linux/ath79/patches-5.10/940-ath79-add-support-for-booting-QCN550x.patch @@ -0,0 +1,48 @@ +From: Wenli Looi +Date: Sun, 20 Jun 2021 23:32:28 -0700 +Subject: [PATCH] ath79: add support for booting QCN550x + +Based on wikidevi, QCN550x is a "Dragonfly" like QCA9561 and QCA9563. +Treating it as QCA956x seems to work. +Tested on Netgear EX7300v2 which boots successfully with +the same CPU clock as the stock firmware. + +Link: https://wikidevi.wi-cat.ru/Qualcomm#bgn +Link: https://wikidevi.wi-cat.ru/Qualcomm_Atheros#.28a.29bgn_2 +Signed-off-by: Wenli Looi + +--- a/arch/mips/ath79/early_printk.c ++++ b/arch/mips/ath79/early_printk.c +@@ -121,6 +121,7 @@ static void prom_putchar_init(void) + case REV_ID_MAJOR_QCA9558: + case REV_ID_MAJOR_TP9343: + case REV_ID_MAJOR_QCA956X: ++ case REV_ID_MAJOR_QCN550X: + _prom_putchar = prom_putchar_ar71xx; + break; + +--- a/arch/mips/ath79/setup.c ++++ b/arch/mips/ath79/setup.c +@@ -168,6 +168,12 @@ static void __init ath79_detect_sys_type + rev = id & QCA956X_REV_ID_REVISION_MASK; + break; + ++ case REV_ID_MAJOR_QCN550X: ++ ath79_soc = ATH79_SOC_QCA956X; ++ chip = "550X"; ++ rev = id & QCA956X_REV_ID_REVISION_MASK; ++ break; ++ + case REV_ID_MAJOR_TP9343: + ath79_soc = ATH79_SOC_TP9343; + chip = "9343"; +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -867,6 +867,7 @@ + #define REV_ID_MAJOR_QCA9558 0x1130 + #define REV_ID_MAJOR_TP9343 0x0150 + #define REV_ID_MAJOR_QCA956X 0x1150 ++#define REV_ID_MAJOR_QCN550X 0x2170 + + #define AR71XX_REV_ID_MINOR_MASK 0x3 + #define AR71XX_REV_ID_MINOR_AR7130 0x0 From c32008a37b81d0ab1062993241a1e9f0a8e73102 Mon Sep 17 00:00:00 2001 From: Wenli Looi Date: Sat, 12 Jun 2021 16:32:33 -0700 Subject: [PATCH 128/144] ath79: add partial support for Netgear EX7300v2 Hardware -------- SoC: QCN5502 Flash: 16 MiB RAM: 128 MiB Ethernet: 1 gigabit port Wireless No1: QCN5502 on-chip 2.4GHz 4x4 Wireless No2: QCA9984 pcie 5GHz 4x4 USB: none Installation ------------ Flash the factory image using the stock web interface or TFTP the factory image to the bootloader. What works ---------- - LEDs - Ethernet port - 5GHz wifi (QCA9984 pcie) What doesn't work ----------------- - 2.4GHz wifi (QCN5502 on-chip) (I was not able to make this work, probably because ath9k requires some changes to support QCN5502.) Signed-off-by: Wenli Looi --- package/boot/uboot-envtools/files/ath79 | 1 + .../ath79/dts/qcn5502_netgear_ex7300-v2.dts | 219 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 + target/linux/ath79/image/generic.mk | 17 ++ 5 files changed, 242 insertions(+) create mode 100644 target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 8cc0f59764..20715eb678 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -39,6 +39,7 @@ glinet,gl-ar750s-nor-nand|\ librerouter,librerouter-v1|\ netgear,ex6400|\ netgear,ex7300|\ +netgear,ex7300-v2|\ netgear,wndr4300-v2|\ netgear,wndr4500-v3|\ netgear,wnr1000-v2|\ diff --git a/target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts b/target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts new file mode 100644 index 0000000000..ba8dae0b36 --- /dev/null +++ b/target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include + +/ { + model = "Netgear EX7300 v2"; + compatible = "netgear,ex7300-v2", "qca,qcn5500", "qca,qca9560"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_amber; + led-running = &led_power_green; + led-upgrade = &led_power_amber; + label-mac-device = ð0; + }; + + led_spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + sck-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + num-chipselects = <0>; + + led_gpio: led_gpio@0 { + compatible = "fairchild,74hc595"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + spi-max-frequency = <500000>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "green:power"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led_power_amber: power_amber { + label = "amber:power"; + gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; + }; + + wps_green { + label = "green:wps"; + gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; + }; + + router_red { + label = "red:router"; + gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; + }; + + router_green { + label = "green:router"; + gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>; + }; + + client_red { + label = "red:client"; + gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; + }; + + client_green { + label = "green:client"; + gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; + }; + + left_blue { + label = "blue:left"; + gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; + }; + + right_blue { + label = "blue:right"; + gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "WPS button"; + linux,code = ; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + extender_apmode { + label = "EXTENDER/APMODE switch"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + debounce-interval = <60>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pll { + clocks = <&extosc>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + label = "config"; + reg = <0x050000 0x010000>; + }; + + partition@60000 { + label = "pot"; + reg = <0x060000 0x010000>; + read-only; + }; + + partition@70000 { + label = "firmware"; + reg = <0x70000 0xe30000>; + compatible = "denx,uimage"; + }; + + partition@ea0000 { + label = "rae"; + reg = <0xea0000 0x100000>; + read-only; + }; + + partition@fa0000 { + label = "oopsdump"; + reg = <0xfa0000 0x40000>; + read-only; + }; + + artmtd: partition@fe0000 { + label = "artmtd"; + reg = <0xfe0000 0x10000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +/* +Does not work due to lack of QCN5502 support in ath9k. +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&artmtd 0x6>; +}; +*/ + +&mdio0 { + status = "okay"; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "sgmii"; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&artmtd 0x0>; + + phy-handle = <&phy5>; + phy-mode = "sgmii"; + + pll-data = <0x03000000 0x00000101 0x00001313>; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 83e74f0651..b80f8cd266 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -44,6 +44,7 @@ ath79_setup_interfaces() meraki,mr16|\ netgear,ex6400|\ netgear,ex7300|\ + netgear,ex7300-v2|\ ocedo,koala|\ ocedo,raccoon|\ onion,omega|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 109b33795a..787d56c237 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -218,6 +218,10 @@ case "$FIRMWARE" in caldata_extract "caldata" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc) ;; + netgear,ex7300-v2) + caldata_extract "art" 0x5000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary artmtd 0xc) + ;; phicomm,k2t) caldata_extract "art" 0x5000 0x2f20 ath10k_patch_mac $(k2t_get_mac "5g_mac") diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index b3598a2000..3b23267b70 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1580,6 +1580,23 @@ define Device/netgear_ex7300 endef TARGET_DEVICES += netgear_ex7300 +define Device/netgear_ex7300-v2 + $(Device/netgear_generic) + SOC := qcn5502 + DEVICE_MODEL := EX7300 + DEVICE_VARIANT := v2 + UIMAGE_MAGIC := 0x27051956 + NETGEAR_BOARD_ID := EX7300v2series + NETGEAR_HW_ID := 29765907+16+0+128 + IMAGE_SIZE := 14528k + IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ + netgear-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata + IMAGE/factory.img := $$(IMAGE/default) | check-size | netgear-dni + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9984-ct +endef +TARGET_DEVICES += netgear_ex7300-v2 + define Device/netgear_wndr3x00 $(Device/netgear_generic) SOC := ar7161 From e0683839b8036388213d7662f3e0066a29b7d480 Mon Sep 17 00:00:00 2001 From: Jakob Riepler Date: Thu, 9 Dec 2021 12:12:37 +0100 Subject: [PATCH 129/144] ath79: add support for Mikrotik LHG 5 The MikroTik LHG 5 series (product codes RBLHG-5nD, RBLHG-5HPnD and RBLHG-5HPnD-XL) devices are an outdoor 5GHz CPE with a 24.5dBi or 27dBi integrated antenna built around the Atheros AR9344 SoC. It is very similar to the SXT Lite5 series which this patch is based upon. Specifications: - SoC: Atheros AR9344 - RAM: 64 MB - Storage: 16 MB SPI NOR - Wireless: Atheros AR9340 (SoC) 802.11a/n 2x2:2 - Ethernet: Atheros AR8229 switch (SoC), 1x 10/100 port, 8-32 Vdc PoE in - 8 user-controllable LEDs: - 1x power (blue) - 1x user (white) - 1x ethernet (green) - 5x rssi (green) See https://mikrotik.com/product/RBLHG-5nD for more details. Notes: The device was already supported in the ar71xx target. Flashing: TFTP boot initramfs image and then perform a sysupgrade. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. Signed-off-by: Jakob Riepler --- .../ar9344_mikrotik_routerboard-16m-nor.dtsi | 65 +++++++++++++ .../ar9344_mikrotik_routerboard-lhg-5nd.dts | 91 +++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 9 ++ .../mikrotik/base-files/etc/board.d/01_leds | 9 ++ .../base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + 6 files changed, 177 insertions(+) create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi new file mode 100644 index 0000000000..4bf0731b1a --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "RouterBoot"; + reg = <0x0 0x20000>; + read-only; + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader1"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config: hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + partition@10000 { + label = "bootloader2"; + reg = <0x10000 0x0>; + read-only; + }; + + soft_config { + label = "soft_config"; + }; + }; + + partition@20000 { + compatible = "mikrotik,minor"; + label = "firmware"; + reg = <0x020000 0xfe0000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + qca,no-eeprom; +}; diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts new file mode 100644 index 0000000000..194a789fb2 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_mikrotik_routerboard-16m-nor.dtsi" + +#include +#include + +/ { + compatible = "mikrotik,routerboard-lhg-5nd", "qca,ar9344"; + model = "MikroTik RouterBOARD LHG 5nD"; + + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-running = &led_user; + led-upgrade = &led_user; + }; + + leds { + compatible = "gpio-leds"; + + power { + label = "blue:power"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + rssilow { + label = "green:rssilow"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + rssimediumlow { + label = "green:rssimediumlow"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + rssimedium { + label = "green:rssimedium"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + rssimediumhigh { + label = "green:rssimediumhigh"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + }; + + rssihigh { + label = "green:rssihigh"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + + led_user: user { + label = "white:user"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "green:lan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy0>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <1>; + }; +}; + +ð1 { + status = "okay"; + + compatible = "syscon", "simple-mfd"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 095a1cbc84..ff3604f2fa 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -46,6 +46,15 @@ define Device/mikrotik_routerboard-lhg-2nd endef TARGET_DEVICES += mikrotik_routerboard-lhg-2nd +define Device/mikrotik_routerboard-lhg-5nd + $(Device/mikrotik_nor) + SOC := ar9344 + DEVICE_MODEL := RouterBOARD LHG 5nD (LHG 5) + DEVICE_PACKAGES += rssileds + IMAGE_SIZE := 16256k +endef +TARGET_DEVICES += mikrotik_routerboard-lhg-5nd + define Device/mikrotik_routerboard-sxt-5nd-r2 $(Device/mikrotik_nand) SOC := ar9344 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index 39e527e824..25c0184568 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -9,6 +9,15 @@ case "$board" in mikrotik,routerboard-lhg-2nd) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; +mikrotik,routerboard-lhg-5nd) + ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "rssimediumlow" "green:rssimediumlow" "wlan0" "20" "100" + ucidef_set_led_rssi "rssimedium" "rssimedium" "green:rssimedium" "wlan0" "40" "100" + ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "60" "100" + ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "80" "100" + ;; mikrotik,routerboard-wapr-2nd) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100" diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index 4058742133..1a205e439c 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -16,6 +16,7 @@ ath79_setup_interfaces() ;; mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ + mikrotik,routerboard-lhg-5nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-g-5hact2hnd|\ mikrotik,routerboard-wapr-2nd) @@ -38,6 +39,7 @@ ath79_setup_macs() case "$board" in mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ + mikrotik,routerboard-lhg-5nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-g-5hact2hnd|\ mikrotik,routerboard-wapr-2nd) diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 78aa35dc69..abdabfb7c8 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -25,6 +25,7 @@ case "$FIRMWARE" in case $board in mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ + mikrotik,routerboard-lhg-5nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wapr-2nd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 1) From 3343ca7e6837b2ac5f237ea78bf73d50831dea20 Mon Sep 17 00:00:00 2001 From: Raymond Wang Date: Sat, 11 Sep 2021 23:54:30 +0800 Subject: [PATCH 130/144] ramips: add support for Xiaomi Mi Router CR660x series Xiaomi Mi Router CR6606 is a Wi-Fi6 AX1800 Router with 4 GbE Ports. Alongside the general model, it has three carrier customized models: CR6606 (China Unicom), CR6608 (China Mobile), CR6609 (China Telecom) Specifications: - SoC: MediaTek MT7621AT - RAM: 256MB DDR3 (ESMT M15T2G16128A) - Flash: 128MB NAND (ESMT F59L1G81MB) - Ethernet: 1000Base-T x4 (MT7530 SoC) - WLAN: 2x2 2.4GHz 574Mbps + 2x2 5GHz 1201Mbps (MT7905DAN + MT7975DN) - LEDs: System (Blue, Yellow), Internet (Blue, Yellow) - Buttons: Reset, WPS - UART: through-hole on PCB ([VCC 3.3v](RX)(GND)(TX) 115200, 8n1) - Power: 12VDC, 1A Jailbreak Notes: 1. Get shell access. 1.1. Get yourself a wireless router that runs OpenWrt already. 1.2. On the OpenWrt router: 1.2.1. Access its console. 1.2.2. Create and edit /usr/lib/lua/luci/controller/admin/xqsystem.lua with the following code (exclude backquotes and line no.): ``` 1 module("luci.controller.admin.xqsystem", package.seeall) 2 3 function index() 4 local page = node("api") 5 page.target = firstchild() 6 page.title = ("") 7 page.order = 100 8 page.index = true 9 page = node("api","xqsystem") 10 page.target = firstchild() 11 page.title = ("") 12 page.order = 100 13 page.index = true 14 entry({"api", "xqsystem", "token"}, call("getToken"), (""), 103, 0x08) 15 end 16 17 local LuciHttp = require("luci.http") 18 19 function getToken() 20 local result = {} 21 result["code"] = 0 22 result["token"] = "; nvram set ssh_en=1; nvram commit; sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/drop bear start;" 23 LuciHttp.write_json(result) 24 end ``` 1.2.3. Browse http://{OWRT_ADDR}/cgi-bin/luci/api/xqsystem/token It should give you a respond like this: {"code":0,"token":"; nvram set ssh_en=1; nvram commit; ..."} If so, continue; Otherwise, check the file, reboot the rout- er, try again. 1.2.4. Set wireless network interface's IP to 169.254.31.1, turn off DHCP of wireless interface's zone. 1.2.5. Connect to the router wirelessly, manually set your access device's IP to 169.254.31.3, make sure http://169.254.31.1/cgi-bin/luci/api/xqsystem/token still have a similar result as 1.2.3 shows. 1.3. On the Xiaomi CR660x: 1.3.1. Login to the web interface. Your would be directed to a page with URL like this: http://{ROUTER_ADDR}/cgi-bin/luci/;stok={STOK}/web/home#r- outer 1.3.2. Browse this URL with {STOK} from 1.3.1, {WIFI_NAME} {PASSWORD} be your OpenWrt router's SSID and password: http://{MIROUTER_ADDR}/cgi-bin/luci/;stok={STOK}/api/misy- stem/extendwifi_connect?ssid={WIFI_NAME}&password={PASSWO- RD} It should return 0. 1.3.3. Browse this URL with {STOK} from 1.3.1: http://{MIROUTER_ADDR}/cgi-bin/luci/;stok={STOK}/api/xqsy- stem/oneclick_get_remote_token?username=xxx&password=xxx&- nonce=xxx 1.4. Before rebooting, you can now access your CR660x via SSH. For CR6606, you can calculate your root password by this project: https://github.com/wfjsw/xiaoqiang-root-password, or at https://www.oxygen7.cn/miwifi. The root password for carrier-specific models should be the admi- nistration password or the default login password on the label. It is also feasible to change the root password at the same time by modifying the script from step 1.2.2. You can treat OpenWrt Router however you like from this point as long as you don't mind go through this again if you have to expl- oit it again. If you do have to and left your OpenWrt router unt- ouched, start from 1.3. 2. There's no official binary firmware available, and if you lose the content of your flash, no one except Xiaomi can help you. Dump these partitions in case you need them: "Bootloader" "Nvram" "Bdata" "crash" "crash_log" "firmware" "firmware1" "overlay" "obr" Find the corespond block device from /proc/mtd Read from read-only block device to avoid misoperation. It's recommended to use /tmp/syslogbackup/ as destination, since files would be available at http://{ROUTER_ADDR}/backup/log/YOUR_DUMP Keep an eye on memory usage though. 3. Since UART access is locked ootb, you should get UART access by modify uboot env. Otherwise, your router may become bricked. Excute these in stock firmware shell: a. nvram set boot_wait=on b. nvram set bootdelay=3 c. nvram commit Or in OpenWrt: a. opkg update && opkg install kmod-mtd-rw b. insmod mtd-rw i_want_a_brick=1 c. fw_setenv boot_wait on d. fw_setenv bootdelay 3 e. rmmod mtd-rw Migrate to OpenWrt: 1. Transfer squashfs-firmware.bin to the router. 2. nvram set flag_try_sys1_failed=0 3. nvram set flag_try_sys2_failed=1 4. nvram commit 5. mtd -r write /path/to/image/squashfs-firmware.bin firmware Additional Info: 1. CR660x series routers has a different nand layout compared to other Xiaomi nand devices. 2. This router has a relatively fresh uboot (2018.09) compared to other Xiaomi devices, and it is capable of booting fit image firmware. Unfortunately, no successful attempt of booting OpenWrt fit image were made so far. The cause is still yet to be known. For now, we use legacy image instead. Signed-off-by: Raymond Wang --- package/boot/uboot-envtools/files/ramips | 5 + .../dts/mt7621_xiaomi_mi-router-cr6606.dts | 8 + .../dts/mt7621_xiaomi_mi-router-cr6608.dts | 8 + .../dts/mt7621_xiaomi_mi-router-cr6609.dts | 8 + .../dts/mt7621_xiaomi_mi-router-cr660x.dtsi | 192 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 34 ++++ .../mt7621/base-files/etc/board.d/01_leds | 5 + .../mt7621/base-files/etc/board.d/02_network | 3 + .../mt7621/base-files/lib/upgrade/platform.sh | 3 + 9 files changed, 266 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6606.dts create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6608.dts create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6609.dts create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index d4c8424571..e0ea92bf43 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -70,6 +70,11 @@ zyxel,nr7101) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x80000" ;; +xiaomi,mi-router-cr6606|\ +xiaomi,mi-router-cr6608|\ +xiaomi,mi-router-cr6609) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" + ;; esac config_load ubootenv diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6606.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6606.dts new file mode 100644 index 0000000000..59112fd06a --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6606.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-cr660x.dtsi" + +/ { + compatible = "xiaomi,mi-router-cr6606", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router CR6606"; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6608.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6608.dts new file mode 100644 index 0000000000..825435d0ba --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6608.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-cr660x.dtsi" + +/ { + compatible = "xiaomi,mi-router-cr6608", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router CR6608"; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6609.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6609.dts new file mode 100644 index 0000000000..719b88caae --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6609.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-cr660x.dtsi" + +/ { + compatible = "xiaomi,mi-router-cr6609", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router CR6609"; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi new file mode 100644 index 0000000000..dfdbcc77d4 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_sys_yellow; + led-failsafe = &led_sys_yellow; + led-running = &led_sys_blue; + led-upgrade = &led_sys_yellow; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + led_sys_yellow: sys_yellow { + label = "yellow:sys"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_sys_blue: sys_blue { + label = "blue:sys"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + net_yellow { + label = "yellow:net"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + net_blue { + label = "blue:net"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "Nvram"; + reg = <0x80000 0x40000>; + read-only; + }; + + partition@c0000 { + label = "Bdata"; + reg = <0xc0000 0x40000>; + read-only; + }; + + factory: partition@100000 { + label = "Factory"; + reg = <0x100000 0x80000>; + read-only; + }; + + partition@180000 { + label = "crash"; + reg = <0x180000 0x40000>; + read-only; + }; + + partition@1c0000 { + label = "crash_log"; + reg = <0x1c0000 0x40000>; + read-only; + }; + + /* "kernel" and "ubi" partition is the result of + * squashing next consecutive stock partitions: + * 1. firmware 0x0200000 - 0x2000000 (Stock firmware 0) + * 2. firmware1 0x2000000 - 0x3e00000 (Stock firmware 1) + * 3. overlay 0x3e00000 - 0x7000000 (Stock fw Ubi overlay) + * 4. obr 0x7000000 - 0x8000000 (Unallocated?) + */ + + partition@200000 { + label = "kernel"; + reg = <0x200000 0x400000>; + }; + + partition@600000 { + label = "ubi"; + reg = <0x600000 0x7980000>; + }; + + /* + * Leave 512 KiB for the bad block table + */ + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_3fff4>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@4 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_3fffa>; + nvmem-cell-names = "mac-address"; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart3", "wdt"; + function = "gpio"; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_3fff4: macaddr@3fff4 { + reg = <0x3fff4 0x6>; + }; + + macaddr_factory_3fffa: macaddr@3fffa { + reg = <0x3fffa 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index a461c57f15..f229ec1fa7 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1721,6 +1721,40 @@ define Device/xiaomi_mi-router-ac2100 endef TARGET_DEVICES += xiaomi_mi-router-ac2100 +define Device/xiaomi_mi-router-cr660x + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + DEVICE_VENDOR := Xiaomi + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + UBINIZE_OPTS := -E 5 + IMAGE_SIZE := 128512k + IMAGES += firmware.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/firmware.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size + DEVICE_PACKAGES += kmod-mt7915e uboot-envtools +endef + +define Device/xiaomi_mi-router-cr6606 + $(Device/xiaomi_mi-router-cr660x) + DEVICE_MODEL := Mi Router CR6606 +endef +TARGET_DEVICES += xiaomi_mi-router-cr6606 + +define Device/xiaomi_mi-router-cr6608 + $(Device/xiaomi_mi-router-cr660x) + DEVICE_MODEL := Mi Router CR6608 +endef +TARGET_DEVICES += xiaomi_mi-router-cr6608 + +define Device/xiaomi_mi-router-cr6609 + $(Device/xiaomi_mi-router-cr660x) + DEVICE_MODEL := Mi Router CR6609 +endef +TARGET_DEVICES += xiaomi_mi-router-cr6609 + define Device/xiaomi_redmi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Redmi Router AC2100 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 29962f41d7..b167cff857 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -120,6 +120,11 @@ tplink,re650-v1) xiaomi,mi-router-ac2100) ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan" ;; +xiaomi,mi-router-cr6606|\ +xiaomi,mi-router-cr6608|\ +xiaomi,mi-router-cr6609) + ucidef_set_led_netdev "internet" "Internet" "blue:net" "wan" + ;; xiaomi,redmi-router-ac2100) ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 52e0b6b572..3f758f26a1 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -26,6 +26,9 @@ ramips_setup_interfaces() hiwifi,hc5962|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-ac2100|\ + xiaomi,mi-router-cr6606|\ + xiaomi,mi-router-cr6608|\ + xiaomi,mi-router-cr6609|\ xiaomi,redmi-router-ac2100) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 8e1bdc157f..9575ced1b9 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -86,6 +86,9 @@ platform_do_upgrade() { xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ xiaomi,mi-router-ac2100|\ + xiaomi,mi-router-cr6606|\ + xiaomi,mi-router-cr6608|\ + xiaomi,mi-router-cr6609|\ xiaomi,redmi-router-ac2100) nand_do_upgrade "$1" ;; From af79853c73ad333b71a1ca5e3fbf58e168a953b6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 7 Feb 2022 09:03:13 +0100 Subject: [PATCH 131/144] Revert "tools/zstd: update to 1.5.2" This reverts commit 8de901ccf7e2b227bd970e9c477f00c15ce6aae9. Apparently this update breaks tools building. Signed-off-by: Jo-Philipp Wich --- tools/Makefile | 2 +- tools/zstd/Makefile | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 0950f3aee1..681344a014 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -74,7 +74,7 @@ $(curdir)/sdcc/compile := $(curdir)/bison/compile $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile $(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zlib/compile := $(curdir)/cmake/compile -$(curdir)/zstd/compile := $(curdir)/meson/compile +$(curdir)/zstd/compile := $(curdir)/cmake/compile ifneq ($(HOST_OS),Linux) $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile index 93f6745976..b93a5d2b52 100644 --- a/tools/zstd/Makefile +++ b/tools/zstd/Makefile @@ -1,35 +1,25 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zstd -PKG_VERSION:=1.5.2 +PKG_VERSION:=1.5.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION) -PKG_HASH:=7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0 +PKG_HASH:=5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:facebook:zstandard +CMAKE_SOURCE_SUBDIR:=build/cmake + include $(INCLUDE_DIR)/host-build.mk -include $(INCLUDE_DIR)/meson.mk +include $(INCLUDE_DIR)/cmake.mk -MESON_HOST_BUILD_DIR:=$(HOST_BUILD_DIR)/build/meson/openwrt-build - -HOSTCC:= $(HOSTCC_NOCACHE) -HOST_LDFLAGS += -Wl,-rpath,$(STAGING_DIR_HOST)/lib - -MESON_HOST_ARGS += \ - -Dlegacy_level=7 \ - -Ddebug_level=0 \ - -Dbacktrace=false \ - -Dstatic_runtime=false \ - -Dbin_programs=true \ - -Dbin_tests=false \ - -Dbin_contrib=false \ - -Dmulti_thread=enabled \ - -Dzlib=disabled \ - -Dlzma=disabled \ - -Dlz4=disabled +CMAKE_HOST_OPTIONS += \ + -DBUILD_TESTING=OFF \ + -DCMAKE_C_COMPILER_LAUNCHER="" \ + -DCMAKE_C_COMPILER=$(HOSTCC_NOCACHE) \ + -DZSTD_LEGACY_SUPPORT=OFF $(eval $(call HostBuild)) From 3b1692c463fae107177fcee51874696f6323d0d2 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 7 Feb 2022 09:17:49 +0100 Subject: [PATCH 132/144] netifd: update to latest Git HEAD fd4c9e1 system-linux: expose hw-tc-offload ethtool feature in device status dump 3d76f2e system-linux: add wrapper function for creating link config messages 88af2f1 system-linux: delete bridge devices using netlink 85c3548 system-linux: create bridge devices using netlink Signed-off-by: Jo-Philipp Wich --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index a93a2b0f72..4d2c803fa2 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2022-01-22 -PKG_SOURCE_VERSION:=ed7187684685430ee6de49e551775badbee39761 -PKG_MIRROR_HASH:=f26e968c79e61b1a4495b29f51e4adfb2238ede16c0d7349cce38ac009b72969 +PKG_SOURCE_DATE:=2022-02-04 +PKG_SOURCE_VERSION:=fd4c9e17c8f22b866c1bf386c580074e3e678910 +PKG_MIRROR_HASH:=ffd3eed50fb8eb354258922053cd098ead6f739c9fda67f8058a6ec9bd0167c4 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 134c88c6899df58dae4f70b9d361d7d1d686c6c4 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 7 Feb 2022 10:19:02 +0100 Subject: [PATCH 133/144] ucode: update to latest Git HEAD 11adf0c source: convert source objects into proper uc_value_t type 3a49192 treewide: rework function memory model 7edad5c tests: add functional tests for builtin functions d5003fd lib: fix leaking tokener in uc_json() on parse exception 5d0ecd9 lib: fix infinite loop on empty regexp matches in uc_replace() 3ad57f1 lib: fix infinite loop on empty regexp matches in uc_match() 32d596d lib: fix infinite loop on empty regexp matches in uc_split() 3e3f38d vm: ensure consistent trace output between gcc and clang compiled ucode 3600ded vm: fix leaking function value on call exception 3059295 vm: NULL-initialize pointer to make cppcheck happy 98e59bf source: zero-initialize conversion union to make cppcheck happy 7a65c14 run_tests.sh: change workdir to testcase directory during execution afec8d7 run_tests.sh: support placing supplemental testcase files 3ada6e0 run_tests.sh: always treat outputs as text data 2cb627f program: rename bytecode load/write functions, track path of executed file 1094ffa lib: fix memory leak in uc_require_ucode() Signed-off-by: Jo-Philipp Wich --- package/utils/ucode/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index f53a3a3529..4d66cc9f6c 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2022-01-26 -PKG_SOURCE_VERSION:=ddc5aa7cd3121300f2ba6e68cb038258a616d4e4 -PKG_MIRROR_HASH:=f9a3c010c54288a2363757b58ef31a827b8314e444bb7bf48926f7d4ea88b9d6 +PKG_SOURCE_DATE:=2022-02-07 +PKG_SOURCE_VERSION:=11adf0c4ea91e63ec523849c2846fd07bf4348f5 +PKG_MIRROR_HASH:=cd7639cb08ead23c1d659e293ec90fda733785ee5432c3a1d7d54df17e0f6d20 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 2dd6777f15defc6fe343e8485d3e22325570fb2b Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 3 Feb 2022 23:47:56 +0100 Subject: [PATCH 134/144] firewall4: update to latest Git HEAD b54f462 fw4: parse traffic rules before forwarding rules 4d5af8b fw4: consolidate helper code 300c737 fw4: fix applying zone family restrictions to forwardings eb9c25a tests: implement fs.opendir() mock interface d30ff48 tests: fix mocked fs.popen() trace log 52831a0 fw4: improve flowtable handling 7cb10c8 fw4: disable "flow_offloading_hw" option for now b2241a1 fw4: fix enabling NAT reflection rules for DNATs without explicit family Signed-off-by: Jo-Philipp Wich --- package/network/config/firewall4/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index d35b0e31d2..7fb8c3049a 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2022-01-28 -PKG_SOURCE_VERSION:=3ee6a5c54d5c32a635870fae402420d8c653476c -PKG_MIRROR_HASH:=73523e6d118733d48dc9e068181caa31fedbcafb8850bd43421b7d5d169bf088 +PKG_SOURCE_DATE:=2022-02-07 +PKG_SOURCE_VERSION:=b54f462272c3a68a1a733a9037dc7c109c54499d +PKG_MIRROR_HASH:=dc9ffcc94e3a2d461da22f740d19112a9ea9fedbeb58051a7c79bdca3b145d2d PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 881a059977166f9ef45fdcc283f763b75409b217 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 23 Nov 2021 19:30:30 +0100 Subject: [PATCH 135/144] uhttpd: update to latest Git HEAD 2f8b136 main: fix leaking -p/-s argument values 881fd3b ucode: adjust to latest ucode api 8b2868e file: specify UTF-8 as charset for dirlists, add option to override 3a5bd84 main: add ucode options to help text 16aa142 examples: add ucode handler example 3ceccd0 ucode: add ucode plugin support f0f1406 examples: add example Lua handler script 9e87095 listen: avoid invalid memory access Signed-off-by: Jo-Philipp Wich --- package/network/services/uhttpd/Makefile | 42 +++++++++++++++---- .../services/uhttpd/files/uhttpd.config | 8 ++++ .../network/services/uhttpd/files/uhttpd.init | 15 +++++++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index dce5aa87b8..616f92a0cb 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -8,19 +8,19 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git -PKG_SOURCE_DATE:=2021-03-21 -PKG_SOURCE_VERSION:=15346de8d3ba422002496526ee24c62a3601ab8c -PKG_MIRROR_HASH:=819424d071ed7c8888f9ca66f679907831becc59a67dd4a5ec521d5fba0a3171 +PKG_SOURCE_DATE:=2022-02-07 +PKG_SOURCE_VERSION:=2f8b1360df25bab375ec60bbba2dce8dd796161c +PKG_MIRROR_HASH:=fe9c57492e4da493e9955994d1af6cf0086305633fa8febef7ab6df10c4798fa PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC PKG_ASLR_PIE_REGULAR:=1 PKG_BUILD_DEPENDS = ustream-ssl -PKG_CONFIG_DEPENDS:= CONFIG_uhttpd_lua +PKG_CONFIG_DEPENDS:= CONFIG_uhttpd_lua CONFIG_uhttpd_ucode include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -49,8 +49,20 @@ define Package/uhttpd/config depends on PACKAGE_uhttpd-mod-lua bool "Enable Integrated Lua interpreter" default y + + config uhttpd_ucode + depends on PACKAGE_uhttpd-mod-ucode + bool "Enable Integrated ucode interpreter" + default y endef +define Package/uhttpd/conffiles +/etc/config/uhttpd +/etc/uhttpd.crt +/etc/uhttpd.key +endef + + define Package/uhttpd-mod-lua $(Package/uhttpd/default) TITLE+= (Lua plugin) @@ -73,12 +85,18 @@ define Package/uhttpd-mod-ubus/description session.* namespace and procedures. endef -define Package/uhttpd/conffiles -/etc/config/uhttpd -/etc/uhttpd.crt -/etc/uhttpd.key + +define Package/uhttpd-mod-ucode + $(Package/uhttpd/default) + TITLE+= (ucode plugin) + DEPENDS:=uhttpd +libucode endef +define Package/uhttpd-mod-ucode/description + The ucode plugin adds a CGI-like ucode runtime interface to uHTTPd. +endef + + ifneq ($(CONFIG_USE_GLIBC),) TARGET_CFLAGS += -D_DEFAULT_SOURCE endif @@ -108,7 +126,13 @@ define Package/uhttpd-mod-ubus/install $(INSTALL_DATA) ./files/ubus.default $(1)/etc/uci-defaults/00_uhttpd_ubus endef +define Package/uhttpd-mod-ucode/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_ucode.so $(1)/usr/lib/ +endef + $(eval $(call BuildPackage,uhttpd)) $(eval $(call BuildPackage,uhttpd-mod-lua)) $(eval $(call BuildPackage,uhttpd-mod-ubus)) +$(eval $(call BuildPackage,uhttpd-mod-ucode)) diff --git a/package/network/services/uhttpd/files/uhttpd.config b/package/network/services/uhttpd/files/uhttpd.config index 40ce67fd01..a9b8ff3d15 100644 --- a/package/network/services/uhttpd/files/uhttpd.config +++ b/package/network/services/uhttpd/files/uhttpd.config @@ -57,6 +57,14 @@ config uhttpd main # matches have precedence over the CGI prefix. list lua_prefix "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua" + # List of prefix->ucode handler mappings. + # Any request to an URL beneath the prefix + # will be dispatched to the associated ucode + # handler script. Ucode support is disabled when + # no handler mappings are specified. Ucode prefix + # matches have precedence over the CGI prefix. +# list ucode_prefix "/ucode/example=/usr/share/example.uc" + # Specify the ubus-rpc prefix and socket path. # option ubus_prefix /ubus # option ubus_socket /var/run/ubus/ubus.sock diff --git a/package/network/services/uhttpd/files/uhttpd.init b/package/network/services/uhttpd/files/uhttpd.init index 30fd7b4259..8dbc23f59c 100755 --- a/package/network/services/uhttpd/files/uhttpd.init +++ b/package/network/services/uhttpd/files/uhttpd.init @@ -91,6 +91,18 @@ append_lua_prefix() { fi } +append_ucode_prefix() { + local v="$1" + local prefix="${v%%=*}" + local handler="${v#*=}" + + if [ "$prefix" != "$handler" ] && [ -n "$prefix" ] && [ -f "$handler" ]; then + procd_append_param command -o "$prefix" -O "$handler" + else + echo "Skipping invalid ucode prefix \"$v\"" >&2 + fi +} + start_instance() { UHTTPD_CERT="" @@ -142,6 +154,9 @@ start_instance() append_arg "$cfg" ubus_socket "-U" append_bool "$cfg" ubus_cors "-X" 0 } + [ -f /usr/lib/uhttpd_ucode.so ] && { + config_list_foreach "$cfg" ucode_prefix append_ucode_prefix + } append_arg "$cfg" script_timeout "-t" append_arg "$cfg" network_timeout "-T" append_arg "$cfg" http_keepalive "-k" From 07eccc29ab96c6dcbdfb28f52f813731200cb149 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 7 Feb 2022 10:31:17 +0100 Subject: [PATCH 136/144] rpcd: update to latest Git HEAD 909f2a0 ucode: adjust to latest ucode api 4c532bf ucode: add ucode interpreter plugin 9c6ba38 treewide: adjust ubus object type names 75a96dc build: honour CMake install prefix in hardcoded paths Signed-off-by: Jo-Philipp Wich --- package/system/rpcd/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 9b1f239623..c6ec0c5431 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_MIRROR_HASH:=98071b4a1ce983a0e738d7e4a2f6e52b7f6db19f99510ddef430093314134ca4 -PKG_SOURCE_DATE:=2021-11-04 -PKG_SOURCE_VERSION:=d11ffe9383ae0ec34836421926364b24c1d891ca +PKG_MIRROR_HASH:=186a7246c610fecc282b0966213350ff4508b0db88739345e7c79792db0423ce +PKG_SOURCE_DATE:=2022-02-07 +PKG_SOURCE_VERSION:=909f2a04763dbc745488384b24281eca180452d6 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -72,7 +72,7 @@ endef # 3: plugin title/description define BuildPlugin - PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_luci-rpc-mod-$(1) + PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_rpcd-mod-$(1) define Package/rpcd-mod-$(1) $(Package/rpcd/default) @@ -102,3 +102,4 @@ $(eval $(call BuildPackage,rpcd)) $(eval $(call BuildPlugin,file,,Provides ubus calls for file and directory operations.)) $(eval $(call BuildPlugin,rpcsys,,Provides ubus calls for sysupgrade and password changing.)) $(eval $(call BuildPlugin,iwinfo,+libiwinfo,Provides ubus calls for accessing iwinfo data.)) +$(eval $(call BuildPlugin,ucode,+libucode,Allows implementing plugins using ucode scripts.)) From 46e0eeb760c9d1da38660f9a02119a558d403625 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 7 Feb 2022 13:11:01 +0100 Subject: [PATCH 137/144] hostapd: automatically calculate channel center freq on chan_switch Simplifies switching to different channels when on >= VHT80 Signed-off-by: Felix Fietkau --- .../services/hostapd/src/src/ap/ubus.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 3c016124f9..5855b25794 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -11,6 +11,7 @@ #include "utils/eloop.h" #include "utils/wpabuf.h" #include "common/ieee802_11_defs.h" +#include "common/hw_features_common.h" #include "hostapd.h" #include "neighbor_db.h" #include "wps_hostapd.h" @@ -22,6 +23,7 @@ #include "wnm_ap.h" #include "taxonomy.h" #include "airtime_policy.h" +#include "hw_features.h" static struct ubus_context *ctx; static struct blob_buf b; @@ -801,6 +803,7 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, struct hostapd_data *hapd = get_hapd_from_object(obj); struct hostapd_config *iconf = hapd->iface->conf; struct hostapd_freq_params *freq_params; + struct hostapd_hw_modes *mode = hapd->iface->current_mode; struct csa_settings css = { .freq_params = { .ht_enabled = iconf->ieee80211n, @@ -809,6 +812,8 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, .sec_channel_offset = iconf->secondary_channel, } }; + u8 chwidth = hostapd_get_oper_chwidth(iconf); + u8 seg0 = 0, seg1 = 0; int ret = UBUS_STATUS_OK; int i; @@ -850,6 +855,35 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); + css.freq_params.channel = hostapd_hw_get_channel(hapd, css.freq_params.freq); + if (!css.freq_params.channel) + return UBUS_STATUS_NOT_SUPPORTED; + + switch (css.freq_params.bandwidth) { + case 160: + chwidth = CHANWIDTH_160MHZ; + break; + case 80: + chwidth = css.freq_params.center_freq2 ? CHANWIDTH_80P80MHZ : CHANWIDTH_80MHZ; + break; + default: + chwidth = CHANWIDTH_USE_HT; + break; + } + + hostapd_set_freq_params(&css.freq_params, iconf->hw_mode, + css.freq_params.freq, + css.freq_params.channel, iconf->enable_edmg, + iconf->edmg_channel, + css.freq_params.ht_enabled, + css.freq_params.vht_enabled, + css.freq_params.he_enabled, + css.freq_params.sec_channel_offset, + chwidth, seg0, seg1, + iconf->vht_capab, + mode ? &mode->he_capab[IEEE80211_MODE_AP] : + NULL); + for (i = 0; i < hapd->iface->num_bss; i++) { struct hostapd_data *bss = hapd->iface->bss[i]; From ae75541594c1802be16140aeb59254e1c75fe7a8 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 7 Feb 2022 23:31:45 +0100 Subject: [PATCH 138/144] firewall4: update to latest Git HEAD a0518b6 fw4: gracefully handle unsupported hardware offloading ac99eba init: fix boot action in init script Signed-off-by: Jo-Philipp Wich --- package/network/config/firewall4/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index 7fb8c3049a..36ab8796e2 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2022-02-07 -PKG_SOURCE_VERSION:=b54f462272c3a68a1a733a9037dc7c109c54499d -PKG_MIRROR_HASH:=dc9ffcc94e3a2d461da22f740d19112a9ea9fedbeb58051a7c79bdca3b145d2d +PKG_SOURCE_DATE:=2022-02-07.1 +PKG_SOURCE_VERSION:=a0518b6d0273ad3267e65953e52989a1589fefab +PKG_MIRROR_HASH:=feebf9cbcdf6e5f702edea711c8b36dbaa7609c32e4fe5a2abbf1aa288dc7c6a PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From adb8c09a83d3f8e1d9e9fcbb8189b415ac0f6e86 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 17 Jan 2022 20:57:04 +0100 Subject: [PATCH 139/144] hostapd: update to v2.10 Upstreamed patches: 020-mesh-make-forwarding-configurable.patch e6db1bc5da3fd7d5f4dba24aa102543b4749912f 550-WNM-allow-specifying-dialog-token.patch 979f19716539362f8ce60a77bf1b88fdcf5ba8e5 720-ACS-fix-channel-100-frequency.patch 2341585c349231af00cdef8d51458df01bc6965f 741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch 08bdf4f90de61a84ed8f4dd918272dd9d36e2e1f Compile-tested: wpad-wolfssl hostapd-openssl Run-tested: ath79-generic Signed-off-by: David Bauer Tested-by: Stijn Tintel --- package/network/services/hostapd/Makefile | 6 +- ...hannels-to-be-selected-if-dfs-is-ena.patch | 60 +++-- ...20-mesh-make-forwarding-configurable.patch | 219 ------------------ .../hostapd/patches/301-mesh-noscan.patch | 15 +- .../patches/470-survey_data_fallback.patch | 22 +- ...50-WNM-allow-specifying-dialog-token.patch | 99 -------- .../720-ACS-fix-channel-100-frequency.patch | 30 --- ...ompilation-with-Hotspot-2.0-disabled.patch | 51 ---- .../services/hostapd/src/src/ap/ubus.c | 2 +- 9 files changed, 57 insertions(+), 447 deletions(-) delete mode 100644 package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch delete mode 100644 package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch delete mode 100644 package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch delete mode 100644 package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 7e4056bb18..584695786f 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-05-22 -PKG_SOURCE_VERSION:=b102f19bcc53c7f7db3951424d4d46709b4f1986 -PKG_MIRROR_HASH:=cb3cb968883042fc582752be1607586696c18e6ecf9808c9a8ac50e204584367 +PKG_SOURCE_DATE:=2022-01-16 +PKG_SOURCE_VERSION:=cff80b4f7d3c0a47c052e8187d671710f48939e4 +PKG_MIRROR_HASH:=712965bfa11a2e601d3e1c9a51a2cf3cffc6db89abafb3df3eb0cfd83c64705b PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch index d948c41b30..16d24d1000 100644 --- a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +++ b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch @@ -14,16 +14,37 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2395,6 +2395,8 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2409,7 +2409,7 @@ static int drv_supports_vht(struct wpa_s + } + + +-static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode) ++static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode, bool dfs_enabled) + { + int i; + +@@ -2418,7 +2418,10 @@ static bool ibss_mesh_is_80mhz_avail(int + + chan = hw_get_channel_chan(mode, i, NULL); + if (!chan || +- chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) ++ chan->flag & HOSTAPD_CHAN_DISABLED) ++ return false; ++ ++ if (!dfs_enabled && chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) + return false; + } + +@@ -2447,6 +2450,8 @@ void ibss_mesh_setup_freq(struct wpa_sup int chwidth, seg0, seg1; u32 vht_caps = 0; - int is_24ghz; -+ int dfs_enabled = wpa_s->conf->country[0] && -+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); + bool is_24ghz, is_6ghz; ++ bool dfs_enabled = wpa_s->conf->country[0] && ++ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); freq->freq = ssid->frequency; -@@ -2484,8 +2486,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2543,8 +2548,11 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Check primary channel flags */ @@ -36,7 +57,7 @@ Signed-off-by: Peter Oh freq->channel = pri_chan->chan; -@@ -2518,8 +2523,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2577,8 +2585,11 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Check secondary channel flags */ @@ -49,20 +70,25 @@ Signed-off-by: Peter Oh if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) -@@ -2612,8 +2620,11 @@ skip_ht40: - return; +@@ -2667,7 +2678,7 @@ skip_to_6ghz: + return; - /* Back to HT configuration if channel not usable */ -- if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) -+ if (chan->flag & HOSTAPD_CHAN_DISABLED) - return; -+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ return; - } + /* Back to HT configuration if channel not usable */ +- if (!ibss_mesh_is_80mhz_avail(channel, mode)) ++ if (!ibss_mesh_is_80mhz_avail(channel, mode, dfs_enabled)) + return; chwidth = CHANWIDTH_80MHZ; -@@ -2633,10 +2644,12 @@ skip_ht40: +@@ -2681,7 +2692,7 @@ skip_to_6ghz: + * above; check the remaining four 20 MHz channels for the total + * of 160 MHz bandwidth. + */ +- if (!ibss_mesh_is_80mhz_avail(channel + 16, mode)) ++ if (!ibss_mesh_is_80mhz_avail(channel + 16, mode, dfs_enabled)) + return; + + for (j = 0; j < ARRAY_SIZE(bw160); j++) { +@@ -2711,10 +2722,12 @@ skip_to_6ghz: if (!chan) continue; diff --git a/package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch deleted file mode 100644 index 75726a6750..0000000000 --- a/package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 90fe6429624fc48bc0e5d2d7eeecb7498708b5e3 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Wed, 18 Apr 2018 19:24:31 +0200 -Subject: [PATCH 18/18] mesh: make forwarding configurable - -Allow mesh_fwding to be specified in a mesh bss config, pass that -to the driver (only nl80211 implemented for now) and announce -forwarding capability accordingly. - -Signed-off-by: Daniel Golle ---- - src/ap/ap_config.h | 2 ++ - src/drivers/driver.h | 2 ++ - src/drivers/driver_nl80211.c | 3 +++ - wpa_supplicant/config.c | 4 ++++ - wpa_supplicant/config.h | 9 +++++++++ - wpa_supplicant/config_file.c | 4 ++++ - wpa_supplicant/config_ssid.h | 5 +++++ - wpa_supplicant/mesh.c | 6 ++++++ - wpa_supplicant/mesh_mpm.c | 4 ++-- - wpa_supplicant/wpa_supplicant.conf | 3 +++ - 10 files changed, 40 insertions(+), 2 deletions(-) - ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -51,6 +51,7 @@ struct mesh_conf { - int dot11MeshRetryTimeout; /* msec */ - int dot11MeshConfirmTimeout; /* msec */ - int dot11MeshHoldingTimeout; /* msec */ -+ int mesh_fwding; - }; - - #define MAX_STA_COUNT 2007 -@@ -696,6 +697,7 @@ struct hostapd_bss_config { - - #define MESH_ENABLED BIT(0) - int mesh; -+ int mesh_fwding; - - u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1584,6 +1584,7 @@ struct wpa_driver_mesh_bss_params { - #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 - #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 - #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 -+#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020 - /* - * TODO: Other mesh configuration parameters would go here. - * See NL80211_MESHCONF_* for all the mesh config parameters. -@@ -1593,6 +1594,7 @@ struct wpa_driver_mesh_bss_params { - int peer_link_timeout; - int max_peer_links; - int rssi_threshold; -+ int forwarding; - u16 ht_opmode; - }; - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -10456,6 +10456,9 @@ static int nl80211_put_mesh_config(struc - if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && - nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, - params->auto_plinks)) || -+ ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) && -+ nla_put_u8(msg, NL80211_MESHCONF_FORWARDING, -+ params->forwarding)) || - ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) && - nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, - params->max_peer_links)) || ---- a/wpa_supplicant/config.c -+++ b/wpa_supplicant/config.c -@@ -2527,6 +2527,7 @@ static const struct parse_data ssid_fiel - #ifdef CONFIG_MESH - { INT_RANGE(mode, 0, 5) }, - { INT_RANGE(no_auto_peer, 0, 1) }, -+ { INT_RANGE(mesh_fwding, 0, 1) }, - { INT_RANGE(mesh_rssi_threshold, -255, 1) }, - #else /* CONFIG_MESH */ - { INT_RANGE(mode, 0, 4) }, -@@ -3106,6 +3107,7 @@ void wpa_config_set_network_defaults(str - ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; - ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; - ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; -+ ssid->mesh_fwding = DEFAULT_MESH_FWDING; - ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; - #endif /* CONFIG_MESH */ - #ifdef CONFIG_HT_OVERRIDES -@@ -4347,6 +4349,7 @@ struct wpa_config * wpa_config_alloc_emp - config->user_mpm = DEFAULT_USER_MPM; - config->max_peer_links = DEFAULT_MAX_PEER_LINKS; - config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; -+ config->mesh_fwding = DEFAULT_MESH_FWDING; - config->dot11RSNASAERetransPeriod = - DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; - config->fast_reauth = DEFAULT_FAST_REAUTH; -@@ -5047,6 +5050,7 @@ static const struct global_parse_data gl - { INT(user_mpm), 0 }, - { INT_RANGE(max_peer_links, 0, 255), 0 }, - { INT(mesh_max_inactivity), 0 }, -+ { INT_RANGE(mesh_fwding, 0, 1), 0 }, - { INT(dot11RSNASAERetransPeriod), 0 }, - #endif /* CONFIG_MESH */ - { INT(disable_scan_offload), 0 }, ---- a/wpa_supplicant/config.h -+++ b/wpa_supplicant/config.h -@@ -18,6 +18,7 @@ - #define DEFAULT_USER_MPM 1 - #define DEFAULT_MAX_PEER_LINKS 99 - #define DEFAULT_MESH_MAX_INACTIVITY 300 -+#define DEFAULT_MESH_FWDING 1 - /* - * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, - * but use 1000 ms in practice to avoid issues on low power CPUs. -@@ -1378,6 +1379,14 @@ struct wpa_config { - int mesh_max_inactivity; - - /** -+ * mesh_fwding - Mesh network layer-2 forwarding -+ * -+ * This controls whether to enable layer-2 forwarding. -+ * By default: 1: enabled -+ */ -+ int mesh_fwding; -+ -+ /** - * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame - * - * This timeout value is used in mesh STA to retransmit ---- a/wpa_supplicant/config_file.c -+++ b/wpa_supplicant/config_file.c -@@ -768,6 +768,7 @@ static void wpa_config_write_network(FIL - #endif /* IEEE8021X_EAPOL */ - INT(mode); - INT(no_auto_peer); -+ INT(mesh_fwding); - INT(frequency); - INT(enable_edmg); - INT(edmg_channel); -@@ -1449,6 +1450,9 @@ static void wpa_config_write_global(FILE - fprintf(f, "mesh_max_inactivity=%d\n", - config->mesh_max_inactivity); - -+ if (config->mesh_fwding != DEFAULT_MESH_FWDING) -+ fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding); -+ - if (config->dot11RSNASAERetransPeriod != - DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) - fprintf(f, "dot11RSNASAERetransPeriod=%d\n", ---- a/wpa_supplicant/config_ssid.h -+++ b/wpa_supplicant/config_ssid.h -@@ -546,6 +546,11 @@ struct wpa_ssid { - int dot11MeshConfirmTimeout; /* msec */ - int dot11MeshHoldingTimeout; /* msec */ - -+ /** -+ * Mesh network layer-2 forwarding -+ */ -+ int mesh_fwding; -+ - int ht; - int ht40; - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -140,6 +140,7 @@ static struct mesh_conf * mesh_config_cr - conf->mesh_cc_id = 0; - conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; - conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; -+ conf->mesh_fwding = ssid->mesh_fwding; - conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; - conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; - conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; -@@ -441,6 +442,7 @@ static int wpa_supplicant_mesh_init(stru - bss->conf->start_disabled = 1; - bss->conf->mesh = MESH_ENABLED; - bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; -+ bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; - - if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, - wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { -@@ -655,6 +657,10 @@ int wpa_supplicant_join_mesh(struct wpa_ - } - params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; - -+ /* always explicitely set forwarding to on or off for now */ -+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING; -+ params->conf.forwarding = ssid->mesh_fwding; -+ - os_free(wpa_s->mesh_params); - wpa_s->mesh_params = params; - if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { ---- a/wpa_supplicant/mesh_mpm.c -+++ b/wpa_supplicant/mesh_mpm.c -@@ -303,9 +303,9 @@ static void mesh_mpm_send_plink_action(s - info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; - /* TODO: Add Connected to Mesh Gate/AS subfields */ - wpabuf_put_u8(buf, info); -- /* always forwarding & accepting plinks for now */ -+ /* set forwarding & always accepting plinks for now */ - wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER | -- MESH_CAP_FORWARDING); -+ (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); - } else { /* Peer closing frame */ - /* IE: Mesh ID */ - wpabuf_put_u8(buf, WLAN_EID_MESH_ID); ---- a/wpa_supplicant/wpa_supplicant.conf -+++ b/wpa_supplicant/wpa_supplicant.conf -@@ -150,6 +150,9 @@ ap_scan=1 - # This timeout value is used in mesh STA to clean up inactive stations. - #mesh_max_inactivity=300 - -+# Enable 802.11s layer-2 routing and forwarding -+#mesh_fwding=1 -+ - # cert_in_cb - Whether to include a peer certificate dump in events - # This controls whether peer certificates for authentication server and - # its certificate chain are included in EAP peer certificate events. This is diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index 0d78329441..e593ac49fe 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -10,7 +10,7 @@ { STR(id_str) }, --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -768,6 +768,7 @@ static void wpa_config_write_network(FIL +@@ -769,6 +769,7 @@ static void wpa_config_write_network(FIL #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); @@ -20,7 +20,7 @@ INT(enable_edmg); --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -474,6 +474,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -506,6 +506,8 @@ static int wpa_supplicant_mesh_init(stru frequency); goto out_free; } @@ -31,14 +31,17 @@ /* --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2384,12 +2384,12 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2436,7 +2436,7 @@ void ibss_mesh_setup_freq(struct wpa_sup int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode); enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; - int ht40plus[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, + int ht40plus[] = { 1, 2, 3, 4, 5, 6, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 184, 192 }; - int vht80[] = { 36, 52, 100, 116, 132, 149 }; + int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955, + 6035, 6115, 6195, 6275, 6355, 6435, 6515, +@@ -2444,7 +2444,7 @@ void ibss_mesh_setup_freq(struct wpa_sup + int bw160[] = { 5955, 6115, 6275, 6435, 6595, 6755, 6915 }; struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL; u8 channel; - int i, chan_idx, ht40 = -1, res, obss_scan = 1; @@ -46,7 +49,7 @@ unsigned int j, k; struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; -@@ -2473,7 +2473,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2535,7 +2535,7 @@ void ibss_mesh_setup_freq(struct wpa_sup #endif /* CONFIG_HE_OVERRIDES */ /* Setup higher BW only for 5 GHz */ @@ -57,7 +60,7 @@ for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -971,6 +971,8 @@ struct wpa_ssid { +@@ -979,6 +979,8 @@ struct wpa_ssid { */ int no_auto_peer; diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch index efd82599d3..359b5f3ef8 100644 --- a/package/network/services/hostapd/patches/470-survey_data_fallback.patch +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch @@ -1,26 +1,6 @@ --- a/src/ap/acs.c +++ b/src/ap/acs.c -@@ -302,18 +302,12 @@ static void acs_fail(struct hostapd_ifac - static long double - acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf) - { -- long double factor, busy, total; -+ long double factor, busy = 0, total; - - if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) - busy = survey->channel_time_busy; - else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX) - busy = survey->channel_time_rx; -- else { -- /* This shouldn't really happen as survey data is checked in -- * acs_sanity_check() */ -- wpa_printf(MSG_ERROR, "ACS: Survey data missing"); -- return 0; -- } - - total = survey->channel_time; - -@@ -422,20 +416,19 @@ static int acs_usable_bw160_chan(const s +@@ -420,20 +420,19 @@ static int acs_usable_bw160_chan(const s static int acs_survey_is_sufficient(struct freq_survey *survey) { if (!(survey->filled & SURVEY_HAS_NF)) { diff --git a/package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch b/package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch deleted file mode 100644 index 6c080adc0e..0000000000 --- a/package/network/services/hostapd/patches/550-WNM-allow-specifying-dialog-token.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 1b26807938815d0b0b266caf31d8ef0019607e64 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Mon, 27 Sep 2021 15:41:48 +0200 -Subject: [PATCH] WNM: allow specifying dialog-token - -This commit adds the ability to specify the dialog token of a WNM BSS -Transition request frame via the hostapd control socket. - -FOr this, the new 'dialog_token' option can be used. It accepts values -as a 8 bit unsigned integer. If not specified, the dialog token is set -to 1 like before. - -Signed-off-by: David Bauer ---- - hostapd/ctrl_iface.c | 10 ++++++++-- - src/ap/wnm_ap.c | 11 ++++++----- - src/ap/wnm_ap.h | 4 ++-- - 3 files changed, 16 insertions(+), 9 deletions(-) - ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -897,7 +897,7 @@ static int hostapd_ctrl_iface_bss_tm_req - const char *pos, *end; - int disassoc_timer = 0; - struct sta_info *sta; -- u8 req_mode = 0, valid_int = 0x01; -+ u8 req_mode = 0, valid_int = 0x01, dialog_token = 0x01; - u8 bss_term_dur[12]; - char *url = NULL; - int ret; -@@ -935,6 +935,12 @@ static int hostapd_ctrl_iface_bss_tm_req - valid_int = atoi(pos); - } - -+ pos = os_strstr(cmd, " dialog_token="); -+ if (pos) { -+ pos += 14; -+ dialog_token = atoi(pos); -+ } -+ - pos = os_strstr(cmd, " bss_term="); - if (pos) { - pos += 10; -@@ -1041,7 +1047,7 @@ static int hostapd_ctrl_iface_bss_tm_req - #endif /* CONFIG_MBO */ - - ret = wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, -- valid_int, bss_term_dur, url, -+ valid_int, bss_term_dur, dialog_token, url, - nei_len ? nei_rep : NULL, nei_len, - mbo_len ? mbo : NULL, mbo_len); - #ifdef CONFIG_MBO ---- a/src/ap/wnm_ap.c -+++ b/src/ap/wnm_ap.c -@@ -788,8 +788,8 @@ int wnm_send_ess_disassoc_imminent(struc - - int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta, - u8 req_mode, int disassoc_timer, u8 valid_int, -- const u8 *bss_term_dur, const char *url, -- const u8 *nei_rep, size_t nei_rep_len, -+ const u8 *bss_term_dur, u8 dialog_token, -+ const char *url, const u8 *nei_rep, size_t nei_rep_len, - const u8 *mbo_attrs, size_t mbo_len) - { - u8 *buf, *pos; -@@ -797,8 +797,9 @@ int wnm_send_bss_tm_req(struct hostapd_d - size_t url_len; - - wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request to " -- MACSTR " req_mode=0x%x disassoc_timer=%d valid_int=0x%x", -- MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int); -+ MACSTR " req_mode=0x%x disassoc_timer=%d valid_int=0x%x " -+ "dialog_token=%x", -+ MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int, dialog_token); - buf = os_zalloc(1000 + nei_rep_len + mbo_len); - if (buf == NULL) - return -1; -@@ -810,7 +811,7 @@ int wnm_send_bss_tm_req(struct hostapd_d - os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN); - mgmt->u.action.category = WLAN_ACTION_WNM; - mgmt->u.action.u.bss_tm_req.action = WNM_BSS_TRANS_MGMT_REQ; -- mgmt->u.action.u.bss_tm_req.dialog_token = 1; -+ mgmt->u.action.u.bss_tm_req.dialog_token = dialog_token; - mgmt->u.action.u.bss_tm_req.req_mode = req_mode; - mgmt->u.action.u.bss_tm_req.disassoc_timer = - host_to_le16(disassoc_timer); ---- a/src/ap/wnm_ap.h -+++ b/src/ap/wnm_ap.h -@@ -20,8 +20,8 @@ int wnm_send_ess_disassoc_imminent(struc - int disassoc_timer); - int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta, - u8 req_mode, int disassoc_timer, u8 valid_int, -- const u8 *bss_term_dur, const char *url, -- const u8 *nei_rep, size_t nei_rep_len, -+ const u8 *bss_term_dur, u8 dialog_token, -+ const char *url, const u8 *nei_rep, size_t nei_rep_len, - const u8 *mbo_attrs, size_t mbo_len); - void ap_sta_reset_steer_flag_timer(void *eloop_ctx, void *timeout_ctx); - int wnm_send_coloc_intf_req(struct hostapd_data *hapd, struct sta_info *sta, diff --git a/package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch b/package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch deleted file mode 100644 index 3ef19e5298..0000000000 --- a/package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 5a24286ed6315e1fef755ca1970792554f59b1fc Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Wed, 26 May 2021 22:15:35 +0200 -Subject: [PATCH] ACS: fix channel 100 frequency - -Channel 100 is a valid channel to choose for 80MHz operation. However, -it's assigned to 5500 MHz, not 5550MHz. In fact, there is no channel -assigned to this frequency. - -Fix this obbvious typo to allow ACS to select channel 100 for 80 MHz -operation again. - -Fixes commit bef5eee4f7b2 ("Convert channel to frequency based selection for AP mode ACS") - -Signed-off-by: David Bauer ---- - src/ap/acs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/ap/acs.c -+++ b/src/ap/acs.c -@@ -386,7 +386,7 @@ static int acs_usable_bw40_chan(const st - - static int acs_usable_bw80_chan(const struct hostapd_channel_data *chan) - { -- const int allowed[] = { 5180, 5260, 5550, 5580, 5660, 5745, 5955, 6035, -+ const int allowed[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955, 6035, - 6115, 6195, 6275, 6355, 6435, 6515, 6595, 6675, - 6755, 6835, 6915, 6995 }; - unsigned int i; diff --git a/package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch b/package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch deleted file mode 100644 index 657ef5f2ed..0000000000 --- a/package/network/services/hostapd/patches/741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ad694836b2ded6b97b426bf331627537cdbff591 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Thu, 19 Aug 2021 00:52:04 +0200 -Subject: [PATCH] proxyarp: fix compilation with Hotspot 2.0 disabled - -The disable_dgaf config fiels is only available in case Hostapd is -compiled with Hotspot 2.0 support, however Proxy-ARP does not depend on -Hotspot 2.0. - -Only add the code related to this config field when Hotspot 2.0 is -enabled to fix compilation with the aformentioned preconditions. - -Signed-off-by: David Bauer ---- - src/ap/dhcp_snoop.c | 2 ++ - src/ap/ndisc_snoop.c | 2 ++ - 2 files changed, 4 insertions(+) - ---- a/src/ap/dhcp_snoop.c -+++ b/src/ap/dhcp_snoop.c -@@ -88,6 +88,7 @@ static void handle_dhcp(void *ctx, const - } - } - -+#ifdef CONFIG_HS20 - if (hapd->conf->disable_dgaf && is_broadcast_ether_addr(buf)) { - for (sta = hapd->sta_list; sta; sta = sta->next) { - if (!(sta->flags & WLAN_STA_AUTHORIZED)) -@@ -96,6 +97,7 @@ static void handle_dhcp(void *ctx, const - (u8 *) buf, len); - } - } -+#endif - - if (msgtype == DHCPACK) { - if (b->your_ip == 0) ---- a/src/ap/ndisc_snoop.c -+++ b/src/ap/ndisc_snoop.c -@@ -151,10 +151,12 @@ static void handle_ndisc(void *ctx, cons - return; - } - break; -+#ifdef CONFIG_HS20 - case ROUTER_ADVERTISEMENT: - if (hapd->conf->disable_dgaf) - ucast_to_stas(hapd, buf, len); - break; -+#endif - case NEIGHBOR_ADVERTISEMENT: - if (hapd->conf->na_mcast_to_ucast) - ucast_to_stas(hapd, buf, len); diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 5855b25794..fdc2a3fd26 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -1229,7 +1229,7 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, memcpy(&ssid, s, ssid.ssid_len); } - hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0); + hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0, 0); wpabuf_free(data); continue; From 04ed224543ad10030c4394c86e533f02bf596a1b Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 17 Jan 2022 20:57:05 +0100 Subject: [PATCH 140/144] hostapd: refresh patches Refresh patches after updating to hostapd v2.10. Signed-off-by: David Bauer --- .../001-wolfssl-init-RNG-with-ECC-key.patch | 6 ++-- ...erministic-channel-on-channel-switch.patch | 6 ++-- ...ix-sta-add-after-previous-connection.patch | 4 +-- ...ewrite-neigh-code-to-not-depend-on-l.patch | 14 ++++---- .../hostapd/patches/050-build_fix.patch | 2 +- .../hostapd/patches/200-multicall.patch | 36 +++++++++---------- .../services/hostapd/patches/300-noscan.patch | 4 +-- .../hostapd/patches/301-mesh-noscan.patch | 4 +-- .../patches/310-rescan_immediately.patch | 2 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../341-mesh-ctrl-iface-channel-switch.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 10 +++--- .../patches/360-ctrl_iface_reload.patch | 4 +-- .../hostapd/patches/370-ap_sta_support.patch | 26 +++++++------- .../patches/380-disable_ctrl_iface_mib.patch | 26 +++++++------- .../400-wps_single_auth_enc_type.patch | 2 +- ...dd-new-config-params-to-be-used-with.patch | 6 ++-- ...-use-new-parameters-during-ibss-join.patch | 4 +-- .../patches/463-add-mcast_rate-to-11s.patch | 8 ++--- .../patches/464-fix-mesh-obss-check.patch | 2 +- .../patches/500-lto-jobserver-support.patch | 6 ++-- .../patches/590-rrm-wnm-statistics.patch | 6 ++-- .../hostapd/patches/600-ubus_support.patch | 34 +++++++++--------- .../hostapd/patches/700-wifi-reload.patch | 16 ++++----- .../hostapd/patches/710-vlan_no_bridge.patch | 2 +- .../patches/711-wds_bridge_force.patch | 2 +- .../patches/720-iface_max_num_sta.patch | 8 ++--- .../hostapd/patches/730-ft_iface.patch | 4 +-- .../hostapd/patches/740-snoop_iface.patch | 2 +- ...750-qos_map_set_without_interworking.patch | 14 ++++---- 30 files changed, 132 insertions(+), 132 deletions(-) diff --git a/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch b/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch index 84fc1c9351..994aa30626 100644 --- a/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch +++ b/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch @@ -16,7 +16,7 @@ Signed-off-by: David Bauer --- a/src/crypto/crypto_wolfssl.c +++ b/src/crypto/crypto_wolfssl.c -@@ -1303,6 +1303,7 @@ int ecc_projective_add_point(ecc_point * +@@ -1307,6 +1307,7 @@ int ecc_projective_add_point(ecc_point * struct crypto_ec { ecc_key key; @@ -24,7 +24,7 @@ Signed-off-by: David Bauer mp_int a; mp_int prime; mp_int order; -@@ -1357,6 +1358,8 @@ struct crypto_ec * crypto_ec_init(int gr +@@ -1361,6 +1362,8 @@ struct crypto_ec * crypto_ec_init(int gr return NULL; if (wc_ecc_init(&e->key) != 0 || @@ -33,7 +33,7 @@ Signed-off-by: David Bauer wc_ecc_set_curve(&e->key, 0, curve_id) != 0 || mp_init(&e->a) != MP_OKAY || mp_init(&e->prime) != MP_OKAY || -@@ -1388,6 +1391,7 @@ void crypto_ec_deinit(struct crypto_ec* +@@ -1392,6 +1395,7 @@ void crypto_ec_deinit(struct crypto_ec* mp_clear(&e->order); mp_clear(&e->prime); mp_clear(&e->a); diff --git a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch index 03a1e339a9..1faeacf766 100644 --- a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch +++ b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch @@ -29,7 +29,7 @@ Signed-off-by: Markus Theil static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1) -@@ -480,9 +481,14 @@ dfs_get_valid_channel(struct hostapd_ifa +@@ -483,9 +484,14 @@ dfs_get_valid_channel(struct hostapd_ifa int num_available_chandefs; int chan_idx, chan_idx2; int sec_chan_idx_80p80 = -1; @@ -44,7 +44,7 @@ Signed-off-by: Markus Theil wpa_printf(MSG_DEBUG, "DFS: Selecting random channel"); *secondary_channel = 0; *oper_centr_freq_seg0_idx = 0; -@@ -502,8 +508,20 @@ dfs_get_valid_channel(struct hostapd_ifa +@@ -505,8 +511,20 @@ dfs_get_valid_channel(struct hostapd_ifa if (num_available_chandefs == 0) return NULL; @@ -68,7 +68,7 @@ Signed-off-by: Markus Theil if (!chan) { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9872,6 +9872,10 @@ static int nl80211_switch_channel(void * +@@ -9895,6 +9895,10 @@ static int nl80211_switch_channel(void * if (ret) goto error; diff --git a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch index 124fd8bdf1..ac02ec5ab7 100644 --- a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch +++ b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch @@ -1,6 +1,6 @@ --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4942,6 +4942,13 @@ static int add_associated_sta(struct hos +@@ -4944,6 +4944,13 @@ static int add_associated_sta(struct hos * drivers to accept the STA parameter configuration. Since this is * after a new FT-over-DS exchange, a new TK has been derived, so key * reinstallation is not a concern for this case. @@ -14,7 +14,7 @@ */ wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)", -@@ -4955,7 +4962,8 @@ static int add_associated_sta(struct hos +@@ -4957,7 +4964,8 @@ static int add_associated_sta(struct hos (!(sta->flags & WLAN_STA_AUTHORIZED) || (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) || (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) && diff --git a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch b/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch index e8a78e355e..ade0b11311 100644 --- a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch +++ b/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -5284,26 +5281,29 @@ fail: +@@ -5300,26 +5297,29 @@ fail: static void rtnl_neigh_delete_fdb_entry(struct i802_bss *bss, const u8 *addr) { @@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau if (err < 0) { wpa_printf(MSG_DEBUG, "nl80211: bridge FDB entry delete for " MACSTR " ifindex=%d failed: %s", MAC2STR(addr), -@@ -5313,9 +5313,8 @@ static void rtnl_neigh_delete_fdb_entry( +@@ -5329,9 +5329,8 @@ static void rtnl_neigh_delete_fdb_entry( MACSTR, MAC2STR(addr)); } @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau } -@@ -7691,7 +7690,6 @@ static void *i802_init(struct hostapd_da +@@ -7714,7 +7713,6 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau if (bss->added_if_into_bridge || bss->already_in_bridge) { int err; -@@ -7708,7 +7706,6 @@ static void *i802_init(struct hostapd_da +@@ -7731,7 +7729,6 @@ static void *i802_init(struct hostapd_da goto failed; } } @@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { wpa_printf(MSG_DEBUG, -@@ -10655,13 +10652,14 @@ static int wpa_driver_br_add_ip_neigh(vo +@@ -10678,13 +10675,14 @@ static int wpa_driver_br_add_ip_neigh(vo const u8 *ipaddr, int prefixlen, const u8 *addr) { @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau int res; if (!ipaddr || prefixlen == 0 || !addr) -@@ -10680,85 +10678,66 @@ static int wpa_driver_br_add_ip_neigh(vo +@@ -10703,85 +10701,66 @@ static int wpa_driver_br_add_ip_neigh(vo } if (version == 4) { @@ -220,7 +220,7 @@ Signed-off-by: Felix Fietkau addrsize = 16; } else { return -EINVAL; -@@ -10776,41 +10755,30 @@ static int wpa_driver_br_delete_ip_neigh +@@ -10799,41 +10778,30 @@ static int wpa_driver_br_delete_ip_neigh return -1; } diff --git a/package/network/services/hostapd/patches/050-build_fix.patch b/package/network/services/hostapd/patches/050-build_fix.patch index 3da88fe290..2652a83316 100644 --- a/package/network/services/hostapd/patches/050-build_fix.patch +++ b/package/network/services/hostapd/patches/050-build_fix.patch @@ -10,7 +10,7 @@ CFLAGS += -DCONFIG_FILS_SK_PFS --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -309,6 +309,7 @@ endif +@@ -312,6 +312,7 @@ endif ifdef CONFIG_FILS CFLAGS += -DCONFIG_FILS NEED_SHA384=y diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index ceeaf5169b..ad82e020f6 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -36,7 +36,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1278,6 +1284,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1281,6 +1287,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) _OBJS_VAR := OBJS include ../src/objs.mk @@ -49,7 +49,7 @@ hostapd: $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1352,6 +1364,12 @@ include ../src/objs.mk +@@ -1355,6 +1367,12 @@ include ../src/objs.mk _OBJS_VAR := SOBJS include ../src/objs.mk @@ -72,7 +72,7 @@ include ../src/build.rules ifdef LIBS -@@ -360,7 +361,9 @@ endif +@@ -363,7 +364,9 @@ endif ifdef CONFIG_IBSS_RSN NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_IBSS_RSN @@ -82,7 +82,7 @@ OBJS += ibss_rsn.o endif -@@ -898,6 +901,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -900,6 +903,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -93,7 +93,7 @@ endif ifdef CONFIG_AP -@@ -905,9 +912,11 @@ NEED_EAP_COMMON=y +@@ -907,9 +914,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -105,7 +105,7 @@ OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -987,6 +996,12 @@ endif +@@ -989,6 +998,12 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -118,7 +118,7 @@ endif ifdef CONFIG_MBO -@@ -995,7 +1010,9 @@ CFLAGS += -DCONFIG_MBO +@@ -997,7 +1012,9 @@ CFLAGS += -DCONFIG_MBO endif ifdef NEED_RSN_AUTHENTICATOR @@ -128,7 +128,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1890,6 +1907,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1891,6 +1908,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) _OBJS_VAR := OBJS include ../src/objs.mk @@ -141,7 +141,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -2022,6 +2045,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK) +@@ -2023,6 +2046,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK) $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ @$(E) " sed" $< @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6025,8 +6025,8 @@ union wpa_event_data { +@@ -6033,8 +6033,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -6038,7 +6038,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6046,7 +6046,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -178,7 +178,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1836,8 +1836,8 @@ err: +@@ -1842,8 +1842,8 @@ err: #endif /* CONFIG_OWE */ @@ -189,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -2082,7 +2082,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2088,7 +2088,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4665,8 +4665,8 @@ static void wpas_event_unprot_beacon(str +@@ -4891,8 +4891,8 @@ static void wpas_event_unprot_beacon(str } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -5511,7 +5511,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5745,7 +5745,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6819,7 +6819,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -7043,7 +7043,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -6854,6 +6853,11 @@ static int wpa_supplicant_match_existing +@@ -7078,6 +7077,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -7110,6 +7114,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -7334,6 +7338,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 93b0934283..01a33d0d03 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3459,6 +3459,10 @@ static int hostapd_config_fill(struct ho +@@ -3474,6 +3474,10 @@ static int hostapd_config_fill(struct ho if (bss->ocv && !bss->ieee80211w) bss->ieee80211w = 1; #endif /* CONFIG_OCV */ @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1009,6 +1009,8 @@ struct hostapd_config { +@@ -1014,6 +1014,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index e593ac49fe..e682efb543 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -20,7 +20,7 @@ INT(enable_edmg); --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -506,6 +506,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -505,6 +505,8 @@ static int wpa_supplicant_mesh_init(stru frequency); goto out_free; } @@ -60,7 +60,7 @@ for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -979,6 +979,8 @@ struct wpa_ssid { +@@ -974,6 +974,8 @@ struct wpa_ssid { */ int no_auto_peer; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index 7f5e207069..b0c1cb8354 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5154,7 +5154,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -5377,7 +5377,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index ca586d862c..37033c3035 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4970,7 +4970,7 @@ static int nl80211_set_channel(struct i8 +@@ -4986,7 +4986,7 @@ static int nl80211_set_channel(struct i8 freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); diff --git a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch index 73f81f65e6..b13dcb0673 100644 --- a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch +++ b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1513,15 +1513,35 @@ int ap_switch_channel(struct wpa_supplic +@@ -1611,15 +1611,35 @@ int ap_switch_channel(struct wpa_supplic #ifdef CONFIG_CTRL_IFACE diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index 656b744aa7..35567838f5 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2915,10 +2915,15 @@ static int wpa_driver_nl80211_del_beacon +@@ -2931,10 +2931,15 @@ static int wpa_driver_nl80211_del_beacon struct nl_msg *msg; struct wpa_driver_nl80211_data *drv = bss->drv; @@ -18,7 +18,7 @@ return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); } -@@ -5601,7 +5606,7 @@ static void nl80211_teardown_ap(struct i +@@ -5617,7 +5622,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -27,7 +27,7 @@ } -@@ -8048,8 +8053,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -8071,8 +8076,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -36,7 +36,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -8446,7 +8449,6 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -8469,7 +8472,6 @@ static int wpa_driver_nl80211_deinit_ap( if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -44,7 +44,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -8466,7 +8468,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -8489,7 +8491,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index 349522e06a..7f3aa91889 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -78,7 +78,7 @@ #ifdef NEED_AP_MLME static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, -@@ -3754,6 +3811,8 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3771,6 +3828,8 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); @@ -89,7 +89,7 @@ #ifdef RADIUS_SERVER --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -919,7 +919,13 @@ int hostapd_parse_csa_settings(const cha +@@ -927,7 +927,13 @@ int hostapd_parse_csa_settings(const cha int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) { diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index 535164d802..c81c841a43 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -154,7 +154,7 @@ #ifdef CONFIG_WEP /* Configure default/group WEP keys for static WEP */ -@@ -1007,6 +1055,8 @@ void wpa_supplicant_set_state(struct wpa +@@ -1015,6 +1063,8 @@ void wpa_supplicant_set_state(struct wpa sme_sched_obss_scan(wpa_s, 1); @@ -163,7 +163,7 @@ #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) if (!fils_hlp_sent && ssid && ssid->eap.erp) update_fils_connect_params = true; -@@ -1017,6 +1067,8 @@ void wpa_supplicant_set_state(struct wpa +@@ -1025,6 +1075,8 @@ void wpa_supplicant_set_state(struct wpa #endif /* CONFIG_OWE */ } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || state == WPA_ASSOCIATED) { @@ -172,7 +172,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -2276,6 +2328,8 @@ void wpa_supplicant_associate(struct wpa +@@ -2308,6 +2360,8 @@ void wpa_supplicant_associate(struct wpa return; } wpa_s->current_bss = bss; @@ -181,7 +181,7 @@ #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -6426,6 +6480,16 @@ static int wpa_supplicant_init_iface(str +@@ -6650,6 +6704,16 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -198,7 +198,7 @@ /* RSNA Supplicant Key Management - INITIALIZE */ eapol_sm_notify_portEnabled(wpa_s->eapol, false); eapol_sm_notify_portValid(wpa_s->eapol, false); -@@ -6763,6 +6827,11 @@ static void wpa_supplicant_deinit_iface( +@@ -6987,6 +7051,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -212,7 +212,7 @@ --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -103,6 +103,11 @@ struct wpa_interface { +@@ -104,6 +104,11 @@ struct wpa_interface { const char *ifname; /** @@ -224,7 +224,7 @@ * bridge_ifname - Optional bridge interface name * * If the driver interface (ifname) is included in a Linux bridge -@@ -615,6 +620,8 @@ struct wpa_supplicant { +@@ -718,6 +723,8 @@ struct wpa_supplicant { #endif /* CONFIG_CTRL_IFACE_BINDER */ char bridge_ifname[16]; @@ -235,7 +235,7 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2883,6 +2883,12 @@ static int hostapd_ctrl_iface_chan_switc +@@ -2889,6 +2889,12 @@ static int hostapd_ctrl_iface_chan_switc return 0; } @@ -250,7 +250,7 @@ /* Save CHAN_SWITCH VHT and HE config */ --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1758,11 +1758,6 @@ int ieee802_11_set_beacon(struct hostapd +@@ -1791,11 +1791,6 @@ static int __ieee802_11_set_beacon(struc return -1; } @@ -264,7 +264,7 @@ if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4665,6 +4665,60 @@ static void wpas_event_unprot_beacon(str +@@ -4891,6 +4891,60 @@ static void wpas_event_unprot_beacon(str } @@ -325,7 +325,7 @@ void supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { -@@ -4980,8 +5034,10 @@ void supplicant_event(void *ctx, enum wp +@@ -5206,8 +5260,10 @@ void supplicant_event(void *ctx, enum wp channel_width_to_string(data->ch_switch.ch_width), data->ch_switch.cf1, data->ch_switch.cf2); @@ -339,7 +339,7 @@ wpa_s->current_ssid->frequency = data->ch_switch.freq; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5829,6 +5829,7 @@ union wpa_event_data { +@@ -5837,6 +5837,7 @@ union wpa_event_data { /** * struct ch_switch @@ -347,7 +347,7 @@ * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -5837,6 +5838,7 @@ union wpa_event_data { +@@ -5845,6 +5846,7 @@ union wpa_event_data { * @cf2: Center frequency 2 */ struct ch_switch { diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 81f7aa4952..92b52a6d37 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3570,6 +3570,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3587,6 +3587,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3611,6 +3612,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3628,6 +3629,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -956,6 +956,9 @@ ifdef CONFIG_FILS +@@ -958,6 +958,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE @@ -42,7 +42,7 @@ --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -2308,7 +2308,7 @@ static int wpa_supplicant_ctrl_iface_sta +@@ -2314,7 +2314,7 @@ static int wpa_supplicant_ctrl_iface_sta pos += ret; } @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -10919,6 +10919,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -11494,6 +11494,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -10931,6 +10932,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -11506,6 +11507,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -11419,6 +11421,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -11994,6 +11996,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "STA ", 4) == 0) { -@@ -11427,12 +11430,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12002,12 +12005,15 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, reply_size); @@ -101,7 +101,7 @@ static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen, size_t curr_len, const u8 *mcs_set) -@@ -451,6 +452,7 @@ int hostapd_ctrl_iface_sta_next(struct h +@@ -459,6 +460,7 @@ int hostapd_ctrl_iface_sta_next(struct h return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -109,7 +109,7 @@ #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -807,12 +809,12 @@ int hostapd_ctrl_iface_status(struct hos +@@ -815,12 +817,12 @@ int hostapd_ctrl_iface_status(struct hos return len; len += ret; } @@ -163,7 +163,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2767,6 +2767,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -2777,6 +2777,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -172,7 +172,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2848,6 +2850,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2858,6 +2860,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } @@ -182,7 +182,7 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1364,7 +1364,7 @@ int wpas_ap_wps_nfc_report_handover(stru +@@ -1462,7 +1462,7 @@ int wpas_ap_wps_nfc_report_handover(stru #endif /* CONFIG_WPS */ diff --git a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch index 73a8c7694d..f708bf39ba 100644 --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch @@ -11,7 +11,7 @@ bss->wpa_pairwise |= WPA_CIPHER_TKIP; #endif /* CONFIG_NO_TKIP */ bss->rsn_pairwise = bss->wpa_pairwise; -@@ -1178,8 +1177,7 @@ int hostapd_init_wps(struct hostapd_data +@@ -1180,8 +1179,7 @@ int hostapd_init_wps(struct hostapd_data WPA_CIPHER_GCMP_256)) { wps->encr_types |= WPS_ENCR_AES; wps->encr_types_rsn |= WPS_ENCR_AES; diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index e0e687e161..28f07c7dc2 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -22,7 +22,7 @@ Signed-hostap: Antonio Quartulli #include "common/defs.h" #include "common/ieee802_11_defs.h" #include "common/wpa_common.h" -@@ -851,6 +852,9 @@ struct wpa_driver_associate_params { +@@ -857,6 +858,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; @@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -843,6 +845,9 @@ struct wpa_ssid { +@@ -846,6 +848,9 @@ struct wpa_ssid { */ void *parent_cred; @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3726,6 +3726,12 @@ static void wpas_start_assoc_cb(struct w +@@ -3865,6 +3865,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch index b3c8b26461..0be77f9845 100644 --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5950,7 +5950,7 @@ static int wpa_driver_nl80211_ibss(struc +@@ -5966,7 +5966,7 @@ static int wpa_driver_nl80211_ibss(struc struct wpa_driver_associate_params *params) { struct nl_msg *msg; @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli int count = 0; wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -5977,6 +5977,37 @@ retry: +@@ -5993,6 +5993,37 @@ retry: nl80211_put_beacon_int(msg, params->beacon_int)) goto fail; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index d9a6e74140..bd1d4d7565 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -19,7 +19,7 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1618,6 +1618,7 @@ struct wpa_driver_mesh_join_params { +@@ -1624,6 +1624,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; bool handle_dfs; @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -10473,6 +10473,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -10496,6 +10496,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -10534,6 +10546,7 @@ static int nl80211_join_mesh(struct i802 +@@ -10557,6 +10569,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || @@ -58,7 +58,7 @@ Tested-by: Simon Wunderlich --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -600,6 +600,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -631,6 +631,7 @@ int wpa_supplicant_join_mesh(struct wpa_ params->meshid = ssid->ssid; params->meshid_len = ssid->ssid_len; diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index 4c7cb9ea36..4807727e0e 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2457,11 +2457,13 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2512,11 +2512,13 @@ void ibss_mesh_setup_freq(struct wpa_sup for (j = 0; j < wpa_s->last_scan_res_used; j++) { struct wpa_bss *bss = wpa_s->last_scan_res[j]; diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch index 3f741cdf34..c51db01fec 100644 --- a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -1294,7 +1294,7 @@ hostapd_multi.a: $(BCHECK) $(OBJS) +@@ -1297,7 +1297,7 @@ hostapd_multi.a: $(BCHECK) $(OBJS) @$(AR) cr $@ hostapd_multi.o $(OBJS) hostapd: $(OBJS) @@ -9,7 +9,7 @@ @$(E) " LD " $@ ifdef CONFIG_WPA_TRACE -@@ -1305,7 +1305,7 @@ _OBJS_VAR := OBJS_c +@@ -1308,7 +1308,7 @@ _OBJS_VAR := OBJS_c include ../src/objs.mk hostapd_cli: $(OBJS_c) @@ -20,7 +20,7 @@ NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1919,31 +1919,31 @@ wpa_supplicant_multi.a: .config $(BCHECK +@@ -1920,31 +1920,31 @@ wpa_supplicant_multi.a: .config $(BCHECK @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch index 737fdbb5d0..ee3ab7938a 100644 --- a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch +++ b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -148,6 +148,21 @@ struct hostapd_sae_commit_queue { +@@ -150,6 +150,21 @@ struct hostapd_sae_commit_queue { }; /** @@ -22,7 +22,7 @@ * struct hostapd_data - hostapd per-BSS data structure */ struct hostapd_data { -@@ -161,6 +176,9 @@ struct hostapd_data { +@@ -163,6 +178,9 @@ struct hostapd_data { u8 own_addr[ETH_ALEN]; @@ -71,7 +71,7 @@ if (disassoc_timer) { /* send disassociation frame after time-out */ set_disassoc_timer(hapd, sta, disassoc_timer); -@@ -856,6 +861,7 @@ int wnm_send_bss_tm_req(struct hostapd_d +@@ -857,6 +862,7 @@ int wnm_send_bss_tm_req(struct hostapd_d } os_free(buf); diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index b33fe8cda5..6a0acbb318 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -31,7 +31,7 @@ }; enum hostapd_chan_status { -@@ -169,6 +170,7 @@ struct hostapd_data { +@@ -171,6 +172,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -39,7 +39,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -628,6 +630,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -630,6 +632,7 @@ hostapd_alloc_bss_data(struct hostapd_if struct hostapd_bss_config *bss); int hostapd_setup_interface(struct hostapd_iface *iface); int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); @@ -126,7 +126,7 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -5445,7 +5457,7 @@ static void handle_assoc(struct hostapd_ +@@ -5447,7 +5459,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; const u8 *pos; @@ -135,7 +135,7 @@ struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -5658,6 +5670,11 @@ static void handle_assoc(struct hostapd_ +@@ -5660,6 +5672,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -147,7 +147,7 @@ /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -5756,6 +5773,13 @@ static void handle_assoc(struct hostapd_ +@@ -5758,6 +5775,13 @@ static void handle_assoc(struct hostapd_ } #endif /* CONFIG_FILS */ @@ -161,7 +161,7 @@ fail: /* -@@ -5849,6 +5873,7 @@ static void handle_disassoc(struct hosta +@@ -5851,6 +5875,7 @@ static void handle_disassoc(struct hosta wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.disassoc.reason_code)); @@ -169,7 +169,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { -@@ -5918,6 +5943,8 @@ static void handle_deauth(struct hostapd +@@ -5920,6 +5945,8 @@ static void handle_deauth(struct hostapd /* Clear the PTKSA cache entries for PASN */ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); @@ -180,7 +180,7 @@ wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -823,6 +823,12 @@ void handle_probe_req(struct hostapd_dat +@@ -852,6 +852,12 @@ void handle_probe_req(struct hostapd_dat u16 csa_offs[2]; size_t csa_offs_len; struct radius_sta rad_info; @@ -193,7 +193,7 @@ if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && ssi_signal < hapd->iconf->rssi_ignore_probe_request) -@@ -1009,6 +1015,12 @@ void handle_probe_req(struct hostapd_dat +@@ -1038,6 +1044,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ @@ -283,7 +283,7 @@ ifdef CONFIG_CODE_COVERAGE CFLAGS += -O0 -fprofile-arcs -ftest-coverage LIBS += -lgcov -@@ -960,6 +966,9 @@ ifdef CONFIG_CTRL_IFACE_MIB +@@ -962,6 +968,9 @@ ifdef CONFIG_CTRL_IFACE_MIB CFLAGS += -DCONFIG_CTRL_IFACE_MIB endif OBJS += ../src/ap/ctrl_iface_ap.o @@ -295,7 +295,7 @@ CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7017,6 +7017,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7241,6 +7241,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -304,7 +304,7 @@ return wpa_s; } -@@ -7043,6 +7045,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -7267,6 +7269,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -313,7 +313,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -7346,8 +7350,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -7570,8 +7574,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -336,7 +336,7 @@ extern const char *const wpa_supplicant_version; extern const char *const wpa_supplicant_license; -@@ -321,6 +322,8 @@ struct wpa_global { +@@ -322,6 +323,8 @@ struct wpa_global { #endif /* CONFIG_WIFI_DISPLAY */ struct psk_list_entry *add_psk; /* From group formation */ @@ -345,7 +345,7 @@ }; -@@ -605,6 +608,7 @@ struct wpa_supplicant { +@@ -708,6 +711,7 @@ struct wpa_supplicant { unsigned char own_addr[ETH_ALEN]; unsigned char perm_addr[ETH_ALEN]; char ifname[100]; @@ -363,7 +363,7 @@ #ifndef WPS_PIN_SCAN_IGNORE_SEL_REG -@@ -392,6 +393,8 @@ static int wpa_supplicant_wps_cred(void +@@ -393,6 +394,8 @@ static int wpa_supplicant_wps_cred(void wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute", cred->cred_attr, cred->cred_attr_len); @@ -463,7 +463,7 @@ --- a/src/ap/dfs.c +++ b/src/ap/dfs.c -@@ -1193,6 +1193,8 @@ int hostapd_dfs_radar_detected(struct ho +@@ -1196,6 +1196,8 @@ int hostapd_dfs_radar_detected(struct ho "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", freq, ht_enabled, chan_offset, chan_width, cf1, cf2); diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index 29ac5923df..e6d7c2f673 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2453,6 +2453,8 @@ static int hostapd_config_fill(struct ho +@@ -2458,6 +2458,8 @@ static int hostapd_config_fill(struct ho bss->isolate = atoi(pos); } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { bss->ap_max_inactivity = atoi(pos); @@ -9,7 +9,7 @@ } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { bss->skip_inactivity_poll = atoi(pos); } else if (os_strcmp(buf, "country_code") == 0) { -@@ -3153,6 +3155,8 @@ static int hostapd_config_fill(struct ho +@@ -3158,6 +3160,8 @@ static int hostapd_config_fill(struct ho } } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { conf->acs_exclude_dfs = atoi(pos); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "channel") == 0) { --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c -@@ -791,6 +791,7 @@ void hostapd_config_free_bss(struct host +@@ -792,6 +792,7 @@ void hostapd_config_free_bss(struct host os_free(conf->radius_req_attr_sqlite); os_free(conf->rsn_preauth_interfaces); os_free(conf->ctrl_interface); @@ -28,7 +28,7 @@ os_free(conf->ca_cert); os_free(conf->server_cert); os_free(conf->server_cert2); -@@ -987,6 +988,7 @@ void hostapd_config_free(struct hostapd_ +@@ -988,6 +989,7 @@ void hostapd_config_free(struct hostapd_ for (i = 0; i < conf->num_bss; i++) hostapd_config_free_bss(conf->bss[i]); @@ -47,7 +47,7 @@ enum hostapd_logger_level logger_syslog_level, logger_stdout_level; unsigned int logger_syslog; /* module bitfield */ -@@ -938,6 +940,7 @@ struct spatial_reuse { +@@ -942,6 +944,7 @@ struct spatial_reuse { struct hostapd_config { struct hostapd_bss_config **bss, *last_bss; size_t num_bss; @@ -156,7 +156,7 @@ struct hostapd_config * (*config_read_cb)(const char *config_fname); int (*ctrl_iface_init)(struct hostapd_data *hapd); void (*ctrl_iface_deinit)(struct hostapd_data *hapd); -@@ -171,6 +171,7 @@ struct hostapd_data { +@@ -173,6 +173,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -164,7 +164,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -622,7 +623,7 @@ struct hostapd_iface { +@@ -624,7 +625,7 @@ struct hostapd_iface { int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -175,7 +175,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4817,6 +4817,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -4833,6 +4833,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); diff --git a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch index 73db32e54a..856dc8ba88 100644 --- a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch +++ b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch @@ -30,7 +30,7 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3366,6 +3366,8 @@ static int hostapd_config_fill(struct ho +@@ -3381,6 +3381,8 @@ static int hostapd_config_fill(struct ho #ifndef CONFIG_NO_VLAN } else if (os_strcmp(buf, "dynamic_vlan") == 0) { bss->ssid.dynamic_vlan = atoi(pos); diff --git a/package/network/services/hostapd/patches/711-wds_bridge_force.patch b/package/network/services/hostapd/patches/711-wds_bridge_force.patch index d3f8864a74..a22580c357 100644 --- a/package/network/services/hostapd/patches/711-wds_bridge_force.patch +++ b/package/network/services/hostapd/patches/711-wds_bridge_force.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2357,6 +2357,8 @@ static int hostapd_config_fill(struct ho +@@ -2358,6 +2358,8 @@ static int hostapd_config_fill(struct ho sizeof(conf->bss[0]->iface)); } else if (os_strcmp(buf, "bridge") == 0) { os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch index 3778357ac6..106f9d7407 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2875,6 +2875,14 @@ static int hostapd_config_fill(struct ho +@@ -2880,6 +2880,14 @@ static int hostapd_config_fill(struct ho line, bss->max_num_sta, MAX_STA_COUNT); return 1; } @@ -17,7 +17,7 @@ } else if (os_strcmp(buf, "extended_key_id") == 0) { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -666,6 +666,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -668,6 +668,7 @@ void hostapd_cleanup_cs_params(struct ho void hostapd_periodic_iface(struct hostapd_iface *iface); int hostapd_owe_trans_get_info(struct hostapd_data *hapd); void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); @@ -60,7 +60,7 @@ struct hapd_interfaces *interfaces = iface->interfaces; --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat +@@ -1068,7 +1068,7 @@ void handle_probe_req(struct hostapd_dat if (hapd->conf->no_probe_resp_if_max_sta && is_multicast_ether_addr(mgmt->da) && is_multicast_ether_addr(mgmt->bssid) && @@ -71,7 +71,7 @@ " since no room for additional STA", --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -976,6 +976,8 @@ struct hostapd_config { +@@ -981,6 +981,8 @@ struct hostapd_config { unsigned int track_sta_max_num; unsigned int track_sta_max_age; diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index 0a1a16d6e3..b5809222d7 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3033,6 +3033,8 @@ static int hostapd_config_fill(struct ho +@@ -3038,6 +3038,8 @@ static int hostapd_config_fill(struct ho wpa_printf(MSG_INFO, "Line %d: Obsolete peerkey parameter ignored", line); #ifdef CONFIG_IEEE80211R_AP @@ -21,7 +21,7 @@ --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -1565,8 +1565,12 @@ int hostapd_setup_wpa(struct hostapd_dat +@@ -1566,8 +1566,12 @@ int hostapd_setup_wpa(struct hostapd_dat wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt)) { const char *ft_iface; diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index d206ed7322..2ed73750ca 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -55,7 +55,7 @@ "x_snoop: Failed to initialize L2 packet processing %s", --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2359,6 +2359,8 @@ static int hostapd_config_fill(struct ho +@@ -2360,6 +2360,8 @@ static int hostapd_config_fill(struct ho os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); if (!bss->wds_bridge[0]) os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); diff --git a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch index a7a221352f..43a4ea73b3 100644 --- a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch +++ b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -1643,6 +1643,8 @@ static int parse_anqp_elem(struct hostap +@@ -1644,6 +1644,8 @@ static int parse_anqp_elem(struct hostap return 0; } @@ -9,7 +9,7 @@ static int parse_qos_map_set(struct hostapd_bss_config *bss, char *buf, int line) -@@ -1684,8 +1686,6 @@ static int parse_qos_map_set(struct host +@@ -1685,8 +1687,6 @@ static int parse_qos_map_set(struct host return 0; } @@ -18,7 +18,7 @@ #ifdef CONFIG_HS20 static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf, -@@ -4058,10 +4058,10 @@ static int hostapd_config_fill(struct ho +@@ -4077,10 +4077,10 @@ static int hostapd_config_fill(struct ho bss->gas_frag_limit = val; } else if (os_strcmp(buf, "gas_comeback_delay") == 0) { bss->gas_comeback_delay = atoi(pos); @@ -65,7 +65,7 @@ wpabuf_free(sta->hs20_ie); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4127,13 +4127,11 @@ static u16 copy_supp_rates(struct hostap +@@ -4129,13 +4129,11 @@ static u16 copy_supp_rates(struct hostap static u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, const u8 *ext_capab_ie, size_t ext_capab_ie_len) { @@ -81,7 +81,7 @@ sta->ecsa_supported = !!(ext_capab_ie[0] & BIT(2)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -2535,8 +2535,6 @@ void wnm_bss_keep_alive_deinit(struct wp +@@ -2540,8 +2540,6 @@ void wnm_bss_keep_alive_deinit(struct wp } @@ -90,7 +90,7 @@ static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map, size_t len) { -@@ -2569,8 +2567,6 @@ static void interworking_process_assoc_r +@@ -2574,8 +2572,6 @@ static void interworking_process_assoc_r } } @@ -99,7 +99,7 @@ static void multi_ap_process_assoc_resp(struct wpa_supplicant *wpa_s, const u8 *ies, size_t ies_len) -@@ -2704,10 +2700,8 @@ static int wpa_supplicant_event_associnf +@@ -2908,10 +2904,8 @@ static int wpa_supplicant_event_associnf wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, data->assoc_info.resp_ies_len); #endif /* CONFIG_WNM */ From 5406684087815d3f66df9d8318e15db7137148f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20M=C3=B6rlein?= Date: Wed, 15 Sep 2021 03:09:18 +0200 Subject: [PATCH 141/144] wireguard-tools: allow generating private_key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the uci configuration is created automatically during a very early stage, where no entropy daemon is set up, generating the key directly is not an option. Therefore we allow to set the private_key to "generate" and generate the private key directly before the interface is taken up. Signed-off-by: Leonardo Mörlein Tested-by: Jan-Niklas Burfeind --- .../utils/wireguard-tools/files/wireguard.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/package/network/utils/wireguard-tools/files/wireguard.sh b/package/network/utils/wireguard-tools/files/wireguard.sh index 2e6d74bc91..f6ad967b40 100644 --- a/package/network/utils/wireguard-tools/files/wireguard.sh +++ b/package/network/utils/wireguard-tools/files/wireguard.sh @@ -102,6 +102,23 @@ proto_wireguard_setup_peer() { fi } +ensure_key_is_generated() { + local private_key + private_key="$(uci get network."$1".private_key)" + + if [ "$private_key" == "generate" ]; then + local ucitmp + oldmask="$(umask)" + umask 077 + ucitmp="$(mktemp -d)" + private_key="$("${WG}" genkey)" + uci -q -t "$ucitmp" set network."$1".private_key="$private_key" && \ + uci -q -t "$ucitmp" commit network + rm -rf "$ucitmp" + umask "$oldmask" + fi +} + proto_wireguard_setup() { local config="$1" local wg_dir="/tmp/wireguard" @@ -111,6 +128,8 @@ proto_wireguard_setup() { local listen_port local mtu + ensure_key_is_generated "${config}" + config_load network config_get private_key "${config}" "private_key" config_get listen_port "${config}" "listen_port" From a0ad07ea039c125c28b5b3893c6f935cf68dfdd5 Mon Sep 17 00:00:00 2001 From: Mike Lothian Date: Mon, 17 May 2021 10:15:20 +0100 Subject: [PATCH 142/144] ipq806x: Enlarge D7800 flash - use netgear partition Increase the available flash memory size in Netgear R7800 by repurposing the unused "netgear" partition that is located after the firmware partition. Available flash space for kernel+rootfs+overlay increases by 68 MB from 32 MB to 100 MB. In a typical build, overlay space increases from 15 to 85, increasing the package installation possibilities greatly. Reverting to the OEM firmware is still possible, as the OEM firmware contains logic to initialise the "netgear" partition if its contents do not match expectations. In OEM firmware, "netgear" contains 6 UBI sub-partitions that are defined in /etc/netgear.cfg and initialisation is done by /etc/preinit This is based on https://github.com/openwrt/openwrt/commit/fb8a578aa70572b3e56b64d296e22c2931e77b69 Signed-off-by: Mike Lothian --- .../files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts | 8 +------- target/linux/ipq806x/image/generic.mk | 3 +++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts index b8314a6bd0..2f259150fa 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts @@ -312,13 +312,7 @@ ubi@1880000 { label = "ubi"; - reg = <0x1880000 0x1C00000>; - }; - - netgear@3480000 { - label = "netgear"; - reg = <0x3480000 0x4480000>; - read-only; + reg = <0x1880000 0x6080000>; }; reserve@7900000 { diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk index 4fdf656b4b..21b309376f 100644 --- a/target/linux/ipq806x/image/generic.mk +++ b/target/linux/ipq806x/image/generic.mk @@ -242,6 +242,9 @@ define Device/netgear_d7800 BOARD_NAME := d7800 SUPPORTED_DEVICES += d7800 DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Sysupgrade does not work due to rootfs ubi partition size change. \ + Use factory image with the TFTP recovery flash routine. endef TARGET_DEVICES += netgear_d7800 From 09f383465e0780cf285a02704eb30f1c3d88aa4b Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Thu, 3 Feb 2022 00:10:04 +0900 Subject: [PATCH 143/144] ramips: move KERNEL_LOADADDR into Device/Default Commit f4a79148f8cb ("ramips: add support for ipTIME AX2004M") was reverted due to KERNEL_LOADADDR leakage, and it seems the problem can be mitigated by moving the variable definition into Device/Default. By this, KERNEL_LOADADDR redefined in a device recipe will not be leaked into the subsequent device recipes anymore and thus will remain as a per-device variable. Ref: cd6a6e3030ff ("Revert "ramips: add support for ipTIME AX2004M"") Signed-off-by: Sungbo Eo --- target/linux/ramips/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 241b620941..f481e6e447 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -22,7 +22,6 @@ ldrplatform-$(CONFIG_TARGET_ramips_mt7621) := mt7621 ldrflashstart-y := 0x1c000000 ldrflashstart-$(CONFIG_TARGET_ramips_mt7621) := 0x1fc00000 -KERNEL_LOADADDR := $(loadaddr-y) LOADER_PLATFORM := $(ldrplatform-y) LOADER_FLASH_START := $(ldrflashstart-y) @@ -176,6 +175,7 @@ endef define Device/Default PROFILES = Default KERNEL := $(KERNEL_DTB) | uImage lzma + KERNEL_LOADADDR := $(loadaddr-y) SOC := $(DEFAULT_SOC) DEVICE_DTS_DIR := ../dts DEVICE_DTS = $$(SOC)_$(1) From 1847382456e9bc2bf23258a5aa39b5bcfb265117 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 8 Feb 2022 23:44:47 +0100 Subject: [PATCH 144/144] ucode: update to latest Git HEAD a317c17 compiler: fix incorrect loop break targets Signed-off-by: Jo-Philipp Wich --- package/utils/ucode/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 4d66cc9f6c..738abb2117 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,13 +12,13 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2022-02-07 -PKG_SOURCE_VERSION:=11adf0c4ea91e63ec523849c2846fd07bf4348f5 -PKG_MIRROR_HASH:=cd7639cb08ead23c1d659e293ec90fda733785ee5432c3a1d7d54df17e0f6d20 +PKG_SOURCE_DATE:=2022-02-08 +PKG_SOURCE_VERSION:=a317c17f5ddfc3f749d349de01eeea5cad3eb162 +PKG_MIRROR_HASH:=11177e9be736d379d61de4450d5556b0275b5125e5e6ead35e0e44157e9b7eae PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC -PKG_ABI_VERSION:=20220120 +PKG_ABI_VERSION:=20220206 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk