diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index d96591dc98d..fed2b8de7c9 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -32,7 +32,9 @@ body: id: device attributes: label: Device - description: The device exhibiting this bug. + description: | + The device exhibiting this bug (if unsure, use command below). + ```cat /tmp/sysinfo/model``` validations: required: true - type: dropdown diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42db3669ace..c892857999c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -169,7 +169,7 @@ jobs: fi if [ -n "$major_ver" ]; then - git fetch --tags + git fetch --tags -f latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)" if [ -n "$latest_tag" ]; then TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//') diff --git a/include/image-commands.mk b/include/image-commands.mk index 074e40e4e83..ff8acf96c4f 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -306,11 +306,25 @@ define Build/fit @mv $@.new $@ endef +define Build/libdeflate-gzip + $(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new + @mv $@.new $@ +endef + define Build/gzip $(STAGING_DIR_HOST)/bin/gzip -f -9n -c $@ $(1) > $@.new @mv $@.new $@ endef +define Build/gzip-filename + @mkdir -p $@.tmp + @cp $@ $@.tmp/$(word 1,$(1)) + $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $@.tmp/$(word 1,$(1)) $(word 2,$(1))) + $(STAGING_DIR_HOST)/bin/gzip -f -9 -N -c $@.tmp/$(word 1,$(1)) $(word 2,$(1)) > $@.new + @mv $@.new $@ + @rm -rf $@.tmp +endef + define Build/install-dtb $(call locked, \ $(foreach dts,$(DEVICE_DTS), \ diff --git a/include/image.mk b/include/image.mk index 5d9d4acb414..01bc3bda868 100644 --- a/include/image.mk +++ b/include/image.mk @@ -359,6 +359,7 @@ define Device/Init ARTIFACTS := DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1) DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2) + FACTORY_IMG_NAME := IMAGE_SIZE := KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX) KERNEL_SUFFIX := -kernel.bin @@ -418,6 +419,7 @@ DEFAULT_DEVICE_VARS := \ DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ UBOOT_PATH IMAGE_SIZE \ + FACTORY_IMG_NAME \ DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ diff --git a/include/kernel-5.10 b/include/kernel-5.10 index da007fc72dd..4a573acf8e9 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .161 -LINUX_KERNEL_HASH-5.10.161 = 7aaaf6d0bcd8a2cfa14ad75f02ca62bb2de08aad3bee3eff198de49ea5254079 +LINUX_VERSION-5.10 = .162 +LINUX_KERNEL_HASH-5.10.162 = 2ec400fc50ffdfe4c836a3c02bf6e7aebcd7963dd2ac1425e6d41545c37dd217 diff --git a/include/kernel-5.15 b/include/kernel-5.15 index c32d5f6d23a..d24c2a001d6 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .85 -LINUX_KERNEL_HASH-5.15.85 = 2c0bae29fac98e0a9408914a4551b2971365ac0000351cb255d6bd9aa0849808 +LINUX_VERSION-5.15 = .86 +LINUX_KERNEL_HASH-5.15.86 = 80fcd9efa443502de9e2750f6dfb59e8de43a5d87a6d2be09dca748d79b5f2ee diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index 176c10d0655..d06354b01f4 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -129,11 +129,22 @@ mtd_get_mac_encrypted_deco() { echo $macaddr } +mtd_get_mac_uci_config_ubi() { + local volumename="$1" + + . /lib/upgrade/nand.sh + + local ubidev=$(nand_attach_ubi $CI_UBIPART) + local part=$(nand_find_volume $ubidev $volumename) + + cat "/dev/$part" | sed -n 's/^\s*option macaddr\s*'"'"'\?\([0-9A-F:]\+\)'"'"'\?/\1/Ip' +} + mtd_get_mac_text() { - local mtdname=$1 - local offset=$(($2)) + local mtdname="$1" + local offset=$((${2:-0})) + local length="${3:-17}" local part - local mac_dirty part=$(find_mtd_part "$mtdname") if [ -z "$part" ]; then @@ -141,15 +152,9 @@ mtd_get_mac_text() { return fi - if [ -z "$offset" ]; then - echo "mtd_get_mac_text: offset missing!" >&2 - return - fi + [ $((offset + length)) -le $(mtd_get_part_size "$mtdname") ] || return - mac_dirty=$(dd if="$part" bs=1 skip="$offset" count=17 2>/dev/null) - - # "canonicalize" mac - [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" + macaddr_canonicalize $(dd bs=1 if="$part" skip="$offset" count="$length" 2>/dev/null) } mtd_get_mac_binary() { diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index 6314d406467..f4db88d31ea 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -41,7 +41,7 @@ switch_to_ramfs() { pivot_root mount_root reboot sync kill sleep \ md5sum hexdump cat zcat dd tar gzip \ ls basename find cp mv rm mkdir rmdir mknod touch chmod \ - '[' printf wc grep awk sed cut sort \ + '[' printf wc grep awk sed cut sort tail \ mtd partx losetup mkfs.ext4 nandwrite flash_erase \ ubiupdatevol ubiattach ubiblock ubiformat \ ubidetach ubirsvol ubirmvol ubimkvol \ diff --git a/package/boot/arm-trusted-firmware-mvebu/Makefile b/package/boot/arm-trusted-firmware-mvebu/Makefile index 569d952cb83..088204c78ab 100644 --- a/package/boot/arm-trusted-firmware-mvebu/Makefile +++ b/package/boot/arm-trusted-firmware-mvebu/Makefile @@ -125,6 +125,8 @@ TFA_MAKE_FLAGS += \ WTP=$(BUILD_DIR)/$(A3700_UTILS_NAME) \ WTMI_IMG=$(BUILD_DIR)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE)/wtmi_app.bin \ CRYPTOPP_PATH=$(BUILD_DIR)/$(CRYPTOPP_NAME) \ + HOST_LDFLAGS="$(HOST_LDFLAGS)" \ + HOST_CPPFLAGS="$(HOST_CPPFLAGS)" \ USE_COHERENT_MEM=0 \ FIP_ALIGN=0x100 \ DDR_TOPOLOGY=$(DDR_TOPOLOGY) \ diff --git a/package/boot/arm-trusted-firmware-mvebu/patches/002-cryptopp_ldflags.patch b/package/boot/arm-trusted-firmware-mvebu/patches/002-cryptopp_ldflags.patch new file mode 100644 index 00000000000..c4de8fe7df1 --- /dev/null +++ b/package/boot/arm-trusted-firmware-mvebu/patches/002-cryptopp_ldflags.patch @@ -0,0 +1,13 @@ +Forward the host compiler flags to the compilation of the cryptopp library. + +--- a/plat/marvell/armada/a3k/common/a3700_common.mk ++++ b/plat/marvell/armada/a3k/common/a3700_common.mk +@@ -149,7 +149,7 @@ $(TBB): FORCE + $(if $(wildcard $(CRYPTOPP_LIBDIR)/*),,$(error "Either 'CRYPTOPP_PATH' or 'CRYPTOPP_LIB' was set to '$(CRYPTOPP_LIBDIR)', but '$(CRYPTOPP_LIBDIR)' does not exist")) + $(if $(wildcard $(CRYPTOPP_INCDIR)/*),,$(error "Either 'CRYPTOPP_PATH' or 'CRYPTOPP_INCDIR' was set to '$(CRYPTOPP_INCDIR)', but '$(CRYPTOPP_INCDIR)' does not exist")) + ifdef CRYPTOPP_PATH +- $(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile ++ $(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile LDFLAGS="$(HOST_LDFLAGS)" CPPFLAGS="$(HOST_CPPFLAGS)" + endif + $(Q)$(MAKE) --no-print-directory -C $(WTP)/wtptp/src/TBB_Linux -f TBB_linux.mak LIBDIR=$(CRYPTOPP_LIBDIR) INCDIR=$(CRYPTOPP_INCDIR) + diff --git a/package/boot/arm-trusted-firmware-sunxi/Makefile b/package/boot/arm-trusted-firmware-sunxi/Makefile index 178b3958b82..447a8f4a453 100644 --- a/package/boot/arm-trusted-firmware-sunxi/Makefile +++ b/package/boot/arm-trusted-firmware-sunxi/Makefile @@ -25,40 +25,28 @@ include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/trusted-firmware-a.mk include $(INCLUDE_DIR)/package.mk - -define Package/arm-trusted-firmware-sunxi/Default - SECTION:=boot - CATEGORY:=Boot Loaders - TITLE:=ARM Trusted Firmware for Allwinner - DEPENDS:=@TARGET_sunxi_cortexa53 +define Trusted-Firmware-A/Default + BUILD_TARGET:=sunxi + BUILD_SUBTARGET:=cortexa53 endef -define Package/arm-trusted-firmware-sunxi-a64 - $(call Package/arm-trusted-firmware-sunxi/Default) - VARIANT:=sun50i_a64 +define Trusted-Firmware-A/sunxi-a64 + NAME:=Allwinner A64 + PLAT:=sun50i_a64 endef -define Package/arm-trusted-firmware-sunxi-h6 - $(call Package/arm-trusted-firmware-sunxi/Default) - VARIANT:=sun50i_h6 +define Trusted-Firmware-A/sunxi-h6 + NAME:=Allwinner H6 + PLAT:=sun50i_h6 endef -export GCC_HONOUR_COPTS=s +TFA_TARGETS:= \ + sunxi-a64 \ + sunxi-h6 -MAKE_VARS = \ - CROSS_COMPILE="$(TARGET_CROSS)" - -MAKE_FLAGS += \ - PLAT=$(BUILD_VARIANT) \ - bl31 - -define Build/InstallDev +define Package/trusted-firmware-a/install $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/build/$(BUILD_VARIANT)/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31_$(BUILD_VARIANT).bin + $(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31_$(BUILD_VARIANT).bin endef -define Package/arm-trusted-firmware-sunxi/install -endef - -$(eval $(call BuildPackage,arm-trusted-firmware-sunxi-a64)) -$(eval $(call BuildPackage,arm-trusted-firmware-sunxi-h6)) +$(eval $(call BuildPackage/Trusted-Firmware-A)) diff --git a/package/boot/tfa-layerscape/Makefile b/package/boot/tfa-layerscape/Makefile index 1be74216e11..072036da2f1 100644 --- a/package/boot/tfa-layerscape/Makefile +++ b/package/boot/tfa-layerscape/Makefile @@ -18,6 +18,7 @@ PKG_MIRROR_HASH:=893f2d28a77dcc9d4413a619b4719ca5f1f4dc78dd824a8488e7d543e66bcf9 PKG_BUILD_DEPENDS:=tfa-layerscape/host include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/trusted-firmware-a.mk include $(INCLUDE_DIR)/package.mk HOST_CFLAGS += -Wall -Werror -pedantic -std=c99 @@ -38,131 +39,97 @@ define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/nxp/byte_swap $(STAGING_DIR_HOST)/bin/tfa-byte-swap endef -define Package/tfa-generic - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_layerscape_armv8_64b +layerscape-rcw +u-boot-fsl_$(subst tfa-,,$(1)) - VARIANT:=$(subst tfa-,,$(1)) +define Trusted-Firmware-A/Default + BUILD_TARGET:=layerscape + BUILD_SUBTARGET:=armv8_64b + DEPENDS:=+layerscape-rcw +u-boot-fsl_$(1) endef -define Package/tfa-ls1012a-frdm - $(Package/tfa-generic) - TITLE:=NXP LS1012AFRDM Trusted Firmware +define Trusted-Firmware-A/ls1012a-frdm + NAME:=NXP LS1012AFRDM PLAT:=ls1012afrdm BOOT_MODE:=qspi endef -define Package/tfa-ls1012a-rdb - $(Package/tfa-generic) - TITLE:=NXP LS1012ARDB Trusted Firmware +define Trusted-Firmware-A/ls1012a-rdb + NAME:=NXP LS1012ARDB PLAT:=ls1012ardb BOOT_MODE:=qspi endef -define Package/tfa-ls1012a-frwy-sdboot - $(Package/tfa-generic) - TITLE:=NXP LS1012AFRWY Trusted Firmware +define Trusted-Firmware-A/ls1012a-frwy-sdboot + NAME:=NXP LS1012AFRWY PLAT:=ls1012afrwy BOOT_MODE:=qspi endef -define Package/tfa-ls1043a-rdb - $(Package/tfa-generic) - TITLE:=NXP LS1043ARDB Trusted Firmware +define Trusted-Firmware-A/ls1043a-rdb + NAME:=NXP LS1043ARDB PLAT:=ls1043ardb BOOT_MODE:=nor endef -define Package/tfa-ls1043a-rdb-sdboot - $(Package/tfa-generic) - TITLE:=NXP LS1043ARDB SD Boot Trusted Firmware +define Trusted-Firmware-A/ls1043a-rdb-sdboot + NAME:=NXP LS1043ARDB SD Boot PLAT:=ls1043ardb BOOT_MODE:=sd endef -define Package/tfa-ls1046a-frwy - $(Package/tfa-generic) - TITLE:=NXP LS1046AFRWY Trusted Firmware +define Trusted-Firmware-A/ls1046a-frwy + NAME:=NXP LS1046AFRWY PLAT:=ls1046afrwy BOOT_MODE:=qspi endef -define Package/tfa-ls1046a-frwy-sdboot - $(Package/tfa-generic) - TITLE:=NXP LS1046AFRWY SD Boot Trusted Firmware +define Trusted-Firmware-A/ls1046a-frwy-sdboot + NAME:=NXP LS1046AFRWY SD Boot PLAT:=ls1046afrwy BOOT_MODE:=sd endef -define Package/tfa-ls1046a-rdb - $(Package/tfa-generic) - TITLE:=NXP LS1046ARDB Trusted Firmware +define Trusted-Firmware-A/ls1046a-rdb + NAME:=NXP LS1046ARDB PLAT:=ls1046ardb BOOT_MODE:=qspi endef -define Package/tfa-ls1046a-rdb-sdboot - $(Package/tfa-generic) - TITLE:=NXP LS1046ARDB SD Boot Trusted Firmware +define Trusted-Firmware-A/ls1046a-rdb-sdboot + NAME:=NXP LS1046ARDB SD Boot PLAT:=ls1046ardb BOOT_MODE:=sd endef -define Package/tfa-ls1088a-rdb - $(Package/tfa-generic) - TITLE:=NXP LS1088ARDB Trusted Firmware +define Trusted-Firmware-A/ls1088a-rdb + NAME:=NXP LS1088ARDB PLAT:=ls1088ardb BOOT_MODE:=qspi endef -define Package/tfa-ls1088a-rdb-sdboot - $(Package/tfa-generic) - TITLE:=NXP LS1088ARDB SD Boot Trusted Firmware +define Trusted-Firmware-A/ls1088a-rdb-sdboot + NAME:=NXP LS1088ARDB SD Boot PLAT:=ls1088ardb BOOT_MODE:=sd endef -define Package/tfa-ls2088a-rdb - $(Package/tfa-generic) - TITLE:=NXP LS2088ARDB Trusted Firmware +define Trusted-Firmware-A/ls2088a-rdb + NAME:=NXP LS2088ARDB PLAT:=ls2088ardb BOOT_MODE:=nor endef -define Package/tfa-lx2160a-rdb - $(Package/tfa-generic) - TITLE:=NXP LX2160ARDB Trusted Firmware +define Trusted-Firmware-A/lx2160a-rdb + NAME:=NXP LX2160ARDB PLAT:=lx2160ardb BOOT_MODE:=flexspi_nor endef -define Package/tfa-lx2160a-rdb-sdboot - $(Package/tfa-generic) - TITLE:=NXP LX2160ARDB SD Boot Trusted Firmware +define Trusted-Firmware-A/lx2160a-rdb-sdboot + NAME:=NXP LX2160ARDB SD Boot PLAT:=lx2160ardb BOOT_MODE:=sd endef -define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl2_$(BOOT_MODE).pbl \ - $(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-bl2.pbl - $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/fip.bin \ - $(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-fip.bin -endef - -define Build/Compile - $(eval $(Package/tfa-$(BUILD_VARIANT))) \ - $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) \ - fip pbl PLAT=$(PLAT) BOOT_MODE=$(BOOT_MODE) \ - RCW=$(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-rcw.bin \ - BL33=$(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-uboot.bin \ - FIPTOOL=$(STAGING_DIR_HOST)/bin/fiptool-layerscape \ - CREATE_PBL=$(STAGING_DIR_HOST)/bin/tfa-create-pbl \ - BYTE_SWAP=$(STAGING_DIR_HOST)/bin/tfa-byte-swap -endef - -TFAS := \ +TFA_TARGETS := \ ls1012a-frdm \ ls1012a-rdb \ ls1012a-frwy-sdboot \ @@ -178,7 +145,25 @@ TFAS := \ lx2160a-rdb \ lx2160a-rdb-sdboot +TFA_MAKE_FLAGS += \ + fip pbl \ + BOOT_MODE=$(BOOT_MODE) \ + RCW=$(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-rcw.bin \ + BL33=$(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-uboot.bin \ + FIPTOOL=$(STAGING_DIR_HOST)/bin/fiptool-layerscape \ + CREATE_PBL=$(STAGING_DIR_HOST)/bin/tfa-create-pbl \ + BYTE_SWAP=$(STAGING_DIR_HOST)/bin/tfa-byte-swap + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl2_$(BOOT_MODE).pbl \ + $(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-bl2.pbl + $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/fip.bin \ + $(STAGING_DIR_IMAGE)/fsl_$(BUILD_VARIANT)-fip.bin +endef + +define Package/trusted-firmware-a/install/default +endef + $(eval $(call HostBuild)) -$(foreach tfa,$(TFAS), \ - $(eval $(call BuildPackage,tfa-$(tfa))) \ -) +$(eval $(call BuildPackage/Trusted-Firmware-A)) diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index 4ee83bb0570..6c65ed752de 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -63,7 +63,7 @@ linksys,ea8300|\ linksys,mr8300) ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000" ;; -linksys,whw01-v1) +linksys,whw01) ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x40000" "0x10000" ;; zyxel,nbg6617) diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index 75301d69beb..ae5d12e381f 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -29,7 +29,7 @@ define U-Boot/a64-olinuxino BUILD_SUBTARGET:=cortexa53 NAME:=Olimex A64-OLinuXino BUILD_DEVICES:=olimex_a64-olinuxino - DEPENDS:=+PACKAGE_u-boot-olimex_a64-olinuxino:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-olimex_a64-olinuxino:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -38,7 +38,7 @@ define U-Boot/a64-olinuxino-emmc BUILD_SUBTARGET:=cortexa53 NAME:=Olimex A64-OLinuXino eMMC BUILD_DEVICES:=olimex_a64-olinuxino-emmc - DEPENDS:=+PACKAGE_u-boot-olimex_a64-olinuxino-emmc:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-olimex_a64-olinuxino-emmc:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -207,7 +207,7 @@ endef define U-Boot/orangepi_one_plus BUILD_SUBTARGET:=cortexa53 NAME:=Orange Pi One Plus (H6) - DEPENDS:=+PACKAGE_u-boot-orangepi_one_plus:arm-trusted-firmware-sunxi-h6 + DEPENDS:=+PACKAGE_u-boot-orangepi_one_plus:trusted-firmware-a-sunxi-h6 BUILD_DEVICES:=xunlong_orangepi-one-plus UENV:=h6 ATF:=h6 @@ -247,7 +247,7 @@ define U-Boot/libretech_all_h3_cc_h5 BUILD_SUBTARGET:=cortexa53 NAME:=Libre Computer ALL-H3-CC H5 BUILD_DEVICES:=libretech_all-h3-cc-h5 - DEPENDS:=+PACKAGE_u-boot-libretech_all_h3_cc_h5:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-libretech_all_h3_cc_h5:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -256,7 +256,7 @@ define U-Boot/nanopi_neo_plus2 BUILD_SUBTARGET:=cortexa53 NAME:=NanoPi NEO Plus2 (H5) BUILD_DEVICES:=friendlyarm_nanopi-neo-plus2 - DEPENDS:=+PACKAGE_u-boot-nanopi_neo_plus2:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-nanopi_neo_plus2:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -265,7 +265,7 @@ define U-Boot/nanopi_neo2 BUILD_SUBTARGET:=cortexa53 NAME:=NanoPi NEO2 (H5) BUILD_DEVICES:=friendlyarm_nanopi-neo2 - DEPENDS:=+PACKAGE_u-boot-nanopi_neo2:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-nanopi_neo2:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -274,7 +274,7 @@ define U-Boot/nanopi_r1s_h5 BUILD_SUBTARGET:=cortexa53 NAME:=NanoPi R1S (H5) BUILD_DEVICES:=friendlyarm_nanopi-r1s-h5 - DEPENDS:=+PACKAGE_u-boot-nanopi_r1s_h5:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-nanopi_r1s_h5:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -283,7 +283,7 @@ define U-Boot/pine64_plus BUILD_SUBTARGET:=cortexa53 NAME:=Pine64 Plus A64 BUILD_DEVICES:=pine64_pine64-plus - DEPENDS:=+PACKAGE_u-boot-pine64_plus:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-pine64_plus:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -298,7 +298,7 @@ define U-Boot/sopine_baseboard BUILD_SUBTARGET:=cortexa53 NAME:=Sopine Baseboard BUILD_DEVICES:=pine64_sopine-baseboard - DEPENDS:=+PACKAGE_u-boot-sopine_baseboard:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-sopine_baseboard:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -308,7 +308,7 @@ define U-Boot/orangepi_zero_plus BUILD_SUBTARGET:=cortexa53 NAME:=Xunlong Orange Pi Zero Plus BUILD_DEVICES:=xunlong_orangepi-zero-plus - DEPENDS:=+PACKAGE_u-boot-orangepi_zero_plus:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-orangepi_zero_plus:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -317,7 +317,7 @@ define U-Boot/orangepi_pc2 BUILD_SUBTARGET:=cortexa53 NAME:=Xunlong Orange Pi PC2 BUILD_DEVICES:=xunlong_orangepi-pc2 - DEPENDS:=+PACKAGE_u-boot-orangepi_pc2:arm-trusted-firmware-sunxi-a64 + DEPENDS:=+PACKAGE_u-boot-orangepi_pc2:trusted-firmware-a-sunxi-a64 UENV:=a64 ATF:=a64 endef @@ -385,7 +385,7 @@ UBOOT_TARGETS := \ UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes UBOOT_MAKE_FLAGS += \ - BL31=$(STAGING_DIR_IMAGE)/bl31_sun50i_$(ATF).bin + BL31=$(STAGING_DIR_IMAGE)/bl31_sunxi-$(ATF).bin define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index d6f53a1d509..6e852bc03f2 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -171,7 +171,7 @@ endef define KernelPackage/mt7615-firmware $(KernelPackage/mt76-default) TITLE:=MediaTek MT7615e firmware - DEFAULT:=PACKAGE_kmod-mt7615e + DEPENDS+=+kmod-mt7615e endef define KernelPackage/mt7615e @@ -182,6 +182,12 @@ define KernelPackage/mt7615e AUTOLOAD:=$(call AutoProbe,mt7615e) endef +define KernelPackage/mt7622-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7622 firmware + DEPENDS+=+kmod-mt7615e +endef + define KernelPackage/mt7663-firmware-ap $(KernelPackage/mt76-default) TITLE:=MediaTek MT7663e firmware (optimized for AP) @@ -218,10 +224,16 @@ define KernelPackage/mt7663u AUTOLOAD:=$(call AutoProbe,mt7663u) endef +define KernelPackage/mt7915-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7915 firmware + DEPENDS+=+kmod-mt7915e +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 +@KERNEL_RELAY + DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY FILES:= $(PKG_BUILD_DIR)/mt7915/mt7915e.ko AUTOLOAD:=$(call AutoProbe,mt7915e) endef @@ -439,9 +451,14 @@ define KernelPackage/mt7615-firmware/install $(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \ - $(if $(CONFIG_TARGET_mediatek_mt7622), \ - $(PKG_BUILD_DIR)/firmware/mt7622_n9.bin \ - $(PKG_BUILD_DIR)/firmware/mt7622_rom_patch.bin) \ + $(1)/lib/firmware/mediatek +endef + +define KernelPackage/mt7622-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/mt7622_n9.bin \ + $(PKG_BUILD_DIR)/firmware/mt7622_rom_patch.bin \ $(1)/lib/firmware/mediatek endef @@ -461,7 +478,7 @@ define KernelPackage/mt7663-firmware-sta/install $(1)/lib/firmware/mediatek endef -define KernelPackage/mt7915e/install +define KernelPackage/mt7915-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/mediatek cp \ $(PKG_BUILD_DIR)/firmware/mt7915_wa.bin \ @@ -520,12 +537,14 @@ $(eval $(call KernelPackage,mt76-connac)) $(eval $(call KernelPackage,mt76-sdio)) $(eval $(call KernelPackage,mt7615-common)) $(eval $(call KernelPackage,mt7615-firmware)) +$(eval $(call KernelPackage,mt7622-firmware)) $(eval $(call KernelPackage,mt7615e)) $(eval $(call KernelPackage,mt7663-firmware-ap)) $(eval $(call KernelPackage,mt7663-firmware-sta)) $(eval $(call KernelPackage,mt7663-usb-sdio)) $(eval $(call KernelPackage,mt7663u)) $(eval $(call KernelPackage,mt7663s)) +$(eval $(call KernelPackage,mt7915-firmware)) $(eval $(call KernelPackage,mt7915e)) $(eval $(call KernelPackage,mt7916-firmware)) $(eval $(call KernelPackage,mt7986-firmware)) diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index a94a7076489..67525c23261 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap -PKG_VERSION:=1.10.1 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=1.10.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.tcpdump.org/release/ -PKG_HASH:=ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4 +PKG_HASH:=db6d79d4ad03b8b15fb16c42447d093ad3520c0ec0ae3d331104dcfb1ce77560 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/libs/libpcap/patches/100-no-openssl.patch b/package/libs/libpcap/patches/100-no-openssl.patch index 56896ad8ba1..434f1ce006a 100644 --- a/package/libs/libpcap/patches/100-no-openssl.patch +++ b/package/libs/libpcap/patches/100-no-openssl.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1042,7 +1042,6 @@ endif() +@@ -1325,7 +1325,6 @@ endif() # # OpenSSL/libressl. # diff --git a/package/libs/libpcap/patches/102-skip-manpages.patch b/package/libs/libpcap/patches/102-skip-manpages.patch index 79a365643e2..43d393ac5f6 100644 --- a/package/libs/libpcap/patches/102-skip-manpages.patch +++ b/package/libs/libpcap/patches/102-skip-manpages.patch @@ -9,7 +9,7 @@ Subject: [PATCH] skip manpages --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -2732,57 +2732,6 @@ if(NOT MSVC) +@@ -3325,57 +3325,6 @@ if(NOT MSVC) if(MINGW) find_program(LINK_EXECUTABLE ln) endif(MINGW) diff --git a/package/libs/libpcap/patches/201-space_optimization.patch b/package/libs/libpcap/patches/201-space_optimization.patch deleted file mode 100644 index bf9374dd542..00000000000 --- a/package/libs/libpcap/patches/201-space_optimization.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/pcap-common.c -+++ b/pcap-common.c -@@ -1662,14 +1662,23 @@ swap_pseudo_headers(int linktype, struct - break; - - case DLT_USB_LINUX: -+#ifndef PCAP_SUPPORT_USB -+ return; -+#endif - swap_linux_usb_header(hdr, data, 0); - break; - - case DLT_USB_LINUX_MMAPPED: -+#ifndef PCAP_SUPPORT_USB -+ return; -+#endif - swap_linux_usb_header(hdr, data, 1); - break; - - case DLT_NFLOG: -+#ifndef PCAP_SUPPORT_NETFILTER -+ return; -+#endif - swap_nflog_header(hdr, data); - break; - } diff --git a/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch b/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch index ce810657037..0a6aa3c0b7b 100644 --- a/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch +++ b/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch @@ -1,4 +1,4 @@ -From b86b960fbd5c215c9c0f43544935b9a25d9445c5 Mon Sep 17 00:00:00 2001 +From 3d8d268320d2381021a409ff8d03533698dd6242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Mon, 23 Nov 2020 00:38:22 +0100 Subject: [PATCH] Add support for B.A.T.M.A.N. Advanced @@ -220,16 +220,16 @@ Signed-off-by: Linus Lüssing #endif --- a/gencode.c +++ b/gencode.c -@@ -74,6 +74,8 @@ - #include "atmuni31.h" +@@ -60,6 +60,8 @@ #include "sunatmpos.h" + #include "pflog.h" #include "ppp.h" +#include "batadv_packet.h" +#include "batadv_legacy_packet.h" #include "pcap/sll.h" #include "pcap/ipnet.h" #include "arcnet.h" -@@ -9501,6 +9503,168 @@ gen_geneve(compiler_state_t *cstate, bpf +@@ -9436,6 +9438,168 @@ gen_geneve(compiler_state_t *cstate, bpf return b1; } @@ -400,7 +400,7 @@ Signed-off-by: Linus Lüssing static struct block * --- a/gencode.h +++ b/gencode.h -@@ -346,6 +346,9 @@ struct block *gen_pppoes(compiler_state_ +@@ -358,6 +358,9 @@ struct block *gen_pppoes(compiler_state_ struct block *gen_geneve(compiler_state_t *, bpf_u_int32, int); @@ -412,7 +412,7 @@ Signed-off-by: Linus Lüssing struct block *gen_atmtype_abbrev(compiler_state_t *, int); --- a/grammar.y.in +++ b/grammar.y.in -@@ -347,6 +347,7 @@ DIAG_OFF_BISON_BYACC +@@ -375,6 +375,7 @@ DIAG_OFF_BISON_BYACC %type mtp2type %type mtp3field %type mtp3fieldvalue mtp3value mtp3listvalue @@ -420,7 +420,7 @@ Signed-off-by: Linus Lüssing %token DST SRC HOST GATEWAY -@@ -365,7 +366,7 @@ DIAG_OFF_BISON_BYACC +@@ -393,7 +394,7 @@ DIAG_OFF_BISON_BYACC %token LEN %token IPV6 ICMPV6 AH ESP %token VLAN MPLS @@ -429,7 +429,7 @@ Signed-off-by: Linus Lüssing %token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP %token STP %token IPX -@@ -592,11 +593,40 @@ other: pqual TK_BROADCAST { CHECK_PTR_ +@@ -620,11 +621,40 @@ other: pqual TK_BROADCAST { CHECK_PTR_ | PPPOES { CHECK_PTR_VAL(($$ = gen_pppoes(cstate, 0, 0))); } | GENEVE pnum { CHECK_PTR_VAL(($$ = gen_geneve(cstate, $2, 1))); } | GENEVE { CHECK_PTR_VAL(($$ = gen_geneve(cstate, 0, 0))); } @@ -556,15 +556,15 @@ Signed-off-by: Linus Lüssing } --- a/pcap-filter.manmisc.in +++ b/pcap-filter.manmisc.in -@@ -98,6 +98,7 @@ protos are: +@@ -98,6 +98,7 @@ protocols are: .BR arp , .BR rarp , .BR decnet , +.BR batadv , + .BR sctp , .B tcp and - .BR udp . -@@ -361,7 +362,7 @@ True if the packet is an IPv6 multicast +@@ -400,7 +401,7 @@ True if the packet is an IPv6 multicast .IP "\fBether proto \fIprotocol\fR" True if the packet is of ether type \fIprotocol\fR. \fIProtocol\fP can be a number or one of the names @@ -573,7 +573,7 @@ Signed-off-by: Linus Lüssing \fBipx\fP, \fBiso\fP, \fBlat\fP, \fBloopback\fP, \fBmopdl\fP, \fBmoprc\fP, \fBnetbeui\fP, \fBrarp\fP, \fBsca\fP or \fBstp\fP. Note these identifiers (except \fBloopback\fP) are also keywords -@@ -415,7 +416,7 @@ the filter checks for the IPX etype in a +@@ -454,7 +455,7 @@ the filter checks for the IPX etype in a DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of IPX, and the IPX etype in a SNAP frame. .RE @@ -582,7 +582,7 @@ Signed-off-by: Linus Lüssing Abbreviations for: .in +.5i .nf -@@ -752,6 +753,36 @@ For example: +@@ -792,6 +793,36 @@ For example: filters IPv4 protocol encapsulated in Geneve with VNI 0xb. This will match both IPv4 directly encapsulated in Geneve as well as IPv4 contained inside an Ethernet frame. @@ -621,7 +621,7 @@ Signed-off-by: Linus Lüssing \fIProtocol\fP can be a number or one of the names --- a/pcap/namedb.h +++ b/pcap/namedb.h -@@ -69,6 +69,8 @@ PCAP_API int pcap_nametoportrange(const +@@ -70,6 +70,8 @@ PCAP_API int pcap_nametoportrange(const PCAP_API int pcap_nametoproto(const char *); PCAP_API int pcap_nametoeproto(const char *); PCAP_API int pcap_nametollc(const char *); @@ -632,7 +632,7 @@ Signed-off-by: Linus Lüssing * Also, pcap_nametoport() returns the protocol along with the port number. --- a/scanner.l +++ b/scanner.l -@@ -344,6 +344,7 @@ mpls return MPLS; +@@ -347,6 +347,7 @@ mpls return MPLS; pppoed return PPPOED; pppoes return PPPOES; geneve return GENEVE; diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index 14f74082af2..29261a4cd09 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses PKG_CPE_ID:=cpe:/a:gnu:ncurses -PKG_VERSION:=6.3 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=6.4 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059 +PKG_HASH:=6931283d9ac87c5073f30b6290c4c75f21632bb4fc3603ac8100812bed248159 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=README diff --git a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch index 2fdbb7b0be3..70d64bd8e10 100644 --- a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch +++ b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -6616,6 +6616,172 @@ rxvt-cygwin-native|rxvt terminal emulato +@@ -6886,6 +6886,172 @@ rxvt-cygwin-native|rxvt terminal emulato rxvt-16color|rxvt with 16 colors like aixterm, ncv#32, use=ibm+16color, use=rxvt, diff --git a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch index 2d299197b02..9f00350a468 100644 --- a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch +++ b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch @@ -1,14 +1,14 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -4815,6 +4815,7 @@ xterm+nofkeys|building block for xterm f - # This version reflects the current xterm features. - xterm-new|modern xterm terminal emulator, +@@ -4984,6 +4984,7 @@ xterm-xfree86|xterm terminal emulator (X + + xterm+nofkeys|building block for xterm fkey-variants, npc, + kbs=\177, kcbt=\E[Z, kent=\EOM, nel=\EE, use=ecma+index, - use=ansi+rep, use=ecma+strikeout, use=xterm+pcfkeys, - use=xterm+nofkeys, -@@ -6416,6 +6417,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 + use=ansi+rep, use=ecma+strikeout, use=vt420+lrmm, + use=xterm+sm+1006, use=xterm+tmux, use=ecma+italics, +@@ -6689,6 +6690,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 rxvt-basic|rxvt terminal base (X Window System), OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, cols#80, it#8, lines#24, @@ -16,24 +16,24 @@ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -@@ -6425,7 +6427,7 @@ rxvt-basic|rxvt terminal base (X Window +@@ -6698,7 +6700,7 @@ rxvt-basic|rxvt terminal base (X Window enacs=\E(B\E)0, flash=\E[?5h$<100/>\E[?5l, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, is1=\E[?47l\E=\E[?1l, - is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, - rmul=\E[24m, -@@ -8060,6 +8062,7 @@ dumb-emacs-ansi|Emacs dumb terminal with - screen|VT 100/ANSI X3.64 virtual terminal, + rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, +@@ -8347,6 +8349,7 @@ dumb-emacs-ansi|Emacs dumb terminal with + screen-base|VT 100/ANSI X3.64 virtual terminal (base), OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, + kbs=\177, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -@@ -8071,7 +8074,7 @@ screen|VT 100/ANSI X3.64 virtual termina +@@ -8358,7 +8361,7 @@ screen-base|VT 100/ANSI X3.64 virtual te dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\Eg, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, @@ -42,7 +42,7 @@ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -@@ -8199,6 +8202,7 @@ screen.xterm-r6|screen customized for X1 +@@ -8500,6 +8503,7 @@ screen.xterm-r6|screen customized for X1 # on Solaris because Sun's curses implementation gets confused. screen.teraterm|disable ncv in teraterm, ncv#127, diff --git a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch index a6398acf8e7..5f1461b7b04 100644 --- a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch +++ b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch @@ -15,7 +15,7 @@ Subject: [PATCH] ncurses 5.9 - patch 20141206 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh -@@ -511,11 +511,22 @@ sed -n -f $ED1 \ +@@ -512,11 +512,22 @@ sed -n -f $ED1 \ -e 's/gen_$//' \ -e 's/ / /g' >>$TMP diff --git a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch index 5ef8ab7ab0d..a4599130cc8 100644 --- a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch +++ b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch @@ -1,6 +1,6 @@ --- a/aclocal.m4 +++ b/aclocal.m4 -@@ -505,7 +505,7 @@ AC_CACHE_CHECK(for options to update arc +@@ -523,7 +523,7 @@ AC_CACHE_CHECK(for options to update arc ;; (*) cf_cv_ar_flags=unknown @@ -11,7 +11,7 @@ # check if $ARFLAGS already contains this choice --- a/configure +++ b/configure -@@ -5072,7 +5072,7 @@ else +@@ -5110,7 +5110,7 @@ else ;; (*) cf_cv_ar_flags=unknown diff --git a/package/libs/ncurses/patches/900-terminfo.patch b/package/libs/ncurses/patches/900-terminfo.patch index 96d78cde349..86e3bc16b2b 100644 --- a/package/libs/ncurses/patches/900-terminfo.patch +++ b/package/libs/ncurses/patches/900-terminfo.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -6240,12 +6240,11 @@ konsole-xf3x|KDE console window with key +@@ -6514,12 +6514,11 @@ konsole-xf3x|KDE console window with key # The value for kbs (see konsole-vt100) reflects local customization rather # than the settings used for XFree86 xterm. konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index f90a2edb755..c94e9a97ca5 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ustream-ssl -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 869c8a3d5d3..1500a2cda79 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=5.5.3-stable +PKG_VERSION:=5.5.4-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:=fd3135b8657d09fb96a8aad16585da850b96ea420ae8ce5ac4d5fdfc614c2683 +PKG_HASH:=b7ee150e49def77c765bc02aac92ddeb0bebefd4cb12aa263d8f95e405221fb8 PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 diff --git a/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch b/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch deleted file mode 100644 index bcdaf2b7a2a..00000000000 --- a/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch +++ /dev/null @@ -1,33 +0,0 @@ -From dc9f46a3be00b5e82684a158605189d1278e324c Mon Sep 17 00:00:00 2001 -From: Eric Blankenhorn -Date: Wed, 12 Oct 2022 16:05:17 -0500 -Subject: [PATCH] Fix --enable-devcrypto build error for sys without u_int8_t - type - ---- - wolfcrypt/src/port/devcrypto/README.md | 2 +- - wolfcrypt/src/port/devcrypto/wc_devcrypto.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - ---- a/wolfcrypt/src/port/devcrypto/README.md -+++ b/wolfcrypt/src/port/devcrypto/README.md -@@ -22,7 +22,7 @@ modprobe cryptodev - For default build with all supported features use: - - ``` --./configure --enable-cryptodev -+./configure --enable-devcrypto - ``` - - Or for more control over features used: ---- a/wolfcrypt/src/port/devcrypto/wc_devcrypto.c -+++ b/wolfcrypt/src/port/devcrypto/wc_devcrypto.c -@@ -122,7 +122,7 @@ int wc_DevCryptoCreate(WC_CRYPTODEV* ctx - case CRYPTO_SHA2_512_HMAC: - ctx->sess.cipher = 0; - ctx->sess.mac = type; -- ctx->sess.mackey = (u_int8_t*)key; -+ ctx->sess.mackey = (byte*)key; - ctx->sess.mackeylen = keySz; - break; - diff --git a/package/libs/wolfssl/patches/100-disable-hardening-check.patch b/package/libs/wolfssl/patches/100-disable-hardening-check.patch index 904b424fa01..af774181ec0 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 -@@ -2455,7 +2455,7 @@ extern void uITRON4_free(void *p) ; +@@ -2496,7 +2496,7 @@ extern void uITRON4_free(void *p) ; #endif /* warning for not using harden build options (default with ./configure) */ diff --git a/package/network/services/bridger/Makefile b/package/network/services/bridger/Makefile index dc32b1a6af0..39cbd2c560c 100644 --- a/package/network/services/bridger/Makefile +++ b/package/network/services/bridger/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bridger PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/nbd168/bridger -PKG_SOURCE_DATE:=2022-04-06 -PKG_SOURCE_VERSION:=e8f6814a85b4ea951657e7018c5d77597400f44a -PKG_MIRROR_HASH:=f917e099a9ab2a55745a7254239efabe695a722d5c448342198cdc847a4a24ac +PKG_SOURCE_DATE:=2023-01-03 +PKG_SOURCE_VERSION:=978c1f9eed07504cc0b84f72ee7384aab722386a +PKG_MIRROR_HASH:=2a019b188d8de2fdc95453529d1820b0a7a5576adf161bd19e182c9c1c2b2c85 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 7daca315b0a..889f1455047 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=$(AUTORELEASE).1 +PKG_RELEASE:=$(AUTORELEASE).2 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index 9691151c7b0..2010aaf65c7 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nftables -PKG_VERSION:=1.0.5 -PKG_RELEASE:=2 +PKG_VERSION:=1.0.6 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=8d1b4b18393af43698d10baa25d2b9b6397969beecac7816c35dd0714e4de50a +PKG_HASH:=2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c PKG_MAINTAINER:= PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/nftables/patches/0001-fix-nft.patch b/package/network/utils/nftables/patches/0001-fix-nft.patch deleted file mode 100644 index 2138e254e8f..00000000000 --- a/package/network/utils/nftables/patches/0001-fix-nft.patch +++ /dev/null @@ -1,23 +0,0 @@ -'rule inet dscpclassify dscp_match meta l4proto { udp } th dport { 3478 } th sport { 3478-3497, 16384-16387 } goto ct_set_ef' -works with 'nft add', but not 'nft insert', the latter yields: "BUG: unhandled op 4". - -Fixes: 81e36530fcac ("src: replace interval segment tree overlap and automerge") -Signed-off-by: Florian Westphal ---- - src/evaluate.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/evaluate.c b/src/evaluate.c -index d9c9ca28a53a..edebd7bcd8ab 100644 ---- a/src/evaluate.c -+++ b/src/evaluate.c -@@ -1520,6 +1520,7 @@ static int interval_set_eval(struct eval_ctx *ctx, struct set *set, - switch (ctx->cmd->op) { - case CMD_CREATE: - case CMD_ADD: -+ case CMD_INSERT: - if (set->automerge) { - ret = set_automerge(ctx->msgs, ctx->cmd, set, init, - ctx->nft->debug_mask); --- -2.35.1 diff --git a/package/network/utils/tcpdump/Makefile b/package/network/utils/tcpdump/Makefile index dc722f1ad4e..5019e0b3b67 100644 --- a/package/network/utils/tcpdump/Makefile +++ b/package/network/utils/tcpdump/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tcpdump -PKG_VERSION:=4.99.1 +PKG_VERSION:=4.99.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.tcpdump.org/release/ -PKG_HASH:=79b36985fb2703146618d87c4acde3e068b91c553fb93f021a337f175fd10ebe +PKG_HASH:=f4304357d34b79d46f4e17e654f1f91f9ce4e3d5608a1badbd53295a26fb44d5 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch b/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch index e79de526a13..1988587029b 100644 --- a/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch +++ b/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -6230,97 +6230,6 @@ fi +@@ -6568,97 +6568,6 @@ fi diff --git a/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch b/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch index ad7c3feb4ec..8a014cabf0b 100644 --- a/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch +++ b/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch @@ -1,6 +1,6 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -73,6 +73,85 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ +@@ -73,6 +73,86 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ CSRC = fptype.c tcpdump.c @@ -77,6 +77,7 @@ + print-tftp.c \ + print-udp.c \ + print-unsupported.c \ ++ print-whois.c \ + signature.c \ + strtoaddr.c \ + util-print.c @@ -86,7 +87,7 @@ LIBNETDISSECT_SRC=\ addrtoname.c \ addrtostr.c \ -@@ -252,6 +331,8 @@ LIBNETDISSECT_SRC=\ +@@ -254,6 +334,8 @@ LIBNETDISSECT_SRC=\ strtoaddr.c \ util-print.c @@ -97,7 +98,7 @@ --- a/addrtoname.c +++ b/addrtoname.c -@@ -683,8 +683,10 @@ linkaddr_string(netdissect_options *ndo, +@@ -680,8 +680,10 @@ linkaddr_string(netdissect_options *ndo, if (type == LINKADDR_ETHER && len == MAC_ADDR_LEN) return (etheraddr_string(ndo, ep)); @@ -108,7 +109,7 @@ tp = lookup_bytestring(ndo, ep, len); if (tp->bs_name) -@@ -1263,6 +1265,7 @@ init_addrtoname(netdissect_options *ndo, +@@ -1260,6 +1262,7 @@ init_addrtoname(netdissect_options *ndo, init_ipxsaparray(ndo); } @@ -116,7 +117,7 @@ const char * dnaddr_string(netdissect_options *ndo, u_short dnaddr) { -@@ -1279,6 +1282,7 @@ dnaddr_string(netdissect_options *ndo, u +@@ -1276,6 +1279,7 @@ dnaddr_string(netdissect_options *ndo, u return(tp->name); } @@ -126,7 +127,7 @@ struct hnamemem * --- a/print-ether.c +++ b/print-ether.c -@@ -539,6 +539,7 @@ ethertype_print(netdissect_options *ndo, +@@ -545,6 +545,7 @@ ethertype_print(netdissect_options *ndo, arp_print(ndo, p, length, caplen); return (1); @@ -134,7 +135,7 @@ case ETHERTYPE_DN: decnet_print(ndo, p, length, caplen); return (1); -@@ -569,6 +570,7 @@ ethertype_print(netdissect_options *ndo, +@@ -575,6 +576,7 @@ ethertype_print(netdissect_options *ndo, ND_TCHECK_LEN(p, 1); isoclns_print(ndo, p + 1, length - 1); return(1); @@ -142,19 +143,19 @@ case ETHERTYPE_PPPOED: case ETHERTYPE_PPPOES: -@@ -581,9 +583,11 @@ ethertype_print(netdissect_options *ndo, +@@ -587,9 +589,11 @@ ethertype_print(netdissect_options *ndo, eapol_print(ndo, p); return (1); +#ifndef TCPDUMP_MINI - case ETHERTYPE_RRCP: - rrcp_print(ndo, p, length, src, dst); + case ETHERTYPE_REALTEK: + rtl_print(ndo, p, length, src, dst); return (1); +#endif case ETHERTYPE_PPP: if (length) { -@@ -592,6 +596,7 @@ ethertype_print(netdissect_options *ndo, +@@ -598,6 +602,7 @@ ethertype_print(netdissect_options *ndo, } return (1); @@ -162,7 +163,7 @@ case ETHERTYPE_MPCP: mpcp_print(ndo, p, length); return (1); -@@ -604,19 +609,23 @@ ethertype_print(netdissect_options *ndo, +@@ -610,19 +615,23 @@ ethertype_print(netdissect_options *ndo, case ETHERTYPE_CFM_OLD: cfm_print(ndo, p, length); return (1); @@ -186,7 +187,7 @@ case ETHERTYPE_MPLS: case ETHERTYPE_MPLS_MULTI: mpls_print(ndo, p, length); -@@ -646,6 +655,7 @@ ethertype_print(netdissect_options *ndo, +@@ -652,6 +661,7 @@ ethertype_print(netdissect_options *ndo, case ETHERTYPE_PTP: ptp_print(ndo, p, length); return (1); @@ -214,7 +215,7 @@ break; --- a/print-icmp6.c +++ b/print-icmp6.c -@@ -1384,7 +1384,7 @@ get_upperlayer(netdissect_options *ndo, +@@ -1371,7 +1371,7 @@ get_upperlayer(netdissect_options *ndo, nh = GET_U_1(fragh->ip6f_nxt); hlen = sizeof(struct ip6_frag); break; @@ -223,7 +224,7 @@ case IPPROTO_AH: ah = (const struct ah *)bp; if (!ND_TTEST_1(ah->ah_len)) -@@ -1392,7 +1392,7 @@ get_upperlayer(netdissect_options *ndo, +@@ -1379,7 +1379,7 @@ get_upperlayer(netdissect_options *ndo, nh = GET_U_1(ah->ah_nxt); hlen = (GET_U_1(ah->ah_len) + 2) << 2; break; @@ -336,7 +337,7 @@ default: /* * AH and ESP are, in the RFCs that describe them, -@@ -357,6 +358,7 @@ ip6_print(netdissect_options *ndo, const +@@ -375,6 +376,7 @@ ip6_print(netdissect_options *ndo, const nh = GET_U_1(cp); break; @@ -344,7 +345,7 @@ case IPPROTO_FRAGMENT: advance = frag6_print(ndo, cp, (const u_char *)ip6); if (advance < 0 || ndo->ndo_snapend <= cp + advance) { -@@ -387,7 +389,7 @@ ip6_print(netdissect_options *ndo, const +@@ -405,7 +407,7 @@ ip6_print(netdissect_options *ndo, const nh = GET_U_1(cp); nd_pop_packet_info(ndo); return; @@ -462,7 +463,7 @@ static void ppp_hdlc(netdissect_options *ndo, const u_char *p, u_int length) -@@ -1440,17 +1441,19 @@ trunc: +@@ -1451,17 +1452,19 @@ trunc: ndo->ndo_snapend = se; nd_print_trunc(ndo); } @@ -483,7 +484,7 @@ switch (proto) { case PPP_LCP: /* fall through */ -@@ -1483,6 +1486,7 @@ handle_ppp(netdissect_options *ndo, +@@ -1494,6 +1497,7 @@ handle_ppp(netdissect_options *ndo, case PPP_IPV6: ip6_print(ndo, p, length); break; @@ -491,7 +492,7 @@ case ETHERTYPE_IPX: /*XXX*/ case PPP_IPX: ipx_print(ndo, p, length); -@@ -1494,6 +1498,7 @@ handle_ppp(netdissect_options *ndo, +@@ -1505,6 +1509,7 @@ handle_ppp(netdissect_options *ndo, case PPP_MPLS_MCAST: mpls_print(ndo, p, length); break; @@ -499,7 +500,7 @@ case PPP_COMP: ND_PRINT("compressed PPP data"); break; -@@ -1634,6 +1639,7 @@ ppp_if_print(netdissect_options *ndo, +@@ -1652,6 +1657,7 @@ ppp_if_print(netdissect_options *ndo, ppp_print(ndo, p, length); } @@ -507,14 +508,14 @@ /* * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547, -@@ -1877,3 +1883,4 @@ printx: +@@ -1895,3 +1901,4 @@ printx: #endif /* __bsdi__ */ ndo->ndo_ll_hdr_len += hdrlength; } +#endif --- a/print-sll.c +++ b/print-sll.c -@@ -460,12 +460,14 @@ recurse: +@@ -465,12 +465,14 @@ recurse: */ switch (ether_type) { @@ -531,7 +532,7 @@ /* --- a/print-tcp.c +++ b/print-tcp.c -@@ -612,6 +612,7 @@ tcp_print(netdissect_options *ndo, +@@ -614,6 +614,7 @@ tcp_print(netdissect_options *ndo, ND_PRINT(" %u", utoval); break; @@ -539,7 +540,7 @@ case TCPOPT_MPTCP: { const u_char *snapend_save; -@@ -635,7 +636,7 @@ tcp_print(netdissect_options *ndo, +@@ -637,7 +638,7 @@ tcp_print(netdissect_options *ndo, goto bad; break; } @@ -548,7 +549,7 @@ case TCPOPT_FASTOPEN: datalen = len - 2; LENCHECK(datalen); -@@ -720,6 +721,7 @@ tcp_print(netdissect_options *ndo, +@@ -722,6 +723,7 @@ tcp_print(netdissect_options *ndo, return; } @@ -556,7 +557,7 @@ if (ndo->ndo_packettype) { switch (ndo->ndo_packettype) { case PT_ZMTP1: -@@ -735,6 +737,7 @@ tcp_print(netdissect_options *ndo, +@@ -737,6 +739,7 @@ tcp_print(netdissect_options *ndo, } return; } @@ -564,12 +565,12 @@ if (IS_SRC_OR_DST_PORT(TELNET_PORT)) { telnet_print(ndo, bp, length); -@@ -745,24 +748,31 @@ tcp_print(netdissect_options *ndo, +@@ -746,24 +749,31 @@ tcp_print(netdissect_options *ndo, + } else if (IS_SRC_OR_DST_PORT(WHOIS_PORT)) { ND_PRINT(": "); - ndo->ndo_protocol = "whois"; /* needed by txtproto_print() */ - txtproto_print(ndo, bp, length, NULL, 0); /* RFC 3912 */ + whois_print(ndo, bp, length); - } else if (IS_SRC_OR_DST_PORT(BGP_PORT)) -+ } ++ } +#ifndef TCPDUMP_MINI + else if (IS_SRC_OR_DST_PORT(BGP_PORT)) bgp_print(ndo, bp, length); @@ -597,7 +598,7 @@ else if (IS_SRC_OR_DST_PORT(FTP_PORT)) { ND_PRINT(": "); ftp_print(ndo, bp, length); -@@ -775,12 +785,14 @@ tcp_print(netdissect_options *ndo, +@@ -776,12 +786,14 @@ tcp_print(netdissect_options *ndo, } else if (IS_SRC_OR_DST_PORT(NAMESERVER_PORT)) { /* over_tcp: TRUE, is_mdns: FALSE */ domain_print(ndo, bp, length, TRUE, FALSE); @@ -831,7 +832,7 @@ { null_if_print, DLT_LOOP }, #endif +#ifndef TCPDUMP_MINI - #if defined(DLT_PFLOG) && defined(HAVE_NET_IF_PFLOG_H) + #ifdef DLT_PFLOG { pflog_if_print, DLT_PFLOG }, #endif @@ -200,6 +211,7 @@ static const struct printer printers[] = diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in index abe6d5431a7..7b6cf900335 100644 --- a/package/utils/busybox/Config-defaults.in +++ b/package/utils/busybox/Config-defaults.in @@ -208,6 +208,15 @@ config BUSYBOX_DEFAULT_PASSWORD_MINLEN config BUSYBOX_DEFAULT_MD5_SMALL int default 1 +config BUSYBOX_DEFAULT_SHA1_SMALL + int + default 3 +config BUSYBOX_DEFAULT_SHA1_HWACCEL + bool + default y +config BUSYBOX_DEFAULT_SHA256_HWACCEL + bool + default y config BUSYBOX_DEFAULT_SHA3_SMALL int default 1 @@ -298,6 +307,15 @@ config BUSYBOX_DEFAULT_UNICODE_NEUTRAL_TABLE config BUSYBOX_DEFAULT_UNICODE_PRESERVE_BROKEN bool default n +config BUSYBOX_DEFAULT_LOOP_CONFIGURE + bool + default n +config BUSYBOX_DEFAULT_NO_LOOP_CONFIGURE + bool + default n +config BUSYBOX_DEFAULT_TRY_LOOP_CONFIGURE + bool + default y config BUSYBOX_DEFAULT_FEATURE_SEAMLESS_XZ bool default n @@ -860,6 +878,9 @@ config BUSYBOX_DEFAULT_TRUNCATE bool default y if TARGET_bcm53xx default n +config BUSYBOX_DEFAULT_TSORT + bool + default n config BUSYBOX_DEFAULT_TTY bool default n @@ -2162,6 +2183,9 @@ config BUSYBOX_DEFAULT_RUNLEVEL config BUSYBOX_DEFAULT_RX bool default n +config BUSYBOX_DEFAULT_SEEDRNG + bool + default n config BUSYBOX_DEFAULT_SETFATTR bool default n @@ -2174,6 +2198,9 @@ config BUSYBOX_DEFAULT_STRINGS config BUSYBOX_DEFAULT_TIME bool default y +config BUSYBOX_DEFAULT_TREE + bool + default n config BUSYBOX_DEFAULT_TS bool default n @@ -2682,6 +2709,9 @@ config BUSYBOX_DEFAULT_FEATURE_UDHCPC_SANITIZEOPT config BUSYBOX_DEFAULT_UDHCPC_DEFAULT_SCRIPT string default "/usr/share/udhcpc/default.script" +config BUSYBOX_DEFAULT_UDHCPC6_DEFAULT_SCRIPT + string + default "" config BUSYBOX_DEFAULT_UDHCPC6 bool default n @@ -3012,6 +3042,9 @@ config BUSYBOX_DEFAULT_ASH_PRINTF config BUSYBOX_DEFAULT_ASH_TEST bool default y +config BUSYBOX_DEFAULT_ASH_SLEEP + bool + default n config BUSYBOX_DEFAULT_ASH_HELP bool default n diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 2861e7d2e94..95732789451 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -5,14 +5,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox -PKG_VERSION:=1.35.0 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=1.36.0 +PKG_RELEASE:=1 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_HASH:=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694 +PKG_HASH:=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 diff --git a/package/utils/busybox/config/coreutils/Config.in b/package/utils/busybox/config/coreutils/Config.in index 835ce7950a2..983740be6ed 100644 --- a/package/utils/busybox/config/coreutils/Config.in +++ b/package/utils/busybox/config/coreutils/Config.in @@ -653,7 +653,7 @@ config BUSYBOX_CONFIG_SORT sort is used to sort lines of text in specified files. config BUSYBOX_CONFIG_FEATURE_SORT_BIG - bool "Full SuSv3 compliant sort (support -ktcbdfiogM)" + bool "Full SuSv3 compliant sort (support -ktcbdfioghM)" default BUSYBOX_DEFAULT_FEATURE_SORT_BIG depends on BUSYBOX_CONFIG_SORT help @@ -851,6 +851,11 @@ config BUSYBOX_CONFIG_TRUNCATE help truncate truncates files to a given size. If a file does not exist, it is created unless told otherwise. +config BUSYBOX_CONFIG_TSORT + bool "tsort (0.7 kb)" + default BUSYBOX_DEFAULT_TSORT + help + tsort performs a topological sort. config BUSYBOX_CONFIG_TTY bool "tty (3.6 kb)" default BUSYBOX_DEFAULT_TTY diff --git a/package/utils/busybox/config/libbb/Config.in b/package/utils/busybox/config/libbb/Config.in index e050c4a9150..b3a83b9b085 100644 --- a/package/utils/busybox/config/libbb/Config.in +++ b/package/utils/busybox/config/libbb/Config.in @@ -98,21 +98,47 @@ config BUSYBOX_CONFIG_MD5_SMALL default BUSYBOX_DEFAULT_MD5_SMALL # all "fast or small" options default to small range 0 3 help - Trade binary size versus speed for the md5sum algorithm. + Trade binary size versus speed for the md5 algorithm. Approximate values running uClibc and hashing linux-2.4.4.tar.bz2 were: - value user times (sec) text size (386) - 0 (fastest) 1.1 6144 - 1 1.4 5392 - 2 3.0 5088 - 3 (smallest) 5.1 4912 + value user times (sec) text size (386) + 0 (fastest) 1.1 6144 + 1 1.4 5392 + 2 3.0 5088 + 3 (smallest) 5.1 4912 + +config BUSYBOX_CONFIG_SHA1_SMALL + int "SHA1: Trade bytes for speed (0:fast, 3:slow)" + default BUSYBOX_DEFAULT_SHA1_SMALL # all "fast or small" options default to small + range 0 3 + help + Trade binary size versus speed for the sha1 algorithm. + With FEATURE_COPYBUF_KB=64: + throughput MB/s size of sha1_process_block64 + value 486 x86-64 486 x86-64 + 0 440 485 3481 3502 + 1 265 265 641 696 + 2,3 220 210 342 364 + +config BUSYBOX_CONFIG_SHA1_HWACCEL + bool "SHA1: Use hardware accelerated instructions if possible" + default BUSYBOX_DEFAULT_SHA1_HWACCEL + help + On x86, this adds ~590 bytes of code. Throughput + is about twice as fast as fully-unrolled generic code. + +config BUSYBOX_CONFIG_SHA256_HWACCEL + bool "SHA256: Use hardware accelerated instructions if possible" + default BUSYBOX_DEFAULT_SHA256_HWACCEL + help + On x86, this adds ~1k bytes of code. config BUSYBOX_CONFIG_SHA3_SMALL int "SHA3: Trade bytes for speed (0:fast, 1:slow)" default BUSYBOX_DEFAULT_SHA3_SMALL # all "fast or small" options default to small range 0 1 help - Trade binary size versus speed for the sha3sum algorithm. + Trade binary size versus speed for the sha3 algorithm. SHA3_SMALL=0 compared to SHA3_SMALL=1 (approximate): 64-bit x86: +270 bytes of code, 45% faster 32-bit x86: +450 bytes of code, 75% faster @@ -399,3 +425,25 @@ config BUSYBOX_CONFIG_UNICODE_PRESERVE_BROKEN For example, this means that entering 'l', 's', ' ', 0xff, [Enter] at shell prompt will list file named 0xff (single char name with char value 255), not file named '?'. + +choice + prompt "Use LOOP_CONFIGURE for losetup and loop mounts" + default BUSYBOX_CONFIG_TRY_LOOP_CONFIGURE + help + LOOP_CONFIGURE is added to Linux 5.8 + https://lwn.net/Articles/820408/ + This allows userspace to completely setup a loop device with a single + ioctl, removing the in-between state where the device can be partially + configured - eg the loop device has a backing file associated with it, + but is reading from the wrong offset. + +config BUSYBOX_CONFIG_LOOP_CONFIGURE + bool "use LOOP_CONFIGURE, needs kernel >= 5.8" + +config BUSYBOX_CONFIG_NO_LOOP_CONFIGURE + bool "use LOOP_SET_FD + LOOP_SET_STATUS" + +config BUSYBOX_CONFIG_TRY_LOOP_CONFIGURE + bool "try LOOP_CONFIGURE, fall back to LOOP_SET_FD + LOOP_SET_STATUS" + +endchoice diff --git a/package/utils/busybox/config/miscutils/Config.in b/package/utils/busybox/config/miscutils/Config.in index ecb83d9647a..e15e318fe07 100644 --- a/package/utils/busybox/config/miscutils/Config.in +++ b/package/utils/busybox/config/miscutils/Config.in @@ -704,6 +704,13 @@ config BUSYBOX_CONFIG_RX default BUSYBOX_DEFAULT_RX help Receive files using the Xmodem protocol. +config BUSYBOX_CONFIG_SEEDRNG + bool "seedrng (1.3 kb)" + default BUSYBOX_DEFAULT_SEEDRNG + help + Seed the kernel RNG from seed files, meant to be called + once during startup, once during shutdown, and optionally + at some periodic interval in between. config BUSYBOX_CONFIG_SETFATTR bool "setfattr (3.7 kb)" default BUSYBOX_DEFAULT_SETFATTR @@ -727,6 +734,11 @@ config BUSYBOX_CONFIG_TIME The time command runs the specified program with the given arguments. When the command finishes, time writes a message to standard output giving timing statistics about this program run. +config BUSYBOX_CONFIG_TREE + bool "tree (0.6 kb)" + default BUSYBOX_DEFAULT_TREE + help + List files and directories in a tree structure. config BUSYBOX_CONFIG_TS bool "ts (450 bytes)" default BUSYBOX_DEFAULT_TS diff --git a/package/utils/busybox/config/networking/udhcp/Config.in b/package/utils/busybox/config/networking/udhcp/Config.in index ecfa283e23a..6757f1efc9c 100644 --- a/package/utils/busybox/config/networking/udhcp/Config.in +++ b/package/utils/busybox/config/networking/udhcp/Config.in @@ -93,12 +93,17 @@ config BUSYBOX_CONFIG_FEATURE_UDHCPC_SANITIZEOPT config BUSYBOX_CONFIG_UDHCPC_DEFAULT_SCRIPT string "Absolute path to config script" default BUSYBOX_DEFAULT_UDHCPC_DEFAULT_SCRIPT - depends on BUSYBOX_CONFIG_UDHCPC || BUSYBOX_CONFIG_UDHCPC6 + depends on BUSYBOX_CONFIG_UDHCPC help This script is called after udhcpc receives an answer. See examples/udhcp for a working example. Normally it is safe to leave this untouched. +config BUSYBOX_CONFIG_UDHCPC6_DEFAULT_SCRIPT + string "Absolute path to config script for IPv6" + default BUSYBOX_DEFAULT_UDHCPC6_DEFAULT_SCRIPT + depends on BUSYBOX_CONFIG_UDHCPC6 + # udhcpc6 config is inserted here: config BUSYBOX_CONFIG_UDHCPC6 bool "udhcpc6 (21 kb)" diff --git a/package/utils/busybox/config/shell/Config.in b/package/utils/busybox/config/shell/Config.in index 2b07812109c..a68e9114ef7 100644 --- a/package/utils/busybox/config/shell/Config.in +++ b/package/utils/busybox/config/shell/Config.in @@ -201,6 +201,11 @@ config BUSYBOX_CONFIG_ASH_TEST default BUSYBOX_DEFAULT_ASH_TEST depends on BUSYBOX_CONFIG_SHELL_ASH +config BUSYBOX_CONFIG_ASH_SLEEP + bool "sleep builtin" + default BUSYBOX_DEFAULT_ASH_SLEEP + depends on BUSYBOX_CONFIG_SHELL_ASH + config BUSYBOX_CONFIG_ASH_HELP bool "help builtin" default BUSYBOX_DEFAULT_ASH_HELP diff --git a/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch b/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch deleted file mode 100644 index 7dcb9dff3f6..00000000000 --- a/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch +++ /dev/null @@ -1,42 +0,0 @@ -From e63d7cdfdac78c6fd27e9e63150335767592b85e Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Fri, 17 Jun 2022 17:45:34 +0200 -Subject: awk: fix use after free (CVE-2022-30065) - -fixes https://bugs.busybox.net/show_bug.cgi?id=14781 - -function old new delta -evaluate 3343 3357 +14 - -Signed-off-by: Natanael Copa -Signed-off-by: Denys Vlasenko ---- - editors/awk.c | 3 +++ - testsuite/awk.tests | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/editors/awk.c -+++ b/editors/awk.c -@@ -3114,6 +3114,9 @@ static var *evaluate(node *op, var *res) - - case XC( OC_MOVE ): - debug_printf_eval("MOVE\n"); -+ /* make sure that we never return a temp var */ -+ if (L.v == TMPVAR0) -+ L.v = res; - /* if source is a temporary string, jusk relink it to dest */ - if (R.v == TMPVAR1 - && !(R.v->type & VF_NUMBER) ---- a/testsuite/awk.tests -+++ b/testsuite/awk.tests -@@ -469,4 +469,10 @@ testing 'awk printf %% prints one %' \ - "%\n" \ - '' '' - -+testing 'awk assign while test' \ -+ "awk '\$1==\$1=\"foo\" {print \$1}'" \ -+ "foo\n" \ -+ "" \ -+ "foo" -+ - exit $FAILCOUNT diff --git a/package/utils/px5g-wolfssl/Makefile b/package/utils/px5g-wolfssl/Makefile index ea805acd8ba..687a999ca77 100644 --- a/package/utils/px5g-wolfssl/Makefile +++ b/package/utils/px5g-wolfssl/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=px5g-wolfssl -PKG_RELEASE:=$(COMMITCOUNT).1 +PKG_RELEASE:=$(COMMITCOUNT).2 PKG_LICENSE:=GPL-2.0-or-later PKG_USE_MIPS16:=0 diff --git a/package/utils/uencrypt/Makefile b/package/utils/uencrypt/Makefile index 023c84b600b..a9779e28258 100644 --- a/package/utils/uencrypt/Makefile +++ b/package/utils/uencrypt/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uencrypt -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_FLAGS:=nonshared PKG_LICENSE:=GPL-2.0-or-later diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 706c3194b19..21764a2d270 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.38 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=2.38.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.38 -PKG_HASH:=6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64 +PKG_HASH:=60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f PKG_CPE_ID:=cpe:/a:kernel:util-linux PKG_LICENSE:=GPL-2.0-only diff --git a/package/utils/util-linux/patches/010-meson-typo.patch b/package/utils/util-linux/patches/010-meson-typo.patch deleted file mode 100644 index 466d942d586..00000000000 --- a/package/utils/util-linux/patches/010-meson-typo.patch +++ /dev/null @@ -1,20 +0,0 @@ -From c387d4fe7a1435a762a5b7d8b75feb13ad613315 Mon Sep 17 00:00:00 2001 -From: Anatoly Pugachev -Date: Fri, 8 Apr 2022 15:34:16 +0300 -Subject: [PATCH] libfdisk: meson.build fix typo - ---- - libfdisk/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/libfdisk/meson.build -+++ b/libfdisk/meson.build -@@ -11,7 +11,7 @@ libfdisk_h = configure_file( - output : 'libfdisk.h', - configuration : defs, - install : build_libfdisk, -- install_dir : join_paths(get_option('includedir'), 'libfisk'), -+ install_dir : join_paths(get_option('includedir'), 'libfdisk'), - ) - - lib_fdisk_sources = ''' diff --git a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch b/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch deleted file mode 100644 index aa209994ec3..00000000000 --- a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 38b15ca2dc4ca32bbe4a2449e1c7b645e4577840 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 16:53:43 -0700 -Subject: [PATCH 1/7] meson: fix compilation without systemd - -systemdsystemunitdir is used elsewhere. - -Signed-off-by: Rosen Penev ---- - meson.build | 1 + - 1 file changed, 1 insertion(+) - ---- a/meson.build -+++ b/meson.build -@@ -720,6 +720,7 @@ if fs_search_path_extra != '' - endif - conf.set_quoted('FS_SEARCH_PATH', fs_search_path) - -+systemdsystemunitdir = '' - if systemd.found() - systemdsystemunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir') - endif diff --git a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch b/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch deleted file mode 100644 index bba8baf5aba..00000000000 --- a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch +++ /dev/null @@ -1,21 +0,0 @@ -From e51565b653cf09985df57cb7254b16d5af5df223 Mon Sep 17 00:00:00 2001 -From: Nicolas Caramelli -Date: Fri, 29 Apr 2022 18:16:36 +0200 -Subject: [PATCH] meson: fix when HAVE_CLOCK_GETTIME is set - -Signed-off-by: Nicolas Caramelli ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -602,7 +602,7 @@ if not have - have = cc.has_function('clock_gettime', - dependencies : realtime_libs) - endif --conf.set('HAVE_CLOCK_GETTIME', have_dirfd ? 1 : false) -+conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) - - thread_libs = dependency('threads') - diff --git a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig index c47857b0827..500b81234a6 100644 --- a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig +++ b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig @@ -1,12 +1,10 @@ apply_bootconfig() { . /lib/functions.sh - local part - case $(board_name) in zyxel,nwa50ax|\ zyxel,nwa55axe) - mtd_idx=$(find_mtd_index "bootconfig") + mtd_idx=$(find_mtd_index "bootconfig") zyxel-bootconfig "/dev/mtd$mtd_idx" set-image-status 0 valid zyxel-bootconfig "/dev/mtd$mtd_idx" set-active-image 0 ;; diff --git a/scripts/download.pl b/scripts/download.pl index 0b3f99e9b03..676c6e9e6b1 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -255,6 +255,7 @@ foreach my $mirror (@ARGV) { push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/debian/$1"; push @mirrors, "https://mirrors.ustc.edu.cn/debian/$1" } elsif ($mirror =~ /^\@APACHE\/(.+)$/) { + push @mirrors, "https://dlcdn.apache.org/$1"; push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1"; diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 3329fe70aa1..275932577b4 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -35,8 +35,11 @@ Available Commands: info: Show a list of available target profiles clean: Remove images and temporary build files image: Build an image (see below for more information). + manifest: Show all package that will be installed into the image + package_whatdepends: Show which packages have a dependency on this + package_depends: Show installation dependency of the package -Building images: +image: By default 'make image' will create an image with the default target profile and package set. You can use the following parameters to change that: @@ -49,7 +52,7 @@ Building images: make image DISABLED_SERVICES=" [ [ ..]]" # Which services in /etc/init.d/ should be disabled make image ADD_LOCAL_KEY=1 # store locally generated signing key in built images -Print manifest: +manifest: List "all" packages which get installed into the image. You can use the following parameters: @@ -57,6 +60,19 @@ Print manifest: make manifest PACKAGES=" [ [ ...]]" # include extra packages make manifest STRIP_ABI=1 # remove ABI version from printed package names + +package_whatdepends: + List "all" packages that have a dependency on this package + You can use the following parameters: + + make package_whatdepends PACKAGE="" + +package_depends: + List "all" packages dependency of the package + You can use the following parameters: + + make package_depends PACKAGE="" + endef $(eval $(call shexport,Helptext)) @@ -255,7 +271,7 @@ manifest: FORCE $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)")) -whatdepends: FORCE +package_whatdepends: FORCE ifeq ($(PACKAGE),) @echo 'Variable `PACKAGE` is not set but required by `whatdepends`' @exit 1 @@ -263,4 +279,13 @@ endif @$(MAKE) -s package_reload @$(OPKG) whatdepends -A $(PACKAGE) -.SILENT: help info image manifest whatdepends +package_depends: FORCE +ifeq ($(PACKAGE),) + @echo 'Variable `PACKAGE` is not set but required by `package_depends`' + @exit 1 +endif + @$(MAKE) -s package_reload + @$(OPKG) depends -A $(PACKAGE) + + +.SILENT: help info image manifest package_whatdepends package_depends diff --git a/target/linux/at91/sam9x/config-5.10 b/target/linux/at91/sam9x/config-5.10 index 021231d3dfd..73ee93f2ae1 100644 --- a/target/linux/at91/sam9x/config-5.10 +++ b/target/linux/at91/sam9x/config-5.10 @@ -197,6 +197,7 @@ CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NLS=y CONFIG_NVMEM=y +# CONFIG_NVMEM_MICROCHIP_OTPC is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/at91/sama5/config-5.10 b/target/linux/at91/sama5/config-5.10 index ee607b484fb..42db74c621a 100644 --- a/target/linux/at91/sama5/config-5.10 +++ b/target/linux/at91/sama5/config-5.10 @@ -303,6 +303,7 @@ CONFIG_NLS_UTF8=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NVMEM=y +# CONFIG_NVMEM_MICROCHIP_OTPC is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/at91/sama7/config-5.10 b/target/linux/at91/sama7/config-5.10 index 45568112e47..dbf7914a6a8 100644 --- a/target/linux/at91/sama7/config-5.10 +++ b/target/linux/at91/sama7/config-5.10 @@ -265,6 +265,7 @@ CONFIG_NLS_UTF8=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NVMEM=y +# CONFIG_NVMEM_MICROCHIP_OTPC is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/ath79/dts/ar7161_netgear_wndap360.dts b/target/linux/ath79/dts/ar7161_netgear_wndap360.dts index 35c5dd36d2e..21dc423c357 100644 --- a/target/linux/ath79/dts/ar7161_netgear_wndap360.dts +++ b/target/linux/ath79/dts/ar7161_netgear_wndap360.dts @@ -107,10 +107,34 @@ read-only; }; - art: partition@7f0000 { + partition@7f0000 { label = "art"; reg = <0x7f0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_120c: macaddr@120c { + reg = <0x120c 0x6>; + }; + + macaddr_art_520c: macaddr@520c { + reg = <0x520c 0x6>; + }; + + calibration_art_1000: calibration@1000 { + reg = <0x1000 0xeb8>; + }; + + calibration_art_5000: calibration@5000 { + reg = <0x5000 0xeb8>; + }; }; }; }; @@ -122,9 +146,8 @@ ath9k0: wifi@0,11 { compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; - qca,no-eeprom; - nvmem-cells = <&macaddr_art_120c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_120c>, <&calibration_art_1000>; + nvmem-cell-names = "mac-address", "calibration"; #gpio-cells = <2>; gpio-controller; }; @@ -132,30 +155,10 @@ ath9k1: wifi@0,12 { compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; - qca,no-eeprom; - nvmem-cells = <&macaddr_art_520c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_520c>, <&calibration_art_5000>; + nvmem-cell-names = "mac-address", "calibration"; mac-address-increment = <1>; #gpio-cells = <2>; gpio-controller; }; }; - - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_120c: macaddr@120c { - reg = <0x120c 0x6>; - }; - - macaddr_art_520c: macaddr@520c { - reg = <0x520c 0x6>; - }; -}; diff --git a/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts b/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts index e93c1b8dabc..49cf39062a2 100644 --- a/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts +++ b/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts @@ -58,10 +58,26 @@ read-only; }; - art: partition@ff0000 { + partition@ff0000 { label = "art"; reg = <0xff0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + calibration_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; }; }; }; @@ -73,6 +89,13 @@ &pcie { status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0 0 0 0 0>; + nvmem-cells = <&calibration_art_5000>; + nvmem-cell-names = "calibration"; + }; }; &mdio0 { @@ -109,15 +132,6 @@ &wmac { status = "okay"; - mtd-cal-data = <&art 0x1000>; -}; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; + nvmem-cells = <&calibration_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi b/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi new file mode 100644 index 00000000000..d5275c496e3 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" +#include "ar934x_fortinet_loader.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,9600"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + }; +}; + +&ref { + clock-frequency = <25000000>; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&phy0>; + phy-mode = "rgmii-txid"; + + pll-data = <0x02000000 0x00000101 0x00001313>; +}; + +&pcie { + status = "okay"; + + ath9k: wifi@0,0,0 { + compatible = "pci168c,0030"; + reg = <0x0 0 0 0 0>; + }; +}; + +&wmac { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/ar9344_fortinet_fap-221-b.dts b/target/linux/ath79/dts/ar9344_fortinet_fap-221-b.dts new file mode 100644 index 00000000000..b78a588f5cc --- /dev/null +++ b/target/linux/ath79/dts/ar9344_fortinet_fap-221-b.dts @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_fortinet_ap-dual.dtsi" + +/ { + compatible = "fortinet,fap-221-b", "qca,ar9344"; + model = "Fortinet FAP-221-B"; + + leds { + compatible = "gpio-leds"; + + led_power: power_green { + label = "green:power"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + power_amber { + label = "amber:power"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + eth_green { + label = "green:eth"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + eth_amber { + label = "amber:eth"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wifi5g { + label = "green:wifi5g"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi2g { + label = "amber:wifi2g"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + virtual_flash { + devices = <&fwconcat0 &fwconcat1 &fwconcat2>; + }; +}; + +&ath9k { + ieee80211-freq-limit = <2402000 2482000>; + + nvmem-cells = <&calibration_pcie>; + nvmem-cell-names = "calibration"; +}; + +&wmac { + ieee80211-freq-limit = <2402000 2482000 4900000 5990000>; + + nvmem-cells = <&calibration_wmac>; + nvmem-cell-names = "calibration"; +}; + +&art { + compatible = "nvmem-cells"; + + calibration_wmac: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_pcie: calibration@5000 { + reg = <0x5000 0x440>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts index 8678315a44a..11205413f4c 100644 --- a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts +++ b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts @@ -91,15 +91,10 @@ }; partition@50000 { + /* Dual-Flash layout combined */ compatible = "denx,uimage"; label = "firmware"; - reg = <0x050000 0x740000>; - }; - - partition@790000 { - label = "vendor"; - reg = <0x790000 0x740000>; - read-only; + reg = <0x050000 0xe80000>; }; partition@ed0000 { diff --git a/target/linux/ath79/dts/ar934x_fortinet_loader.dtsi b/target/linux/ath79/dts/ar934x_fortinet_loader.dtsi new file mode 100644 index 00000000000..d7cbf2e7379 --- /dev/null +++ b/target/linux/ath79/dts/ar934x_fortinet_loader.dtsi @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include + +/ { + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = <0x73714f4b>; + label = "firmware"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&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 = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + fwconcat0: partition@40000 { + label = "fwconcat0"; + reg = <0x040000 0x900000>; + }; + + partition@940000 { + label = "loader"; + reg = <0x940000 0x010000>; + }; + + fwconcat1: partition@950000 { + label = "fwconcat1"; + reg = <0x950000 0x1a0000>; + }; + + fwconcat2: partition@af0000 { + label = "reserved"; + reg = <0xaf0000 0x500000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts index 8441e5c9a3c..85fd43699ee 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts @@ -84,15 +84,10 @@ }; partition@50000 { + /* Dual-Flash layout combined */ compatible = "denx,uimage"; label = "firmware"; - reg = <0x050000 0x740000>; - }; - - partition@790000 { - label = "vendor"; - reg = <0x790000 0x740000>; - read-only; + reg = <0x050000 0xe80000>; }; partition@ed0000 { diff --git a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts index e99059df047..be958d19a08 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts @@ -55,15 +55,10 @@ }; partition@50000 { + /* Dual-Flash layout combined */ compatible = "denx,uimage"; label = "firmware"; - reg = <0x050000 0x740000>; - }; - - partition@790000 { - label = "vendor"; - reg = <0x790000 0x740000>; - read-only; + reg = <0x050000 0xe80000>; }; partition@ed0000 { diff --git a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi index 2e407c34864..6704ec983b0 100644 --- a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi +++ b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi @@ -69,17 +69,12 @@ }; partition@70000 { + /* Combine kernel0 & kernel1 */ label = "firmware"; - reg = <0x070000 0x790000>; + reg = <0x070000 0xf20000>; compatible = "denx,uimage"; }; - partition@800000 { - label = "kernel1"; - reg = <0x800000 0x790000>; - read-only; - }; - partition@f90000 { label = "bs"; reg = <0xf90000 0x020000>; 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 92541cd9f8b..8b0fba7c69f 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 @@ -45,6 +45,7 @@ ath79_setup_interfaces() engenius,ecb600|\ enterasys,ws-ap3705i|\ extreme-networks,ws-ap3805i|\ + fortinet,fap-221-b|\ glinet,gl-ar300m-lite|\ glinet,gl-usb150|\ hak5,wifi-pineapple-nano|\ @@ -674,6 +675,10 @@ ath79_setup_macs() enterasys,ws-ap3705i) label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr) ;; + fortinet,fap-221-b) + lan_mac=$(mtd_get_mac_text u-boot 0x3ff80 12) + label_mac=$lan_mac + ;; hak5,lan-turtle|\ hak5,packet-squirrel) label_mac=$(mtd_get_mac_binary u-boot 0x1fc00) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index df7f1fc0cee..961f5f46aa0 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -124,8 +124,7 @@ case "$FIRMWARE" in "ath9k-eeprom-pci-0000:00:11.0.bin") case $board in buffalo,wzr-600dhp|\ - buffalo,wzr-hp-ag300h|\ - netgear,wndap360) + buffalo,wzr-hp-ag300h) caldata_extract "art" 0x1000 0xeb8 ;; dlink,dir-825-b1|\ @@ -144,8 +143,7 @@ case "$FIRMWARE" in "ath9k-eeprom-pci-0000:00:12.0.bin") case $board in buffalo,wzr-600dhp|\ - buffalo,wzr-hp-ag300h|\ - netgear,wndap360) + buffalo,wzr-hp-ag300h) caldata_extract "art" 0x5000 0xeb8 ;; dlink,dir-825-b1|\ 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 d03e88041ae..74e6738162f 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 @@ -35,7 +35,6 @@ case "$FIRMWARE" in sophos,ap55c|\ sophos,ap100|\ sophos,ap100c|\ - ubnt,aircube-ac|\ ubnt,bullet-ac|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 57458cdef07..74345843f55 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -35,6 +35,9 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress ;; + fortinet,fap-221-b) + macaddr_add "$(mtd_get_mac_text u-boot 0x3ff80 12)" $((PHYNBR*7+1)) > /sys${DEVPATH}/macaddress + ;; iodata,wn-ac1600dgr) # There is no eeprom data for 5 GHz wlan in "art" partition # which would allow to patch the macaddress diff --git a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh index d06f043ad4e..bf40efe72b6 100644 --- a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -19,6 +19,9 @@ preinit_set_mac_address() { siemens,ws-ap3610) ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr) ;; + fortinet,fap-221-b) + ip link set dev eth0 address $(mtd_get_mac_text u-boot 0x3ff80 12) + ;; tplink,deco-s4-v2) base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config)) ip link set dev eth0 address $base_mac diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh b/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh index de84233de10..23847a1aae4 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh @@ -8,8 +8,6 @@ # So the kernel check is for the loader, the rootfs check is for kernel + rootfs platform_do_upgrade_failsafe_datachk() { - local setenv_script="/tmp/fw_env_upgrade" - local flash_base=0x9f000000 local kernel_mtd=$(find_mtd_index ${KERNEL_PART:-kernel}) @@ -34,31 +32,33 @@ platform_do_upgrade_failsafe_datachk() { local rootfs_md5=$($IMAGE_CMD $ROOTFS_FILE | dd bs=4k count=$rootfs_blocks iflag=fullblock | md5sum | cut -d ' ' -f1) # prepare new u-boot-env vars - printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $setenv_script - printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $setenv_script - printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script + printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $ENV_SCRIPT + printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $ENV_SCRIPT + printf "vmlinux_checksum %s\n" ${kernel_md5} >> $ENV_SCRIPT - printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $setenv_script - printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $setenv_script - printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script + printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $ENV_SCRIPT + printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $ENV_SCRIPT + printf "rootfs_checksum %s\n" ${rootfs_md5} >> $ENV_SCRIPT # store u-boot-env mkdir -p /var/lock - fw_setenv -s $setenv_script || { + [ -n "$SKIP_HASH" ] || fw_setenv -s $ENV_SCRIPT || { echo 'failed to update U-Boot environment' exit 1 } # sysupgrade - sleep 2 - sync - echo 3 > /proc/sys/vm/drop_caches + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + $IMAGE_CMD $KERNEL_FILE | mtd $MTD_ARGS write - ${KERNEL_PART:-kernel} - sleep 2 - sync + + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + if [ -n "$UPGRADE_BACKUP" ]; then $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j $UPGRADE_BACKUP write - ${ROOTFS_PART:-rootfs} else $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS write - ${ROOTFS_PART:-rootfs} fi + + sync } diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index c58e0053448..d03163a8eaf 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -45,6 +45,18 @@ platform_do_upgrade() { watchguard,ap100|\ watchguard,ap200|\ watchguard,ap300) + ENV_SCRIPT="/tmp/fw_env" + IMAGE_LIST="tar tzf $1" + IMAGE_CMD="tar xzOf $1" + KERNEL_PART="loader" + ROOTFS_PART="fwconcat0" + KERNEL_FILE="uImage-lzma.bin" + ROOTFS_FILE="root.squashfs" + platform_do_upgrade_failsafe_datachk "$1" + ;; + fortinet,fap-221-b) + SKIP_HASH="1" + ENV_SCRIPT="/dev/null" IMAGE_LIST="tar tzf $1" IMAGE_CMD="tar xzOf $1" KERNEL_PART="loader" diff --git a/target/linux/ath79/image/common-senao.mk b/target/linux/ath79/image/common-senao.mk index e0e60dbe277..9034aa28dbc 100644 --- a/target/linux/ath79/image/common-senao.mk +++ b/target/linux/ath79/image/common-senao.mk @@ -37,6 +37,7 @@ endef define Device/senao_loader_okli $(Device/loader-okli-uimage) KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x73714f4b + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none LOADER_KERNEL_MAGIC := 0x73714f4b IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index bed043c3a78..8eeaa8de3e4 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -229,7 +229,7 @@ TARGET_DEVICES += ubnt_unifi-ap-lr define Device/ubnt_unifiac DEVICE_VENDOR := Ubiquiti SOC := qca9563 - IMAGE_SIZE := 7744k + IMAGE_SIZE := 15488k DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct endef diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index d66684a124e..ec7cbb950ae 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1324,6 +1324,22 @@ define Device/extreme-networks_ws-ap3805i endef TARGET_DEVICES += extreme-networks_ws-ap3805i +define Device/fortinet_fap-221-b + $(Device/senao_loader_okli) + SOC := ar9344 + DEVICE_VENDOR := Fortinet + DEVICE_MODEL := FAP-221-B + FACTORY_IMG_NAME := FP221B-9.99-AP-build999-999999-patch99 + IMAGE_SIZE := 9216k + LOADER_FLASH_OFFS := 0x040000 + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | \ + check-size | pad-to $$$$(IMAGE_SIZE) | \ + append-loader-okli-uimage $(1) | pad-to 10944k | \ + gzip-filename $$$$(FACTORY_IMG_NAME) +endef +TARGET_DEVICES += fortinet_fap-221-b + define Device/glinet_6408 $(Device/tplink-8mlzma) SOC := ar9331 @@ -1763,7 +1779,7 @@ define Device/netgear_wndap360 $(Device/netgear_generic) SOC := ar7161 DEVICE_MODEL := WNDAP360 - DEVICE_PACKAGES := kmod-leds-reset kmod-owl-loader + DEVICE_PACKAGES := kmod-leds-reset IMAGE_SIZE := 7744k BLOCKSIZE := 256k KERNEL := kernel-bin | append-dtb | gzip | uImage gzip @@ -1891,7 +1907,7 @@ define Device/ocedo_koala DEVICE_MODEL := Koala DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct SUPPORTED_DEVICES += koala - IMAGE_SIZE := 7424k + IMAGE_SIZE := 14848k endef TARGET_DEVICES += ocedo_koala @@ -1899,7 +1915,7 @@ define Device/ocedo_raccoon SOC := ar9344 DEVICE_VENDOR := Ocedo DEVICE_MODEL := Raccoon - IMAGE_SIZE := 7424k + IMAGE_SIZE := 14848k endef TARGET_DEVICES += ocedo_raccoon @@ -1908,7 +1924,7 @@ define Device/ocedo_ursus DEVICE_VENDOR := Ocedo DEVICE_MODEL := Ursus DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct - IMAGE_SIZE := 7424k + IMAGE_SIZE := 14848k endef TARGET_DEVICES += ocedo_ursus diff --git a/target/linux/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk index 30474149d3a..93cbc7d148c 100644 --- a/target/linux/ath79/image/tiny-tp-link.mk +++ b/target/linux/ath79/image/tiny-tp-link.mk @@ -234,6 +234,7 @@ define Device/tplink_tl-wpa8630p-v2 so the JFFS2 settings partition MUST be reformatted to avoid data corruption. \ Backup your settings before upgrading, then during sysupgrade, \ de-select "Keep settings" and select "Force" to continue (equivilant to "sysupgrade -n -F"). + DEFAULT := n endef define Device/tplink_tl-wpa8630p-v2-int 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 53ddcd46e50..1891a6425ec 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 @@ -326,7 +326,7 @@ SVN-Revision: 35130 #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1470,8 +1470,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1469,8 +1469,8 @@ struct sk_buff *inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; diff --git a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index 98939ac9e38..96136a43e87 100644 --- a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-5.15/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 -@@ -3095,6 +3095,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3096,6 +3096,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; -@@ -3149,7 +3150,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3150,7 +3151,12 @@ int spi_nor_scan(struct spi_nor *nor, co if (ret) return ret; @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -845,6 +845,17 @@ out_error: +@@ -847,6 +847,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch b/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch index a425f8639d6..d287b6de19b 100644 --- a/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch +++ b/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch @@ -45,7 +45,7 @@ Submitted-by: Christopher Hill --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig -@@ -2174,6 +2174,14 @@ config RAVE_SP_CORE +@@ -2175,6 +2175,14 @@ config RAVE_SP_CORE Select this to get support for the Supervisory Processor device found on several devices in RAVE line of hardware. diff --git a/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh b/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh index de84233de10..23847a1aae4 100644 --- a/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh +++ b/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh @@ -8,8 +8,6 @@ # So the kernel check is for the loader, the rootfs check is for kernel + rootfs platform_do_upgrade_failsafe_datachk() { - local setenv_script="/tmp/fw_env_upgrade" - local flash_base=0x9f000000 local kernel_mtd=$(find_mtd_index ${KERNEL_PART:-kernel}) @@ -34,31 +32,33 @@ platform_do_upgrade_failsafe_datachk() { local rootfs_md5=$($IMAGE_CMD $ROOTFS_FILE | dd bs=4k count=$rootfs_blocks iflag=fullblock | md5sum | cut -d ' ' -f1) # prepare new u-boot-env vars - printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $setenv_script - printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $setenv_script - printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script + printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $ENV_SCRIPT + printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $ENV_SCRIPT + printf "vmlinux_checksum %s\n" ${kernel_md5} >> $ENV_SCRIPT - printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $setenv_script - printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $setenv_script - printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script + printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $ENV_SCRIPT + printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $ENV_SCRIPT + printf "rootfs_checksum %s\n" ${rootfs_md5} >> $ENV_SCRIPT # store u-boot-env mkdir -p /var/lock - fw_setenv -s $setenv_script || { + [ -n "$SKIP_HASH" ] || fw_setenv -s $ENV_SCRIPT || { echo 'failed to update U-Boot environment' exit 1 } # sysupgrade - sleep 2 - sync - echo 3 > /proc/sys/vm/drop_caches + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + $IMAGE_CMD $KERNEL_FILE | mtd $MTD_ARGS write - ${KERNEL_PART:-kernel} - sleep 2 - sync + + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + if [ -n "$UPGRADE_BACKUP" ]; then $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j $UPGRADE_BACKUP write - ${ROOTFS_PART:-rootfs} else $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS write - ${ROOTFS_PART:-rootfs} fi + + sync } diff --git a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh index 6d05b88d45c..eb8441c6d26 100644 --- a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh @@ -19,6 +19,7 @@ platform_do_upgrade() { engenius,eap350-v1|\ engenius,ecb350-v1|\ engenius,enh202-v1) + ENV_SCRIPT="/tmp/fw_env" IMAGE_LIST="tar tzf $1" IMAGE_CMD="tar xzOf $1" KERNEL_PART="loader" diff --git a/target/linux/bcm27xx/patches-5.15/950-0028-Revert-spi-spidev-Fix-CS-polarity-if-GPIO-descriptor.patch b/target/linux/bcm27xx/patches-5.15/950-0028-Revert-spi-spidev-Fix-CS-polarity-if-GPIO-descriptor.patch index c66bb9d6216..49829a6d3af 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0028-Revert-spi-spidev-Fix-CS-polarity-if-GPIO-descriptor.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0028-Revert-spi-spidev-Fix-CS-polarity-if-GPIO-descriptor.patch @@ -11,7 +11,7 @@ This reverts commit 83b2a8fe43bda0c11981ad6afa5dd0104d78be28. --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c -@@ -402,7 +402,6 @@ spidev_ioctl(struct file *filp, unsigned +@@ -413,7 +413,6 @@ spidev_ioctl(struct file *filp, unsigned else retval = get_user(tmp, (u32 __user *)arg); if (retval == 0) { @@ -19,7 +19,7 @@ This reverts commit 83b2a8fe43bda0c11981ad6afa5dd0104d78be28. u32 save = spi->mode; if (tmp & ~SPI_MODE_MASK) { -@@ -410,10 +409,6 @@ spidev_ioctl(struct file *filp, unsigned +@@ -421,10 +420,6 @@ spidev_ioctl(struct file *filp, unsigned break; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch b/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch index 87c1cdc7b5d..ff9a6b09a27 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c -@@ -747,7 +747,7 @@ static int spidev_probe(struct spi_devic +@@ -761,7 +761,7 @@ static int spidev_probe(struct spi_devic * compatible string, it is a Linux implementation thing * rather than a description of the hardware. */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0056-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch b/target/linux/bcm27xx/patches-5.15/950-0056-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch index fe2b83dd42b..3c90882138f 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0056-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0056-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 -@@ -2744,7 +2744,12 @@ static int pl011_setup_port(struct devic +@@ -2756,7 +2756,12 @@ static int pl011_setup_port(struct devic if (IS_ERR(base)) return PTR_ERR(base); diff --git a/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch b/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch index 8fb5c393b66..632862908d9 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0057-amba_pl011-Round-input-clock-up.patch @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -1727,6 +1727,23 @@ static void pl011_put_poll_char(struct u +@@ -1730,6 +1730,23 @@ static void pl011_put_poll_char(struct u #endif /* CONFIG_CONSOLE_POLL */ @@ -50,7 +50,7 @@ Signed-off-by: Phil Elwell static int pl011_hwinit(struct uart_port *port) { struct uart_amba_port *uap = -@@ -1743,7 +1760,7 @@ static int pl011_hwinit(struct uart_port +@@ -1746,7 +1763,7 @@ static int pl011_hwinit(struct uart_port if (retval) return retval; @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell /* Clear pending error and receive interrupts */ pl011_write(UART011_OEIS | UART011_BEIS | UART011_PEIS | -@@ -2440,7 +2457,7 @@ static int pl011_console_setup(struct co +@@ -2452,7 +2469,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; -@@ -2657,6 +2674,7 @@ static struct uart_driver amba_reg = { +@@ -2669,6 +2686,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; -@@ -2688,6 +2706,7 @@ static int pl011_probe_dt_alias(int inde +@@ -2700,6 +2718,7 @@ static int pl011_probe_dt_alias(int inde return ret; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch b/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch index 88388f42599..beb2c67e39c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0058-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -1432,6 +1432,7 @@ static bool pl011_tx_char(struct uart_am +@@ -1435,6 +1435,7 @@ static bool pl011_tx_char(struct uart_am return false; /* unable to transmit character */ pl011_write(c, uap, REG_DR); diff --git a/target/linux/bcm27xx/patches-5.15/950-0059-amba_pl011-Add-cts-event-workaround-DT-property.patch b/target/linux/bcm27xx/patches-5.15/950-0059-amba_pl011-Add-cts-event-workaround-DT-property.patch index 02d86cfc614..1d4cdbca647 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0059-amba_pl011-Add-cts-event-workaround-DT-property.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0059-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 -@@ -2835,6 +2835,11 @@ static int pl011_probe(struct amba_devic +@@ -2847,6 +2847,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.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch b/target/linux/bcm27xx/patches-5.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch index 7607714a20e..431f588a4c5 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0061-tty-amba-pl011-Avoid-rare-write-when-full-error.patch @@ -29,7 +29,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -1493,6 +1493,10 @@ static bool pl011_tx_chars(struct uart_a +@@ -1496,6 +1496,10 @@ static bool pl011_tx_chars(struct uart_a if (likely(from_irq) && count-- == 0) break; diff --git a/target/linux/bcm27xx/patches-5.15/950-0077-firmware-bcm2835-Support-ARCH_BCM270x.patch b/target/linux/bcm27xx/patches-5.15/950-0077-firmware-bcm2835-Support-ARCH_BCM270x.patch index 7dfc34c4520..bed4f1fc20c 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0077-firmware-bcm2835-Support-ARCH_BCM270x.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0077-firmware-bcm2835-Support-ARCH_BCM270x.patch @@ -36,7 +36,7 @@ Signed-off-by: Noralf Trønnes static DEFINE_MUTEX(transaction_lock); static void response_callback(struct mbox_client *cl, void *msg) -@@ -279,6 +281,7 @@ static int rpi_firmware_probe(struct pla +@@ -280,6 +282,7 @@ static int rpi_firmware_probe(struct pla kref_init(&fw->consumers); platform_set_drvdata(pdev, fw); @@ -44,7 +44,7 @@ Signed-off-by: Noralf Trønnes rpi_firmware_print_firmware_revision(fw); rpi_register_hwmon_driver(dev, fw); -@@ -307,6 +310,7 @@ static int rpi_firmware_remove(struct pl +@@ -308,6 +311,7 @@ static int rpi_firmware_remove(struct pl rpi_clk = NULL; rpi_firmware_put(fw); @@ -52,7 +52,7 @@ Signed-off-by: Noralf Trønnes return 0; } -@@ -381,7 +385,18 @@ static struct platform_driver rpi_firmwa +@@ -382,7 +386,18 @@ static struct platform_driver rpi_firmwa .shutdown = rpi_firmware_shutdown, .remove = rpi_firmware_remove, }; diff --git a/target/linux/bcm27xx/patches-5.15/950-0083-mfd-Add-Raspberry-Pi-Sense-HAT-core-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0083-mfd-Add-Raspberry-Pi-Sense-HAT-core-driver.patch index 1fcd072780a..74866d40087 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0083-mfd-Add-Raspberry-Pi-Sense-HAT-core-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0083-mfd-Add-Raspberry-Pi-Sense-HAT-core-driver.patch @@ -27,7 +27,7 @@ mfd: Add rpi_sense_core of compatible string --- a/drivers/input/joystick/Kconfig +++ b/drivers/input/joystick/Kconfig -@@ -399,4 +399,12 @@ config JOYSTICK_N64 +@@ -400,4 +400,12 @@ config JOYSTICK_N64 Say Y here if you want enable support for the four built-in controller ports on the Nintendo 64 console. diff --git a/target/linux/bcm27xx/patches-5.15/950-0101-firmware-raspberrypi-Notify-firmware-of-a-reboot.patch b/target/linux/bcm27xx/patches-5.15/950-0101-firmware-raspberrypi-Notify-firmware-of-a-reboot.patch index 9f5efed269f..dcf63924db3 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0101-firmware-raspberrypi-Notify-firmware-of-a-reboot.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0101-firmware-raspberrypi-Notify-firmware-of-a-reboot.patch @@ -48,7 +48,7 @@ Signed-off-by: Phil Elwell static void rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) { -@@ -386,15 +407,32 @@ static struct platform_driver rpi_firmwa +@@ -387,15 +408,32 @@ static struct platform_driver rpi_firmwa .remove = rpi_firmware_remove, }; diff --git a/target/linux/bcm27xx/patches-5.15/950-0113-firmware-raspberrypi-Report-the-fw-variant-during-pr.patch b/target/linux/bcm27xx/patches-5.15/950-0113-firmware-raspberrypi-Report-the-fw-variant-during-pr.patch index 6f042f9dd44..04f4ade831b 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0113-firmware-raspberrypi-Report-the-fw-variant-during-pr.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0113-firmware-raspberrypi-Report-the-fw-variant-during-pr.patch @@ -80,7 +80,7 @@ Signed-off-by: Dave Stevenson } static void -@@ -338,6 +375,7 @@ static int rpi_firmware_probe(struct pla +@@ -339,6 +376,7 @@ static int rpi_firmware_probe(struct pla g_pdev = pdev; rpi_firmware_print_firmware_revision(fw); diff --git a/target/linux/bcm27xx/patches-5.15/950-0190-Initialise-rpi-firmware-before-clk-bcm2835.patch b/target/linux/bcm27xx/patches-5.15/950-0190-Initialise-rpi-firmware-before-clk-bcm2835.patch index 96451c9c751..a5c4c60c38b 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0190-Initialise-rpi-firmware-before-clk-bcm2835.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0190-Initialise-rpi-firmware-before-clk-bcm2835.patch @@ -36,7 +36,7 @@ Co-authored-by: Phil Elwell MODULE_DESCRIPTION("BCM2835 clock driver"); --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c -@@ -498,7 +498,7 @@ out2: +@@ -499,7 +499,7 @@ out2: out1: return ret; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0198-drm-fourcc-Add-packed-10bit-YUV-4-2-0-format.patch b/target/linux/bcm27xx/patches-5.15/950-0198-drm-fourcc-Add-packed-10bit-YUV-4-2-0-format.patch deleted file mode 100644 index 613f74adb97..00000000000 --- a/target/linux/bcm27xx/patches-5.15/950-0198-drm-fourcc-Add-packed-10bit-YUV-4-2-0-format.patch +++ /dev/null @@ -1,55 +0,0 @@ -From cf7d5f766e0a9eeb09271c36f546ac0a1fdc0444 Mon Sep 17 00:00:00 2001 -From: Dave Stevenson -Date: Fri, 24 Jan 2020 14:22:06 +0000 -Subject: [PATCH] drm/fourcc: Add packed 10bit YUV 4:2:0 format - -Adds a format that is 3 10bit YUV 4:2:0 samples packed into -a 32bit work (with 2 spare bits). - -Supported on Broadcom BCM2711 chips. - -Signed-off-by: Dave Stevenson ---- - drivers/gpu/drm/drm_fourcc.c | 3 +++ - include/uapi/drm/drm_fourcc.h | 11 +++++++++++ - 2 files changed, 14 insertions(+) - ---- a/drivers/gpu/drm/drm_fourcc.c -+++ b/drivers/gpu/drm/drm_fourcc.c -@@ -266,6 +266,9 @@ const struct drm_format_info *__drm_form - .num_planes = 3, .char_per_block = { 2, 2, 2 }, - .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, - .vsub = 0, .is_yuv = true }, -+ { .format = DRM_FORMAT_P030, .depth = 0, .num_planes = 2, -+ .char_per_block = { 4, 4, 0 }, .block_w = { 3, 0, 0 }, .block_h = { 1, 0, 0 }, -+ .hsub = 2, .vsub = 2, .is_yuv = true}, - }; - - unsigned int i; ---- a/include/uapi/drm/drm_fourcc.h -+++ b/include/uapi/drm/drm_fourcc.h -@@ -325,6 +325,13 @@ extern "C" { - #define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') - - /* -+ * 2 plane YCbCr MSB aligned, 3 pixels packed into 4 bytes. -+ * index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian -+ * index 1 = Cr:Cb plane, [63:0] x:Cr2:Cb2:Cr1:x:Cb1:Cr0:Cb0 [2:10:10:10:2:10:10:10] little endian -+ */ -+#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel packed */ -+ -+/* - * 3 plane YCbCr - * index 0: Y plane, [7:0] Y - * index 1: Cb plane, [7:0] Cb -@@ -842,6 +849,10 @@ drm_fourcc_canonicalize_nvidia_format_mo - * and UV. Some SAND-using hardware stores UV in a separate tiled - * image from Y to reduce the column height, which is not supported - * with these modifiers. -+ * -+ * The DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT modifier is also -+ * supported for DRM_FORMAT_P030 where the columns remain as 128 bytes -+ * wide, but as this is a 10 bpp format that translates to 96 pixels. - */ - - #define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \ diff --git a/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch b/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch index b7146a27385..85e98e7d687 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0238-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell /* Device and char device-related information */ static DEFINE_IDA(gpio_ida); static dev_t gpio_devt; -@@ -2392,8 +2394,8 @@ int gpiod_direction_output(struct gpio_d +@@ -2395,8 +2397,8 @@ int gpiod_direction_output(struct gpio_d value = !!value; /* GPIOs used for enabled IRQs shall not be set as output */ @@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell gpiod_err(desc, "%s: tried to set a GPIO tied to an IRQ as output\n", __func__); -@@ -3211,8 +3213,8 @@ int gpiochip_lock_as_irq(struct gpio_chi +@@ -3213,8 +3215,8 @@ int gpiochip_lock_as_irq(struct gpio_chi } /* To be valid for IRQ the line needs to be input or open drain */ diff --git a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch index ce189789789..2727d476d94 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch @@ -25,7 +25,7 @@ Signed-off-by: Naushir Patuck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17521,6 +17521,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -17529,6 +17529,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch index bf0a69ffe5b..f21349769cd 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17535,6 +17535,7 @@ M: Raspberry Pi Kernel Maintenance +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17539,6 +17539,14 @@ F: Documentation/devicetree/bindings/med +@@ -17547,6 +17547,14 @@ F: Documentation/devicetree/bindings/med F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0578-spi-spidev-Restore-loading-from-Device-Tree.patch b/target/linux/bcm27xx/patches-5.15/950-0578-spi-spidev-Restore-loading-from-Device-Tree.patch index 8f90c6e6aec..1fb800fee21 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0578-spi-spidev-Restore-loading-from-Device-Tree.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0578-spi-spidev-Restore-loading-from-Device-Tree.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c -@@ -669,6 +669,7 @@ static const struct file_operations spid +@@ -680,6 +680,7 @@ static const struct file_operations spid static struct class *spidev_class; static const struct spi_device_id spidev_spi_ids[] = { diff --git a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch index f9907cc82a5..40632ecf134 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch @@ -205,7 +205,7 @@ Signed-off-by: Jonathan Bell xhci_err(xhci, "Tried to move enqueue past ring segment\n"); return; } -@@ -3153,7 +3156,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd +@@ -3159,7 +3162,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd * that clears the EHB. */ while (xhci_handle_event(xhci) > 0) { @@ -214,7 +214,7 @@ Signed-off-by: Jonathan Bell continue; xhci_update_erst_dequeue(xhci, event_ring_deq); event_ring_deq = xhci->event_ring->dequeue; -@@ -3295,7 +3298,8 @@ static int prepare_ring(struct xhci_hcd +@@ -3301,7 +3304,8 @@ static int prepare_ring(struct xhci_hcd } } diff --git a/target/linux/bcm27xx/patches-5.15/950-0694-drm-panel-panel-sitronix-st7701-Support-SPI-config-a.patch b/target/linux/bcm27xx/patches-5.15/950-0694-drm-panel-panel-sitronix-st7701-Support-SPI-config-a.patch index f4cc7a87e34..ea7313e97b2 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0694-drm-panel-panel-sitronix-st7701-Support-SPI-config-a.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0694-drm-panel-panel-sitronix-st7701-Support-SPI-config-a.patch @@ -440,9 +440,9 @@ Signed-off-by: Dave Stevenson st7701->dsi = dsi; - st7701->desc = desc; - return mipi_dsi_attach(dsi); - } -@@ -397,21 +639,115 @@ static int st7701_dsi_remove(struct mipi + ret = mipi_dsi_attach(dsi); + if (ret) +@@ -405,21 +647,115 @@ static int st7701_dsi_remove(struct mipi return 0; } diff --git a/target/linux/bcm27xx/patches-5.15/950-0696-spi-gpio-Add-sck-idle-input-property.patch b/target/linux/bcm27xx/patches-5.15/950-0696-spi-gpio-Add-sck-idle-input-property.patch index 6b359c4bb82..388528549d8 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0696-spi-gpio-Add-sck-idle-input-property.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0696-spi-gpio-Add-sck-idle-input-property.patch @@ -47,7 +47,7 @@ Signed-off-by: Phil Elwell } static int spi_gpio_setup(struct spi_device *spi) -@@ -289,6 +297,7 @@ static int spi_gpio_request(struct devic +@@ -299,6 +307,7 @@ static int spi_gpio_request(struct devic if (IS_ERR(spi_gpio->miso)) return PTR_ERR(spi_gpio->miso); diff --git a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch index 34562507c29..aa54439b325 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3608,14 +3608,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3614,14 +3614,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -54,7 +54,7 @@ Signed-off-by: Jonathan Bell full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ if (urb->num_sgs && !(urb->transfer_flags & URB_DMA_MAP_SINGLE)) { -@@ -3652,6 +3653,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3658,6 +3659,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * start_cycle = ring->cycle_state; send_addr = addr; @@ -72,7 +72,7 @@ Signed-off-by: Jonathan Bell /* Queue the TRBs, even if they are zero-length */ for (enqd_len = 0; first_trb || enqd_len < full_len; enqd_len += trb_buff_len) { -@@ -3664,6 +3676,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3670,6 +3682,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; diff --git a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch index 273a769ff98..313a664f591 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch @@ -13,7 +13,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3608,7 +3608,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3614,7 +3614,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell u32 field, length_field, remainder, maxpacket; u64 addr, send_addr; -@@ -3654,14 +3654,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3660,14 +3660,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * send_addr = addr; if (xhci->quirks & XHCI_VLI_SS_BULK_OUT_BUG && @@ -40,7 +40,7 @@ Signed-off-by: Jonathan Bell } /* Queue the TRBs, even if they are zero-length */ -@@ -3676,7 +3671,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3682,7 +3677,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; diff --git a/target/linux/bcm27xx/patches-5.15/950-0890-hwmon-emc2305-add-support-for-EMC2301-2-3-5-RPM-base.patch b/target/linux/bcm27xx/patches-5.15/950-0890-hwmon-emc2305-add-support-for-EMC2301-2-3-5-RPM-base.patch index 9c47e48843a..f25495290dc 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0890-hwmon-emc2305-add-support-for-EMC2301-2-3-5-RPM-base.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0890-hwmon-emc2305-add-support-for-EMC2301-2-3-5-RPM-base.patch @@ -22,7 +22,7 @@ Reviewed-by: Vadim Pasternak --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig -@@ -1684,6 +1684,19 @@ config SENSORS_EMC2103 +@@ -1685,6 +1685,19 @@ config SENSORS_EMC2103 This driver can also be built as a module. If so, the module will be called emc2103. diff --git a/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch b/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch index cfd53525a9e..4874fd12379 100644 --- a/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch +++ b/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch @@ -116,7 +116,7 @@ Signed-off-by: Jonas Gorski } --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c -@@ -1799,7 +1799,8 @@ int gpiochip_add_pingroup_range(struct g +@@ -1802,7 +1802,8 @@ int gpiochip_add_pingroup_range(struct g list_add_tail(&pin_range->node, &gdev->pin_ranges); @@ -126,7 +126,7 @@ Signed-off-by: Jonas Gorski } EXPORT_SYMBOL_GPL(gpiochip_add_pingroup_range); -@@ -1856,7 +1857,7 @@ int gpiochip_add_pin_range(struct gpio_c +@@ -1859,7 +1860,7 @@ int gpiochip_add_pin_range(struct gpio_c list_add_tail(&pin_range->node, &gdev->pin_ranges); diff --git a/target/linux/bcm63xx/patches-5.15/339-MIPS-BCM63XX-add-support-for-BCM63268.patch b/target/linux/bcm63xx/patches-5.15/339-MIPS-BCM63XX-add-support-for-BCM63268.patch index bba964f4811..3336e4e351c 100644 --- a/target/linux/bcm63xx/patches-5.15/339-MIPS-BCM63XX-add-support-for-BCM63268.patch +++ b/target/linux/bcm63xx/patches-5.15/339-MIPS-BCM63XX-add-support-for-BCM63268.patch @@ -107,7 +107,7 @@ Signed-off-by: Jonas Gorski } static struct clk clk_pcie = { -@@ -548,6 +562,21 @@ static struct clk_lookup bcm6368_clks[] +@@ -550,6 +564,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 -@@ -580,6 +609,10 @@ static int __init bcm63xx_clk_init(void) +@@ -582,6 +611,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.15/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/bcm63xx/patches-5.15/341-MIPS-BCM63XX-add-support-for-BCM6318.patch index cb0f8f3e1b6..d4e195fc4b2 100644 --- a/target/linux/bcm63xx/patches-5.15/341-MIPS-BCM63XX-add-support-for-BCM6318.patch +++ b/target/linux/bcm63xx/patches-5.15/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; -@@ -456,6 +458,19 @@ static struct clk_lookup bcm3368_clks[] +@@ -458,6 +460,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), -@@ -577,6 +592,7 @@ static struct clk_lookup bcm63268_clks[] +@@ -579,6 +594,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 -@@ -586,6 +602,10 @@ static int __init bcm63xx_clk_init(void) +@@ -588,6 +604,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.15/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch b/target/linux/bcm63xx/patches-5.15/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch index d6b1190b9d8..b5085ea7d47 100644 --- a/target/linux/bcm63xx/patches-5.15/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch +++ b/target/linux/bcm63xx/patches-5.15/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 -@@ -501,6 +501,8 @@ static struct clk_lookup bcm3368_clks[] +@@ -503,6 +503,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), -@@ -517,7 +519,9 @@ static struct clk_lookup bcm6318_clks[] +@@ -519,7 +521,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), -@@ -531,7 +535,10 @@ static struct clk_lookup bcm6328_clks[] +@@ -533,7 +537,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), -@@ -544,6 +551,7 @@ static struct clk_lookup bcm6338_clks[] +@@ -546,6 +553,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), -@@ -558,6 +566,7 @@ static struct clk_lookup bcm6345_clks[] +@@ -560,6 +568,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), -@@ -572,6 +581,7 @@ static struct clk_lookup bcm6348_clks[] +@@ -574,6 +583,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), -@@ -588,6 +598,8 @@ static struct clk_lookup bcm6358_clks[] +@@ -590,6 +600,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), -@@ -607,7 +619,10 @@ static struct clk_lookup bcm6362_clks[] +@@ -609,7 +621,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), -@@ -623,6 +638,8 @@ static struct clk_lookup bcm6368_clks[] +@@ -625,6 +640,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), -@@ -637,7 +654,10 @@ static struct clk_lookup bcm63268_clks[] +@@ -639,7 +656,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.15/430-MIPS-BCM63XX-add-nand-clocks.patch b/target/linux/bcm63xx/patches-5.15/430-MIPS-BCM63XX-add-nand-clocks.patch index a29c3b780bf..b5979ff248f 100644 --- a/target/linux/bcm63xx/patches-5.15/430-MIPS-BCM63XX-add-nand-clocks.patch +++ b/target/linux/bcm63xx/patches-5.15/430-MIPS-BCM63XX-add-nand-clocks.patch @@ -24,7 +24,7 @@ * Internal peripheral clock */ static struct clk clk_periph = { -@@ -624,6 +641,7 @@ static struct clk_lookup bcm6362_clks[] +@@ -626,6 +643,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), -@@ -641,6 +659,7 @@ static struct clk_lookup bcm6368_clks[] +@@ -643,6 +661,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), -@@ -659,6 +678,7 @@ static struct clk_lookup bcm63268_clks[] +@@ -661,6 +680,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.10/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch b/target/linux/generic/backport-5.10/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch new file mode 100644 index 00000000000..2358352e93c --- /dev/null +++ b/target/linux/generic/backport-5.10/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch @@ -0,0 +1,49 @@ +From 6abef37d16d0c570ef5a149e63762fba2a30804b Mon Sep 17 00:00:00 2001 +From: "Leon M. George" +Date: Wed, 30 Mar 2022 16:16:56 +0200 +Subject: [PATCH] mtd: spi-nor: support eon en25qh256a variant + +The EN25QH256A variant of the EN25QH256 doesn't initialize correctly from SFDP +alone and only accesses memory below 8m (addr_width is 4 but read_opcode takes +only 3 bytes). + +Set SNOR_F_4B_OPCODES if the flash chip variant was detected using hwcaps. + +The fix submitted upstream uses the PARSE_SFDP initializer that is not +available in the kernel used with Openwrt. + +Signed-off-by: Leon M. George +--- + drivers/mtd/spi-nor/eon.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/mtd/spi-nor/eon.c ++++ b/drivers/mtd/spi-nor/eon.c +@@ -8,6 +8,16 @@ + + #include "core.h" + ++static void en25qh256_post_sfdp_fixups(struct spi_nor *nor) ++{ ++ if (nor->params->hwcaps.mask & SNOR_HWCAPS_READ_1_1_4) ++ nor->flags |= SNOR_F_4B_OPCODES; ++} ++ ++static const struct spi_nor_fixups en25qh256_fixups = { ++ .post_sfdp = en25qh256_post_sfdp_fixups, ++}; ++ + static const struct flash_info eon_parts[] = { + /* EON -- en25xxx */ + { "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64, SECT_4K) }, +@@ -23,7 +33,9 @@ static const struct flash_info eon_parts + { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128, + SECT_4K | SPI_NOR_DUAL_READ) }, + { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, +- { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, ++ { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, ++ SPI_NOR_DUAL_READ) ++ .fixups = &en25qh256_fixups }, + { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, + }; + diff --git a/target/linux/generic/backport-5.10/615-v5.14-ip-Treat-IPv4-segment-s-lowest-address-as-unicast.patch b/target/linux/generic/backport-5.10/615-v5.14-ip-Treat-IPv4-segment-s-lowest-address-as-unicast.patch new file mode 100644 index 00000000000..8aabbe28599 --- /dev/null +++ b/target/linux/generic/backport-5.10/615-v5.14-ip-Treat-IPv4-segment-s-lowest-address-as-unicast.patch @@ -0,0 +1,32 @@ +From 94c821c74bf5fe0c25e09df5334a16f98608db90 Mon Sep 17 00:00:00 2001 +From: Seth David Schoen +Date: Wed, 12 May 2021 21:37:49 -0700 +Subject: [PATCH] ip: Treat IPv4 segment's lowest address as unicast + +Treat only the highest, not the lowest, IPv4 address within a local +subnet as a broadcast address. + +Signed-off-by: Seth David Schoen +Suggested-by: John Gilmore +Acked-by: Dave Taht +Reviewed-by: David Ahern +Signed-off-by: David S. Miller +Link: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=94c821c74bf5 +--- + net/ipv4/fib_frontend.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/net/ipv4/fib_frontend.c ++++ b/net/ipv4/fib_frontend.c +@@ -1129,10 +1129,8 @@ void fib_add_ifaddr(struct in_ifaddr *if + prefix, ifa->ifa_prefixlen, prim, + ifa->ifa_rt_priority); + +- /* Add network specific broadcasts, when it takes a sense */ ++ /* Add the network broadcast address, when it makes sense */ + if (ifa->ifa_prefixlen < 31) { +- fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix, 32, +- prim, 0); + fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix | ~mask, + 32, prim, 0); + arp_invalidate(dev, prefix | ~mask, false); diff --git a/target/linux/generic/backport-5.10/732-v5.13-0003-of-base-Fix-some-formatting-issues-and-provide-missi.patch b/target/linux/generic/backport-5.10/732-v5.13-0003-of-base-Fix-some-formatting-issues-and-provide-missi.patch new file mode 100644 index 00000000000..33808f88a33 --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0003-of-base-Fix-some-formatting-issues-and-provide-missi.patch @@ -0,0 +1,95 @@ +From 3637d49e11219512920aca8b8ccd0994be33fa8b Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Thu, 18 Mar 2021 10:40:30 +0000 +Subject: [PATCH] of: base: Fix some formatting issues and provide missing + descriptions + +Fixes the following W=1 kernel build warning(s): + + drivers/of/base.c:315: warning: Function parameter or member 'cpun' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: Function parameter or member 'prop_name' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: Function parameter or member 'cpu' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: Function parameter or member 'thread' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: expecting prototype for property holds the physical id of the(). Prototype was for __of_find_n_match_cpu_property() instead + drivers/of/base.c:1139: warning: Function parameter or member 'match' not described in 'of_find_matching_node_and_match' + drivers/of/base.c:1779: warning: Function parameter or member 'np' not described in '__of_add_property' + drivers/of/base.c:1779: warning: Function parameter or member 'prop' not described in '__of_add_property' + drivers/of/base.c:1800: warning: Function parameter or member 'np' not described in 'of_add_property' + drivers/of/base.c:1800: warning: Function parameter or member 'prop' not described in 'of_add_property' + drivers/of/base.c:1849: warning: Function parameter or member 'np' not described in 'of_remove_property' + drivers/of/base.c:1849: warning: Function parameter or member 'prop' not described in 'of_remove_property' + drivers/of/base.c:2137: warning: Function parameter or member 'dn' not described in 'of_console_check' + drivers/of/base.c:2137: warning: Function parameter or member 'name' not described in 'of_console_check' + drivers/of/base.c:2137: warning: Function parameter or member 'index' not described in 'of_console_check' + +Cc: Rob Herring +Cc: Frank Rowand +Cc: "David S. Miller" +Cc: devicetree@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20210318104036.3175910-5-lee.jones@linaro.org +--- + drivers/of/base.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -305,7 +305,7 @@ bool __weak arch_match_cpu_phys_id(int c + return (u32)phys_id == cpu; + } + +-/** ++/* + * Checks if the given "prop_name" property holds the physical id of the + * core/thread corresponding to the logical cpu 'cpu'. If 'thread' is not + * NULL, local thread number within the core is returned in it. +@@ -1128,7 +1128,7 @@ EXPORT_SYMBOL(of_match_node); + * will; typically, you pass what the previous call + * returned. of_node_put() will be called on it + * @matches: array of of device match structures to search in +- * @match Updated to point at the matches entry which matched ++ * @match: Updated to point at the matches entry which matched + * + * Returns a node pointer with refcount incremented, use + * of_node_put() on it when done. +@@ -1779,6 +1779,8 @@ EXPORT_SYMBOL(of_count_phandle_with_args + + /** + * __of_add_property - Add a property to a node without lock operations ++ * @np: Caller's Device Node ++ * @prob: Property to add + */ + int __of_add_property(struct device_node *np, struct property *prop) + { +@@ -1800,6 +1802,8 @@ int __of_add_property(struct device_node + + /** + * of_add_property - Add a property to a node ++ * @np: Caller's Device Node ++ * @prob: Property to add + */ + int of_add_property(struct device_node *np, struct property *prop) + { +@@ -1844,6 +1848,8 @@ int __of_remove_property(struct device_n + + /** + * of_remove_property - Remove a property from a node. ++ * @np: Caller's Device Node ++ * @prob: Property to remove + * + * Note that we don't actually remove it, since we have given out + * who-knows-how-many pointers to the data using get-property. +@@ -2130,9 +2136,9 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_i + + /** + * of_console_check() - Test and setup console for DT setup +- * @dn - Pointer to device node +- * @name - Name to use for preferred console without index. ex. "ttyS" +- * @index - Index to use for preferred console. ++ * @dn: Pointer to device node ++ * @name: Name to use for preferred console without index. ex. "ttyS" ++ * @index: Index to use for preferred console. + * + * Check if the given device node matches the stdout-path property in the + * /chosen node. If it does then register it as the preferred console and return diff --git a/target/linux/generic/backport-5.10/732-v5.13-0005-of-Fix-kerneldoc-output-formatting.patch b/target/linux/generic/backport-5.10/732-v5.13-0005-of-Fix-kerneldoc-output-formatting.patch new file mode 100644 index 00000000000..bda03b9c4c5 --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0005-of-Fix-kerneldoc-output-formatting.patch @@ -0,0 +1,489 @@ +From 62f026f082e4d762a47b43ea693b38f025122332 Mon Sep 17 00:00:00 2001 +From: Rob Herring +Date: Fri, 26 Mar 2021 13:26:06 -0600 +Subject: [PATCH] of: Fix kerneldoc output formatting + +The indentation of the kerneldoc comments affects the output formatting. +Leading tabs in particular don't work, sections need to be indented +under the section header, and several code blocks are reformatted. + +Cc: Frank Rowand +Cc: Mauro Carvalho Chehab +Signed-off-by: Rob Herring +Reviewed-by: Mauro Carvalho Chehab +Link: https://lore.kernel.org/r/20210326192606.3702739-1-robh@kernel.org +--- + drivers/of/base.c | 275 +++++++++++++++++++++++----------------------- + drivers/of/fdt.c | 9 +- + 2 files changed, 141 insertions(+), 143 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -651,11 +651,11 @@ bool of_device_is_big_endian(const struc + EXPORT_SYMBOL(of_device_is_big_endian); + + /** +- * of_get_parent - Get a node's parent if any +- * @node: Node to get parent ++ * of_get_parent - Get a node's parent if any ++ * @node: Node to get parent + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_get_parent(const struct device_node *node) + { +@@ -673,15 +673,15 @@ struct device_node *of_get_parent(const + EXPORT_SYMBOL(of_get_parent); + + /** +- * of_get_next_parent - Iterate to a node's parent +- * @node: Node to get parent of ++ * of_get_next_parent - Iterate to a node's parent ++ * @node: Node to get parent of + * +- * This is like of_get_parent() except that it drops the +- * refcount on the passed node, making it suitable for iterating +- * through a node's parents. ++ * This is like of_get_parent() except that it drops the ++ * refcount on the passed node, making it suitable for iterating ++ * through a node's parents. + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_get_next_parent(struct device_node *node) + { +@@ -719,13 +719,13 @@ static struct device_node *__of_get_next + child = __of_get_next_child(parent, child)) + + /** +- * of_get_next_child - Iterate a node childs +- * @node: parent node +- * @prev: previous child of the parent node, or NULL to get first +- * +- * Returns a node pointer with refcount incremented, use of_node_put() on +- * it when done. Returns NULL when prev is the last child. Decrements the +- * refcount of prev. ++ * of_get_next_child - Iterate a node childs ++ * @node: parent node ++ * @prev: previous child of the parent node, or NULL to get first ++ * ++ * Return: A node pointer with refcount incremented, use of_node_put() on ++ * it when done. Returns NULL when prev is the last child. Decrements the ++ * refcount of prev. + */ + struct device_node *of_get_next_child(const struct device_node *node, + struct device_node *prev) +@@ -741,12 +741,12 @@ struct device_node *of_get_next_child(co + EXPORT_SYMBOL(of_get_next_child); + + /** +- * of_get_next_available_child - Find the next available child node +- * @node: parent node +- * @prev: previous child of the parent node, or NULL to get first ++ * of_get_next_available_child - Find the next available child node ++ * @node: parent node ++ * @prev: previous child of the parent node, or NULL to get first + * +- * This function is like of_get_next_child(), except that it +- * automatically skips any disabled nodes (i.e. status = "disabled"). ++ * This function is like of_get_next_child(), except that it ++ * automatically skips any disabled nodes (i.e. status = "disabled"). + */ + struct device_node *of_get_next_available_child(const struct device_node *node, + struct device_node *prev) +@@ -772,12 +772,12 @@ struct device_node *of_get_next_availabl + EXPORT_SYMBOL(of_get_next_available_child); + + /** +- * of_get_next_cpu_node - Iterate on cpu nodes +- * @prev: previous child of the /cpus node, or NULL to get first ++ * of_get_next_cpu_node - Iterate on cpu nodes ++ * @prev: previous child of the /cpus node, or NULL to get first + * +- * Returns a cpu node pointer with refcount incremented, use of_node_put() +- * on it when done. Returns NULL when prev is the last child. Decrements +- * the refcount of prev. ++ * Return: A cpu node pointer with refcount incremented, use of_node_put() ++ * on it when done. Returns NULL when prev is the last child. Decrements ++ * the refcount of prev. + */ + struct device_node *of_get_next_cpu_node(struct device_node *prev) + { +@@ -834,15 +834,15 @@ struct device_node *of_get_compatible_ch + EXPORT_SYMBOL(of_get_compatible_child); + + /** +- * of_get_child_by_name - Find the child node by name for a given parent +- * @node: parent node +- * @name: child name to look for. +- * +- * This function looks for child node for given matching name +- * +- * Returns a node pointer if found, with refcount incremented, use +- * of_node_put() on it when done. +- * Returns NULL if node is not found. ++ * of_get_child_by_name - Find the child node by name for a given parent ++ * @node: parent node ++ * @name: child name to look for. ++ * ++ * This function looks for child node for given matching name ++ * ++ * Return: A node pointer if found, with refcount incremented, use ++ * of_node_put() on it when done. ++ * Returns NULL if node is not found. + */ + struct device_node *of_get_child_by_name(const struct device_node *node, + const char *name) +@@ -893,22 +893,22 @@ struct device_node *__of_find_node_by_fu + } + + /** +- * of_find_node_opts_by_path - Find a node matching a full OF path +- * @path: Either the full path to match, or if the path does not +- * start with '/', the name of a property of the /aliases +- * node (an alias). In the case of an alias, the node +- * matching the alias' value will be returned. +- * @opts: Address of a pointer into which to store the start of +- * an options string appended to the end of the path with +- * a ':' separator. +- * +- * Valid paths: +- * /foo/bar Full path +- * foo Valid alias +- * foo/bar Valid alias + relative path ++ * of_find_node_opts_by_path - Find a node matching a full OF path ++ * @path: Either the full path to match, or if the path does not ++ * start with '/', the name of a property of the /aliases ++ * node (an alias). In the case of an alias, the node ++ * matching the alias' value will be returned. ++ * @opts: Address of a pointer into which to store the start of ++ * an options string appended to the end of the path with ++ * a ':' separator. ++ * ++ * Valid paths: ++ * * /foo/bar Full path ++ * * foo Valid alias ++ * * foo/bar Valid alias + relative path + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_opts_by_path(const char *path, const char **opts) + { +@@ -958,15 +958,15 @@ struct device_node *of_find_node_opts_by + EXPORT_SYMBOL(of_find_node_opts_by_path); + + /** +- * of_find_node_by_name - Find a node by its "name" property +- * @from: The node to start searching from or NULL; the node ++ * of_find_node_by_name - Find a node by its "name" property ++ * @from: The node to start searching from or NULL; the node + * you pass will not be searched, only the next one + * will. Typically, you pass what the previous call + * returned. of_node_put() will be called on @from. +- * @name: The name string to match against ++ * @name: The name string to match against + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_by_name(struct device_node *from, + const char *name) +@@ -985,16 +985,16 @@ struct device_node *of_find_node_by_name + EXPORT_SYMBOL(of_find_node_by_name); + + /** +- * of_find_node_by_type - Find a node by its "device_type" property +- * @from: The node to start searching from, or NULL to start searching ++ * of_find_node_by_type - Find a node by its "device_type" property ++ * @from: The node to start searching from, or NULL to start searching + * the entire device tree. The node you pass will not be + * searched, only the next one will; typically, you pass + * what the previous call returned. of_node_put() will be + * called on from for you. +- * @type: The type string to match against ++ * @type: The type string to match against + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_by_type(struct device_node *from, + const char *type) +@@ -1013,18 +1013,18 @@ struct device_node *of_find_node_by_type + EXPORT_SYMBOL(of_find_node_by_type); + + /** +- * of_find_compatible_node - Find a node based on type and one of the ++ * of_find_compatible_node - Find a node based on type and one of the + * tokens in its "compatible" property +- * @from: The node to start searching from or NULL, the node +- * you pass will not be searched, only the next one +- * will; typically, you pass what the previous call +- * returned. of_node_put() will be called on it +- * @type: The type string to match "device_type" or NULL to ignore +- * @compatible: The string to match to one of the tokens in the device +- * "compatible" list. ++ * @from: The node to start searching from or NULL, the node ++ * you pass will not be searched, only the next one ++ * will; typically, you pass what the previous call ++ * returned. of_node_put() will be called on it ++ * @type: The type string to match "device_type" or NULL to ignore ++ * @compatible: The string to match to one of the tokens in the device ++ * "compatible" list. + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_compatible_node(struct device_node *from, + const char *type, const char *compatible) +@@ -1044,16 +1044,16 @@ struct device_node *of_find_compatible_n + EXPORT_SYMBOL(of_find_compatible_node); + + /** +- * of_find_node_with_property - Find a node which has a property with +- * the given name. +- * @from: The node to start searching from or NULL, the node +- * you pass will not be searched, only the next one +- * will; typically, you pass what the previous call +- * returned. of_node_put() will be called on it +- * @prop_name: The name of the property to look for. ++ * of_find_node_with_property - Find a node which has a property with ++ * the given name. ++ * @from: The node to start searching from or NULL, the node ++ * you pass will not be searched, only the next one ++ * will; typically, you pass what the previous call ++ * returned. of_node_put() will be called on it ++ * @prop_name: The name of the property to look for. + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_with_property(struct device_node *from, + const char *prop_name) +@@ -1102,10 +1102,10 @@ const struct of_device_id *__of_match_no + + /** + * of_match_node - Tell if a device_node has a matching of_match structure +- * @matches: array of of device match structures to search in +- * @node: the of device structure to match against ++ * @matches: array of of device match structures to search in ++ * @node: the of device structure to match against + * +- * Low level utility function used by device matching. ++ * Low level utility function used by device matching. + */ + const struct of_device_id *of_match_node(const struct of_device_id *matches, + const struct device_node *node) +@@ -1121,17 +1121,17 @@ const struct of_device_id *of_match_node + EXPORT_SYMBOL(of_match_node); + + /** +- * of_find_matching_node_and_match - Find a node based on an of_device_id +- * match table. +- * @from: The node to start searching from or NULL, the node +- * you pass will not be searched, only the next one +- * will; typically, you pass what the previous call +- * returned. of_node_put() will be called on it +- * @matches: array of of device match structures to search in +- * @match: Updated to point at the matches entry which matched ++ * of_find_matching_node_and_match - Find a node based on an of_device_id ++ * match table. ++ * @from: The node to start searching from or NULL, the node ++ * you pass will not be searched, only the next one ++ * will; typically, you pass what the previous call ++ * returned. of_node_put() will be called on it ++ * @matches: array of of device match structures to search in ++ * @match: Updated to point at the matches entry which matched + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_matching_node_and_match(struct device_node *from, + const struct of_device_id *matches, +@@ -1465,21 +1465,21 @@ EXPORT_SYMBOL(of_parse_phandle); + * Caller is responsible to call of_node_put() on the returned out_args->np + * pointer. + * +- * Example: ++ * Example:: + * +- * phandle1: node1 { ++ * phandle1: node1 { + * #list-cells = <2>; +- * } ++ * }; + * +- * phandle2: node2 { ++ * phandle2: node2 { + * #list-cells = <1>; +- * } ++ * }; + * +- * node3 { ++ * node3 { + * list = <&phandle1 1 2 &phandle2 3>; +- * } ++ * }; + * +- * To get a device_node of the `node2' node you may call this: ++ * To get a device_node of the ``node2`` node you may call this: + * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); + */ + int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, +@@ -1517,29 +1517,29 @@ EXPORT_SYMBOL(of_parse_phandle_with_args + * Caller is responsible to call of_node_put() on the returned out_args->np + * pointer. + * +- * Example: +- * +- * phandle1: node1 { +- * #list-cells = <2>; +- * } +- * +- * phandle2: node2 { +- * #list-cells = <1>; +- * } ++ * Example:: + * +- * phandle3: node3 { +- * #list-cells = <1>; +- * list-map = <0 &phandle2 3>, +- * <1 &phandle2 2>, +- * <2 &phandle1 5 1>; +- * list-map-mask = <0x3>; +- * }; +- * +- * node4 { +- * list = <&phandle1 1 2 &phandle3 0>; +- * } ++ * phandle1: node1 { ++ * #list-cells = <2>; ++ * }; ++ * ++ * phandle2: node2 { ++ * #list-cells = <1>; ++ * }; ++ * ++ * phandle3: node3 { ++ * #list-cells = <1>; ++ * list-map = <0 &phandle2 3>, ++ * <1 &phandle2 2>, ++ * <2 &phandle1 5 1>; ++ * list-map-mask = <0x3>; ++ * }; ++ * ++ * node4 { ++ * list = <&phandle1 1 2 &phandle3 0>; ++ * }; + * +- * To get a device_node of the `node2' node you may call this: ++ * To get a device_node of the ``node2`` node you may call this: + * of_parse_phandle_with_args(node4, "list", "list", 1, &args); + */ + int of_parse_phandle_with_args_map(const struct device_node *np, +@@ -1699,19 +1699,19 @@ EXPORT_SYMBOL(of_parse_phandle_with_args + * Caller is responsible to call of_node_put() on the returned out_args->np + * pointer. + * +- * Example: ++ * Example:: + * +- * phandle1: node1 { +- * } ++ * phandle1: node1 { ++ * }; + * +- * phandle2: node2 { +- * } ++ * phandle2: node2 { ++ * }; + * +- * node3 { +- * list = <&phandle1 0 2 &phandle2 2 3>; +- * } ++ * node3 { ++ * list = <&phandle1 0 2 &phandle2 2 3>; ++ * }; + * +- * To get a device_node of the `node2' node you may call this: ++ * To get a device_node of the ``node2`` node you may call this: + * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); + */ + int of_parse_phandle_with_fixed_args(const struct device_node *np, +@@ -1957,13 +1957,12 @@ static void of_alias_add(struct alias_pr + + /** + * of_alias_scan - Scan all properties of the 'aliases' node ++ * @dt_alloc: An allocator that provides a virtual address to memory ++ * for storing the resulting tree + * + * The function scans all the properties of the 'aliases' node and populates + * the global lookup table with the properties. It returns the + * number of alias properties found, or an error code in case of failure. +- * +- * @dt_alloc: An allocator that provides a virtual address to memory +- * for storing the resulting tree + */ + void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) + { +@@ -2158,12 +2157,12 @@ bool of_console_check(struct device_node + EXPORT_SYMBOL_GPL(of_console_check); + + /** +- * of_find_next_cache_node - Find a node's subsidiary cache +- * @np: node of type "cpu" or "cache" ++ * of_find_next_cache_node - Find a node's subsidiary cache ++ * @np: node of type "cpu" or "cache" + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. Caller should hold a reference +- * to np. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. Caller should hold a reference ++ * to np. + */ + struct device_node *of_find_next_cache_node(const struct device_node *np) + { +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -349,11 +349,6 @@ static int unflatten_dt_nodes(const void + + /** + * __unflatten_device_tree - create tree of device_nodes from flat blob +- * +- * unflattens a device-tree, creating the +- * tree of struct device_node. It also fills the "name" and "type" +- * pointers of the nodes so the normal device-tree walking functions +- * can be used. + * @blob: The blob to expand + * @dad: Parent device node + * @mynodes: The device_node tree created by the call +@@ -361,6 +356,10 @@ static int unflatten_dt_nodes(const void + * for the resulting tree + * @detached: if true set OF_DETACHED on @mynodes + * ++ * unflattens a device-tree, creating the tree of struct device_node. It also ++ * fills the "name" and "type" pointers of the nodes so the normal device-tree ++ * walking functions can be used. ++ * + * Returns NULL on failure or the memory chunk containing the unflattened + * device tree on success. + */ diff --git a/target/linux/generic/backport-5.10/732-v5.13-0006-of-Add-missing-Return-section-in-kerneldoc-comments.patch b/target/linux/generic/backport-5.10/732-v5.13-0006-of-Add-missing-Return-section-in-kerneldoc-comments.patch new file mode 100644 index 00000000000..9c99ccb1dbb --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0006-of-Add-missing-Return-section-in-kerneldoc-comments.patch @@ -0,0 +1,787 @@ +From 8c8239c2c1fb82f171cb22a707f3bb88a2f22109 Mon Sep 17 00:00:00 2001 +From: Rob Herring +Date: Thu, 25 Mar 2021 10:47:12 -0600 +Subject: [PATCH] of: Add missing 'Return' section in kerneldoc comments + +Many of the DT kerneldoc comments are lacking a 'Return' section. Let's +add the section in cases we have a description of return values. There's +still some cases where the return values are not documented. + +Cc: Frank Rowand +Cc: Mauro Carvalho Chehab +Signed-off-by: Rob Herring +Reviewed-by: Mauro Carvalho Chehab +Link: https://lore.kernel.org/r/20210325164713.1296407-8-robh@kernel.org +--- + drivers/of/base.c | 39 +++++++++++++------------ + drivers/of/dynamic.c | 19 ++++++++----- + drivers/of/fdt.c | 8 +++--- + drivers/of/irq.c | 14 ++++----- + drivers/of/overlay.c | 16 +++++------ + drivers/of/platform.c | 10 +++---- + drivers/of/property.c | 66 +++++++++++++++++++++++++++---------------- + include/linux/of.h | 63 ++++++++++++++++++++++++++--------------- + 8 files changed, 140 insertions(+), 95 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -244,7 +244,7 @@ struct device_node *__of_find_all_nodes( + * @prev: Previous node or NULL to start iteration + * of_node_put() will be called on it + * +- * Returns a node pointer with refcount incremented, use ++ * Return: A node pointer with refcount incremented, use + * of_node_put() on it when done. + */ + struct device_node *of_find_all_nodes(struct device_node *prev) +@@ -374,7 +374,7 @@ bool __weak arch_find_n_match_cpu_physic + * before booting secondary cores. This function uses arch_match_cpu_phys_id + * which can be overridden by architecture specific implementation. + * +- * Returns a node pointer for the logical cpu with refcount incremented, use ++ * Return: A node pointer for the logical cpu with refcount incremented, use + * of_node_put() on it when done. Returns NULL if not found. + */ + struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) +@@ -394,8 +394,8 @@ EXPORT_SYMBOL(of_get_cpu_node); + * + * @cpu_node: Pointer to the device_node for CPU. + * +- * Returns the logical CPU number of the given CPU device_node. +- * Returns -ENODEV if the CPU is not found. ++ * Return: The logical CPU number of the given CPU device_node or -ENODEV if the ++ * CPU is not found. + */ + int of_cpu_node_to_id(struct device_node *cpu_node) + { +@@ -427,7 +427,7 @@ EXPORT_SYMBOL(of_cpu_node_to_id); + * bindings. This function check for both and returns the idle state node for + * the requested index. + * +- * In case an idle state node is found at @index, the refcount is incremented ++ * Return: An idle state node if found at @index. The refcount is incremented + * for it, so call of_node_put() on it when done. Returns NULL if not found. + */ + struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, +@@ -561,7 +561,7 @@ int of_device_compatible_match(struct de + * of_machine_is_compatible - Test root of device tree for a given compatible value + * @compat: compatible string to look for in root node's compatible property. + * +- * Returns a positive integer if the root node has the given value in its ++ * Return: A positive integer if the root node has the given value in its + * compatible property. + */ + int of_machine_is_compatible(const char *compat) +@@ -583,7 +583,7 @@ EXPORT_SYMBOL(of_machine_is_compatible); + * + * @device: Node to check for availability, with locks already held + * +- * Returns true if the status property is absent or set to "okay" or "ok", ++ * Return: True if the status property is absent or set to "okay" or "ok", + * false otherwise + */ + static bool __of_device_is_available(const struct device_node *device) +@@ -611,7 +611,7 @@ static bool __of_device_is_available(con + * + * @device: Node to check for availability + * +- * Returns true if the status property is absent or set to "okay" or "ok", ++ * Return: True if the status property is absent or set to "okay" or "ok", + * false otherwise + */ + bool of_device_is_available(const struct device_node *device) +@@ -632,7 +632,7 @@ EXPORT_SYMBOL(of_device_is_available); + * + * @device: Node to check for endianness + * +- * Returns true if the device has a "big-endian" property, or if the kernel ++ * Return: True if the device has a "big-endian" property, or if the kernel + * was compiled for BE *and* the device has a "native-endian" property. + * Returns false otherwise. + * +@@ -816,7 +816,7 @@ EXPORT_SYMBOL(of_get_next_cpu_node); + * Lookup child node whose compatible property contains the given compatible + * string. + * +- * Returns a node pointer with refcount incremented, use of_node_put() on it ++ * Return: a node pointer with refcount incremented, use of_node_put() on it + * when done; or NULL if not found. + */ + struct device_node *of_get_compatible_child(const struct device_node *parent, +@@ -1170,7 +1170,7 @@ EXPORT_SYMBOL(of_find_matching_node_and_ + * It does this by stripping the manufacturer prefix (as delimited by a ',') + * from the first entry in the compatible list property. + * +- * This routine returns 0 on success, <0 on failure. ++ * Return: This routine returns 0 on success, <0 on failure. + */ + int of_modalias_node(struct device_node *node, char *modalias, int len) + { +@@ -1190,7 +1190,7 @@ EXPORT_SYMBOL_GPL(of_modalias_node); + * of_find_node_by_phandle - Find a node given a phandle + * @handle: phandle of the node to find + * +- * Returns a node pointer with refcount incremented, use ++ * Return: A node pointer with refcount incremented, use + * of_node_put() on it when done. + */ + struct device_node *of_find_node_by_phandle(phandle handle) +@@ -1431,7 +1431,7 @@ static int __of_parse_phandle_with_args( + * @index: For properties holding a table of phandles, this is the index into + * the table + * +- * Returns the device_node pointer with refcount incremented. Use ++ * Return: The device_node pointer with refcount incremented. Use + * of_node_put() on it when done. + */ + struct device_node *of_parse_phandle(const struct device_node *np, +@@ -1731,7 +1731,7 @@ EXPORT_SYMBOL(of_parse_phandle_with_fixe + * @list_name: property name that contains a list + * @cells_name: property name that specifies phandles' arguments count + * +- * Returns the number of phandle + argument tuples within a property. It ++ * Return: The number of phandle + argument tuples within a property. It + * is a typical pattern to encode a list of phandle and variable + * arguments into a single property. The number of arguments is encoded + * by a property in the phandle-target node. For example, a gpios +@@ -2031,7 +2031,9 @@ void of_alias_scan(void * (*dt_alloc)(u6 + * @stem: Alias stem of the given device_node + * + * The function travels the lookup table to get the alias id for the given +- * device_node and alias stem. It returns the alias id if found. ++ * device_node and alias stem. ++ * ++ * Return: The alias id if found. + */ + int of_alias_get_id(struct device_node *np, const char *stem) + { +@@ -2140,8 +2142,9 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_i + * @index: Index to use for preferred console. + * + * Check if the given device node matches the stdout-path property in the +- * /chosen node. If it does then register it as the preferred console and return +- * TRUE. Otherwise return FALSE. ++ * /chosen node. If it does then register it as the preferred console. ++ * ++ * Return: TRUE if console successfully setup. Otherwise return FALSE. + */ + bool of_console_check(struct device_node *dn, char *name, int index) + { +@@ -2192,7 +2195,7 @@ struct device_node *of_find_next_cache_n + * + * @cpu: cpu number(logical index) for which the last cache level is needed + * +- * Returns the the level at which the last cache is present. It is exactly ++ * Return: The the level at which the last cache is present. It is exactly + * same as the total number of cache levels for the given logical cpu. + */ + int of_find_last_cache_level(unsigned int cpu) +--- a/drivers/of/dynamic.c ++++ b/drivers/of/dynamic.c +@@ -27,7 +27,7 @@ static struct device_node *kobj_to_devic + * @node: Node to inc refcount, NULL is supported to simplify writing of + * callers + * +- * Returns node. ++ * Return: The node with refcount incremented. + */ + struct device_node *of_node_get(struct device_node *node) + { +@@ -104,7 +104,8 @@ int of_reconfig_notify(unsigned long act + * @arg - argument of the of notifier + * + * Returns the new state of a device based on the notifier used. +- * Returns 0 on device going from enabled to disabled, 1 on device ++ * ++ * Return: 0 on device going from enabled to disabled, 1 on device + * going from disabled to enabled and -1 on no change. + */ + int of_reconfig_get_state_change(unsigned long action, struct of_reconfig_data *pr) +@@ -371,7 +372,8 @@ void of_node_release(struct kobject *kob + * property structure and the property name & contents. The property's + * flags have the OF_DYNAMIC bit set so that we can differentiate between + * dynamically allocated properties and not. +- * Returns the newly allocated property or NULL on out of memory error. ++ * ++ * Return: The newly allocated property or NULL on out of memory error. + */ + struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) + { +@@ -414,7 +416,7 @@ struct property *__of_prop_dup(const str + * another node. The node data are dynamically allocated and all the node + * flags have the OF_DYNAMIC & OF_DETACHED bits set. + * +- * Returns the newly allocated node or NULL on out of memory error. ++ * Return: The newly allocated node or NULL on out of memory error. + */ + struct device_node *__of_node_dup(const struct device_node *np, + const char *full_name) +@@ -780,7 +782,8 @@ static int __of_changeset_apply(struct o + * Any side-effects of live tree state changes are applied here on + * success, like creation/destruction of devices and side-effects + * like creation of sysfs properties and directories. +- * Returns 0 on success, a negative error value in case of an error. ++ * ++ * Return: 0 on success, a negative error value in case of an error. + * On error the partially applied effects are reverted. + */ + int of_changeset_apply(struct of_changeset *ocs) +@@ -874,7 +877,8 @@ static int __of_changeset_revert(struct + * was before the application. + * Any side-effects like creation/destruction of devices and + * removal of sysfs properties and directories are applied. +- * Returns 0 on success, a negative error value in case of an error. ++ * ++ * Return: 0 on success, a negative error value in case of an error. + */ + int of_changeset_revert(struct of_changeset *ocs) + { +@@ -902,7 +906,8 @@ EXPORT_SYMBOL_GPL(of_changeset_revert); + * + OF_RECONFIG_ADD_PROPERTY + * + OF_RECONFIG_REMOVE_PROPERTY, + * + OF_RECONFIG_UPDATE_PROPERTY +- * Returns 0 on success, a negative error value in case of an error. ++ * ++ * Return: 0 on success, a negative error value in case of an error. + */ + int of_changeset_action(struct of_changeset *ocs, unsigned long action, + struct device_node *np, struct property *prop) +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -282,7 +282,7 @@ static void reverse_nodes(struct device_ + * @dad: Parent struct device_node + * @nodepp: The device_node tree created by the call + * +- * It returns the size of unflattened device tree or error code ++ * Return: The size of unflattened device tree or error code + */ + static int unflatten_dt_nodes(const void *blob, + void *mem, +@@ -360,7 +360,7 @@ static int unflatten_dt_nodes(const void + * fills the "name" and "type" pointers of the nodes so the normal device-tree + * walking functions can be used. + * +- * Returns NULL on failure or the memory chunk containing the unflattened ++ * Return: NULL on failure or the memory chunk containing the unflattened + * device tree on success. + */ + void *__unflatten_device_tree(const void *blob, +@@ -441,7 +441,7 @@ static DEFINE_MUTEX(of_fdt_unflatten_mut + * pointers of the nodes so the normal device-tree walking functions + * can be used. + * +- * Returns NULL on failure or the memory chunk containing the unflattened ++ * Return: NULL on failure or the memory chunk containing the unflattened + * device tree on success. + */ + void *of_fdt_unflatten_tree(const unsigned long *blob, +@@ -715,7 +715,7 @@ const void *__init of_get_flat_dt_prop(u + * @node: node to test + * @compat: compatible string to compare with compatible list. + * +- * On match, returns a non-zero value with smaller values returned for more ++ * Return: a non-zero value on match with smaller values returned for more + * specific compatible values. + */ + static int of_fdt_is_compatible(const void *blob, +--- a/drivers/of/irq.c ++++ b/drivers/of/irq.c +@@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); + * of_irq_find_parent - Given a device node, find its interrupt parent node + * @child: pointer to device node + * +- * Returns a pointer to the interrupt parent node, or NULL if the interrupt ++ * Return: A pointer to the interrupt parent node, or NULL if the interrupt + * parent could not be determined. + */ + struct device_node *of_irq_find_parent(struct device_node *child) +@@ -81,14 +81,14 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); + * @addr: address specifier (start of "reg" property of the device) in be32 format + * @out_irq: structure of_phandle_args updated by this function + * +- * Returns 0 on success and a negative number on error +- * + * This function is a low-level interrupt tree walking function. It + * can be used to do a partial walk with synthetized reg and interrupts + * properties, for example when resolving PCI interrupts when no device + * node exist for the parent. It takes an interrupt specifier structure as + * input, walks the tree looking for any interrupt-map properties, translates + * the specifier for each map, and then returns the translated map. ++ * ++ * Return: 0 on success and a negative number on error + */ + int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) + { +@@ -380,7 +380,7 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource); + * @dev: pointer to device tree node + * @index: zero-based index of the IRQ + * +- * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or ++ * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or + * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case + * of any other failure. + */ +@@ -407,7 +407,7 @@ EXPORT_SYMBOL_GPL(of_irq_get); + * @dev: pointer to device tree node + * @name: IRQ name + * +- * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or ++ * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or + * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case + * of any other failure. + */ +@@ -447,7 +447,7 @@ int of_irq_count(struct device_node *dev + * @res: array of resources to fill in + * @nr_irqs: the number of IRQs (and upper bound for num of @res elements) + * +- * Returns the size of the filled in table (up to @nr_irqs). ++ * Return: The size of the filled in table (up to @nr_irqs). + */ + int of_irq_to_resource_table(struct device_node *dev, struct resource *res, + int nr_irqs) +@@ -602,7 +602,7 @@ static u32 __of_msi_map_id(struct device + * Walk up the device hierarchy looking for devices with a "msi-map" + * property. If found, apply the mapping to @id_in. + * +- * Returns the mapped MSI ID. ++ * Return: The mapped MSI ID. + */ + u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in) + { +--- a/drivers/of/overlay.c ++++ b/drivers/of/overlay.c +@@ -296,7 +296,7 @@ err_free_target_path: + * + * Update of property in symbols node is not allowed. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid @overlay. + */ + static int add_changeset_property(struct overlay_changeset *ovcs, +@@ -401,7 +401,7 @@ static int add_changeset_property(struct + * + * NOTE_2: Multiple mods of created nodes not supported. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid @overlay. + */ + static int add_changeset_node(struct overlay_changeset *ovcs, +@@ -473,7 +473,7 @@ static int add_changeset_node(struct ove + * + * Do not allow symbols node to have any children. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid @overlay_node. + */ + static int build_changeset_next_level(struct overlay_changeset *ovcs, +@@ -604,7 +604,7 @@ static int find_dup_cset_prop(struct ove + * the same node or duplicate {add, delete, or update} properties entries + * for the same property. + * +- * Returns 0 on success, or -EINVAL if duplicate changeset entry found. ++ * Return: 0 on success, or -EINVAL if duplicate changeset entry found. + */ + static int changeset_dup_entry_check(struct overlay_changeset *ovcs) + { +@@ -628,7 +628,7 @@ static int changeset_dup_entry_check(str + * any portions of the changeset that were successfully created will remain + * in @ovcs->cset. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid overlay in @ovcs->fragments[]. + */ + static int build_changeset(struct overlay_changeset *ovcs) +@@ -724,7 +724,7 @@ static struct device_node *find_target(s + * the top level of @tree. The relevant top level nodes are the fragment + * nodes and the __symbols__ node. Any other top level node will be ignored. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error ++ * Return: 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error + * detected in @tree, or -ENOSPC if idr_alloc() error. + */ + static int init_overlay_changeset(struct overlay_changeset *ovcs, +@@ -1179,7 +1179,7 @@ static int overlay_removal_is_ok(struct + * If an error is returned by an overlay changeset post-remove notifier + * then no further overlay changeset post-remove notifier will be called. + * +- * Returns 0 on success, or a negative error number. *ovcs_id is set to ++ * Return: 0 on success, or a negative error number. *ovcs_id is set to + * zero after reverting the changeset, even if a subsequent error occurs. + */ + int of_overlay_remove(int *ovcs_id) +@@ -1257,7 +1257,7 @@ EXPORT_SYMBOL_GPL(of_overlay_remove); + * + * Removes all overlays from the system in the correct order. + * +- * Returns 0 on success, or a negative error number ++ * Return: 0 on success, or a negative error number + */ + int of_overlay_remove_all(void) + { +--- a/drivers/of/platform.c ++++ b/drivers/of/platform.c +@@ -44,7 +44,7 @@ static const struct of_device_id of_skip + * Takes a reference to the embedded struct device which needs to be dropped + * after use. + * +- * Returns platform_device pointer, or NULL if not found ++ * Return: platform_device pointer, or NULL if not found + */ + struct platform_device *of_find_device_by_node(struct device_node *np) + { +@@ -160,7 +160,7 @@ EXPORT_SYMBOL(of_device_alloc); + * @platform_data: pointer to populate platform_data pointer with + * @parent: Linux device model parent device. + * +- * Returns pointer to created platform device, or NULL if a device was not ++ * Return: Pointer to created platform device, or NULL if a device was not + * registered. Unavailable devices will not get registered. + */ + static struct platform_device *of_platform_device_create_pdata( +@@ -204,7 +204,7 @@ err_clear_flag: + * @bus_id: name to assign device + * @parent: Linux device model parent device. + * +- * Returns pointer to created platform device, or NULL if a device was not ++ * Return: Pointer to created platform device, or NULL if a device was not + * registered. Unavailable devices will not get registered. + */ + struct platform_device *of_platform_device_create(struct device_node *np, +@@ -463,7 +463,7 @@ EXPORT_SYMBOL(of_platform_bus_probe); + * New board support should be using this function instead of + * of_platform_bus_probe(). + * +- * Returns 0 on success, < 0 on failure. ++ * Return: 0 on success, < 0 on failure. + */ + int of_platform_populate(struct device_node *root, + const struct of_device_id *matches, +@@ -608,7 +608,7 @@ static void devm_of_platform_populate_re + * Similar to of_platform_populate(), but will automatically call + * of_platform_depopulate() when the device is unbound from the bus. + * +- * Returns 0 on success, < 0 on failure. ++ * Return: 0 on success, < 0 on failure. + */ + int devm_of_platform_populate(struct device *dev) + { +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -60,9 +60,11 @@ EXPORT_SYMBOL(of_graph_is_present); + * @elem_size: size of the individual element + * + * Search for a property in a device node and count the number of elements of +- * size elem_size in it. Returns number of elements on sucess, -EINVAL if the +- * property does not exist or its length does not match a multiple of elem_size +- * and -ENODATA if the property does not have a value. ++ * size elem_size in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does not ++ * exist or its length does not match a multiple of elem_size and -ENODATA if ++ * the property does not have a value. + */ + int of_property_count_elems_of_size(const struct device_node *np, + const char *propname, int elem_size) +@@ -94,8 +96,9 @@ EXPORT_SYMBOL_GPL(of_property_count_elem + * @len: if !=NULL, actual length is written to here + * + * Search for a property in a device node and valid the requested size. +- * Returns the property value on success, -EINVAL if the property does not +- * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the ++ * ++ * Return: The property value on success, -EINVAL if the property does not ++ * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data is too small or too large. + * + */ +@@ -128,7 +131,9 @@ static void *of_find_property_value_of_s + * @out_value: pointer to return value, modified only if no error. + * + * Search for a property in a device node and read nth 32-bit value from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -160,7 +165,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_i + * @out_value: pointer to return value, modified only if no error. + * + * Search for a property in a device node and read nth 64-bit value from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -195,12 +202,14 @@ EXPORT_SYMBOL_GPL(of_property_read_u64_i + * sz_min will be read. + * + * Search for a property in a device node and read 8-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property +- * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW +- * if the property data is smaller than sz_min or longer than sz_max. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 8 <0x50 0x60 0x70>; ++ * ``property = /bits/ 8 <0x50 0x60 0x70>;`` ++ * ++ * Return: The number of elements read on success, -EINVAL if the property ++ * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW ++ * if the property data is smaller than sz_min or longer than sz_max. + * + * The out_values is modified only if a valid u8 value can be decoded. + */ +@@ -243,12 +252,14 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * sz_min will be read. + * + * Search for a property in a device node and read 16-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property +- * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW +- * if the property data is smaller than sz_min or longer than sz_max. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 16 <0x5000 0x6000 0x7000>; ++ * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;`` ++ * ++ * Return: The number of elements read on success, -EINVAL if the property ++ * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW ++ * if the property data is smaller than sz_min or longer than sz_max. + * + * The out_values is modified only if a valid u16 value can be decoded. + */ +@@ -291,7 +302,9 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * sz_min will be read. + * + * Search for a property in a device node and read 32-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property ++ * it. ++ * ++ * Return: The number of elements read on success, -EINVAL if the property + * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW + * if the property data is smaller than sz_min or longer than sz_max. + * +@@ -330,7 +343,9 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * @out_value: pointer to return value, modified only if return value is 0. + * + * Search for a property in a device node and read a 64-bit value from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -365,7 +380,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u64); + * sz_min will be read. + * + * Search for a property in a device node and read 64-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property ++ * it. ++ * ++ * Return: The number of elements read on success, -EINVAL if the property + * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW + * if the property data is smaller than sz_min or longer than sz_max. + * +@@ -407,10 +424,11 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * return value is 0. + * + * Search for a property in a device tree node and retrieve a null +- * terminated string value (pointer to data, not a copy). Returns 0 on +- * success, -EINVAL if the property does not exist, -ENODATA if property +- * does not have a value, and -EILSEQ if the string is not null-terminated +- * within the length of the property data. ++ * terminated string value (pointer to data, not a copy). ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if ++ * property does not have a value, and -EILSEQ if the string is not ++ * null-terminated within the length of the property data. + * + * The out_string pointer is modified only if a valid string can be decoded. + */ +@@ -774,7 +792,7 @@ EXPORT_SYMBOL(of_graph_get_remote_port_p + * @node: pointer to a local endpoint device_node + * + * Return: Remote port node associated with remote endpoint node linked +- * to @node. Use of_node_put() on it when done. ++ * to @node. Use of_node_put() on it when done. + */ + struct device_node *of_graph_get_remote_port(const struct device_node *node) + { +@@ -807,7 +825,7 @@ EXPORT_SYMBOL(of_graph_get_endpoint_coun + * @endpoint: identifier (value of reg property) of the endpoint node + * + * Return: Remote device node associated with remote endpoint node linked +- * to @node. Use of_node_put() on it when done. ++ * to @node. Use of_node_put() on it when done. + */ + struct device_node *of_graph_get_remote_node(const struct device_node *node, + u32 port, u32 endpoint) +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -424,12 +424,14 @@ extern int of_detach_node(struct device_ + * @sz: number of array elements to read + * + * Search for a property in a device node and read 8-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, +- * -ENODATA if property does not have a value, and -EOVERFLOW if the +- * property data isn't large enough. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 8 <0x50 0x60 0x70>; ++ * ``property = /bits/ 8 <0x50 0x60 0x70>;`` ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, ++ * -ENODATA if property does not have a value, and -EOVERFLOW if the ++ * property data isn't large enough. + * + * The out_values is modified only if a valid u8 value can be decoded. + */ +@@ -454,12 +456,14 @@ static inline int of_property_read_u8_ar + * @sz: number of array elements to read + * + * Search for a property in a device node and read 16-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, +- * -ENODATA if property does not have a value, and -EOVERFLOW if the +- * property data isn't large enough. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 16 <0x5000 0x6000 0x7000>; ++ * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;`` ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, ++ * -ENODATA if property does not have a value, and -EOVERFLOW if the ++ * property data isn't large enough. + * + * The out_values is modified only if a valid u16 value can be decoded. + */ +@@ -485,7 +489,9 @@ static inline int of_property_read_u16_a + * @sz: number of array elements to read + * + * Search for a property in a device node and read 32-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -513,7 +519,9 @@ static inline int of_property_read_u32_a + * @sz: number of array elements to read + * + * Search for a property in a device node and read 64-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -1063,7 +1071,9 @@ static inline bool of_node_is_type(const + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u8 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u8 and -ENODATA if the + * property does not have a value. + */ +@@ -1080,7 +1090,9 @@ static inline int of_property_count_u8_e + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u16 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u16 and -ENODATA if the + * property does not have a value. + */ +@@ -1097,7 +1109,9 @@ static inline int of_property_count_u16_ + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u32 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u32 and -ENODATA if the + * property does not have a value. + */ +@@ -1114,7 +1128,9 @@ static inline int of_property_count_u32_ + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u64 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u64 and -ENODATA if the + * property does not have a value. + */ +@@ -1135,7 +1151,7 @@ static inline int of_property_count_u64_ + * Search for a property in a device tree node and retrieve a list of + * terminated string values (pointer to data, not a copy) in that property. + * +- * If @out_strs is NULL, the number of strings in the property is returned. ++ * Return: If @out_strs is NULL, the number of strings in the property is returned. + */ + static inline int of_property_read_string_array(const struct device_node *np, + const char *propname, const char **out_strs, +@@ -1151,10 +1167,11 @@ static inline int of_property_read_strin + * @propname: name of the property to be searched. + * + * Search for a property in a device tree node and retrieve the number of null +- * terminated string contain in it. Returns the number of strings on +- * success, -EINVAL if the property does not exist, -ENODATA if property +- * does not have a value, and -EILSEQ if the string is not null-terminated +- * within the length of the property data. ++ * terminated string contain in it. ++ * ++ * Return: The number of strings on success, -EINVAL if the property does not ++ * exist, -ENODATA if property does not have a value, and -EILSEQ if the string ++ * is not null-terminated within the length of the property data. + */ + static inline int of_property_count_strings(const struct device_node *np, + const char *propname) +@@ -1174,7 +1191,8 @@ static inline int of_property_count_stri + * Search for a property in a device tree node and retrieve a null + * terminated string value (pointer to data, not a copy) in the list of strings + * contained in that property. +- * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if + * property does not have a value, and -EILSEQ if the string is not + * null-terminated within the length of the property data. + * +@@ -1194,7 +1212,8 @@ static inline int of_property_read_strin + * @propname: name of the property to be searched. + * + * Search for a property in a device node. +- * Returns true if the property exists false otherwise. ++ * ++ * Return: true if the property exists false otherwise. + */ + static inline bool of_property_read_bool(const struct device_node *np, + const char *propname) +@@ -1440,7 +1459,7 @@ static inline int of_reconfig_get_state_ + * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node + * @np: Pointer to the given device_node + * +- * return true if present false otherwise ++ * Return: true if present false otherwise + */ + static inline bool of_device_is_system_power_controller(const struct device_node *np) + { diff --git a/target/linux/generic/backport-5.10/732-v5.13-0007-of-base-Fix-spelling-issue-with-function-param-prop.patch b/target/linux/generic/backport-5.10/732-v5.13-0007-of-base-Fix-spelling-issue-with-function-param-prop.patch new file mode 100644 index 00000000000..64197d7482e --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0007-of-base-Fix-spelling-issue-with-function-param-prop.patch @@ -0,0 +1,54 @@ +From 31e46db02ac1351c84e56a18606d17fc1b8390dd Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Mon, 29 Mar 2021 16:24:35 +0100 +Subject: [PATCH] of: base: Fix spelling issue with function param 'prop' + +Fixes the following W=1 kernel build warning(s): + + drivers/of/base.c:1781: warning: Function parameter or member 'prop' not described in '__of_add_property' + drivers/of/base.c:1781: warning: Excess function parameter 'prob' description in '__of_add_property' + drivers/of/base.c:1804: warning: Function parameter or member 'prop' not described in 'of_add_property' + drivers/of/base.c:1804: warning: Excess function parameter 'prob' description in 'of_add_property' + drivers/of/base.c:1855: warning: Function parameter or member 'prop' not described in 'of_remove_property' + drivers/of/base.c:1855: warning: Excess function parameter 'prob' description in 'of_remove_property' + +Cc: Rob Herring +Cc: Frank Rowand +Cc: "David S. Miller" +Cc: devicetree@vger.kernel.org +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20210329152435.900225-1-lee.jones@linaro.org +Signed-off-by: Rob Herring +--- + drivers/of/base.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -1780,7 +1780,7 @@ EXPORT_SYMBOL(of_count_phandle_with_args + /** + * __of_add_property - Add a property to a node without lock operations + * @np: Caller's Device Node +- * @prob: Property to add ++ * @prop: Property to add + */ + int __of_add_property(struct device_node *np, struct property *prop) + { +@@ -1803,7 +1803,7 @@ int __of_add_property(struct device_node + /** + * of_add_property - Add a property to a node + * @np: Caller's Device Node +- * @prob: Property to add ++ * @prop: Property to add + */ + int of_add_property(struct device_node *np, struct property *prop) + { +@@ -1849,7 +1849,7 @@ int __of_remove_property(struct device_n + /** + * of_remove_property - Remove a property from a node. + * @np: Caller's Device Node +- * @prob: Property to remove ++ * @prop: Property to remove + * + * Note that we don't actually remove it, since we have given out + * who-knows-how-many pointers to the data using get-property. 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-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch similarity index 99% rename from target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch rename to target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 928e1ca0dca..ae46508aeba 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-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -1,7 +1,7 @@ From 83216e3988cd196183542937c9bd58b279f946af Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Mon, 12 Apr 2021 19:47:17 +0200 -Subject: of: net: pass the dst buffer to of_get_mac_address() +Subject: [PATCH] of: net: pass the dst buffer to of_get_mac_address() of_get_mac_address() returns a "const void*" pointer to a MAC address. Lately, support to fetch the MAC address by an NVMEM provider was added. diff --git a/target/linux/generic/backport-5.10/732-net-next-2-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-devices.patch b/target/linux/generic/backport-5.10/732-v5.13-0009-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-de.patch similarity index 96% rename from target/linux/generic/backport-5.10/732-net-next-2-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-devices.patch rename to target/linux/generic/backport-5.10/732-v5.13-0009-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-de.patch index 245c5f3bd6c..260a3258bb4 100644 --- a/target/linux/generic/backport-5.10/732-net-next-2-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-devices.patch +++ b/target/linux/generic/backport-5.10/732-v5.13-0009-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-de.patch @@ -1,7 +1,7 @@ From f10843e04a075202dbb39dfcee047e3a2fdf5a8d Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Mon, 12 Apr 2021 19:47:18 +0200 -Subject: of: net: fix of_get_mac_addr_nvmem() for non-platform devices +Subject: [PATCH] of: net: fix of_get_mac_addr_nvmem() for non-platform devices of_get_mac_address() already supports fetching the MAC address by an nvmem provider. But until now, it was just working for platform devices. diff --git a/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch b/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch new file mode 100644 index 00000000000..6fe5032f33d --- /dev/null +++ b/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch @@ -0,0 +1,267 @@ +From fd3bb8f54a88107570334c156efb0c724a261003 Mon Sep 17 00:00:00 2001 +From: Evan Green +Date: Fri, 27 Nov 2020 10:28:34 +0000 +Subject: [PATCH] nvmem: core: Add support for keepout regions + +Introduce support into the nvmem core for arrays of register ranges +that should not result in actual device access. For these regions a +constant byte (repeated) is returned instead on read, and writes are +quietly ignored and returned as successful. + +This is useful for instance if certain efuse regions are protected +from access by Linux because they contain secret info to another part +of the system (like an integrated modem). + +Signed-off-by: Evan Green +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20201127102837.19366-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 153 ++++++++++++++++++++++++++++++++- + include/linux/nvmem-provider.h | 17 ++++ + 2 files changed, 166 insertions(+), 4 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -34,6 +34,8 @@ struct nvmem_device { + struct bin_attribute eeprom; + struct device *base_dev; + struct list_head cells; ++ const struct nvmem_keepout *keepout; ++ unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; + struct gpio_desc *wp_gpio; +@@ -66,8 +68,8 @@ static LIST_HEAD(nvmem_lookup_list); + + static BLOCKING_NOTIFIER_HEAD(nvmem_notifier); + +-static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, +- void *val, size_t bytes) ++static int __nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) + { + if (nvmem->reg_read) + return nvmem->reg_read(nvmem->priv, offset, val, bytes); +@@ -75,8 +77,8 @@ static int nvmem_reg_read(struct nvmem_d + return -EINVAL; + } + +-static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, +- void *val, size_t bytes) ++static int __nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) + { + int ret; + +@@ -90,6 +92,88 @@ static int nvmem_reg_write(struct nvmem_ + return -EINVAL; + } + ++static int nvmem_access_with_keepouts(struct nvmem_device *nvmem, ++ unsigned int offset, void *val, ++ size_t bytes, int write) ++{ ++ ++ unsigned int end = offset + bytes; ++ unsigned int kend, ksize; ++ const struct nvmem_keepout *keepout = nvmem->keepout; ++ const struct nvmem_keepout *keepoutend = keepout + nvmem->nkeepout; ++ int rc; ++ ++ /* ++ * Skip all keepouts before the range being accessed. ++ * Keepouts are sorted. ++ */ ++ while ((keepout < keepoutend) && (keepout->end <= offset)) ++ keepout++; ++ ++ while ((offset < end) && (keepout < keepoutend)) { ++ /* Access the valid portion before the keepout. */ ++ if (offset < keepout->start) { ++ kend = min(end, keepout->start); ++ ksize = kend - offset; ++ if (write) ++ rc = __nvmem_reg_write(nvmem, offset, val, ksize); ++ else ++ rc = __nvmem_reg_read(nvmem, offset, val, ksize); ++ ++ if (rc) ++ return rc; ++ ++ offset += ksize; ++ val += ksize; ++ } ++ ++ /* ++ * Now we're aligned to the start of this keepout zone. Go ++ * through it. ++ */ ++ kend = min(end, keepout->end); ++ ksize = kend - offset; ++ if (!write) ++ memset(val, keepout->value, ksize); ++ ++ val += ksize; ++ offset += ksize; ++ keepout++; ++ } ++ ++ /* ++ * If we ran out of keepouts but there's still stuff to do, send it ++ * down directly ++ */ ++ if (offset < end) { ++ ksize = end - offset; ++ if (write) ++ return __nvmem_reg_write(nvmem, offset, val, ksize); ++ else ++ return __nvmem_reg_read(nvmem, offset, val, ksize); ++ } ++ ++ return 0; ++} ++ ++static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ if (!nvmem->nkeepout) ++ return __nvmem_reg_read(nvmem, offset, val, bytes); ++ ++ return nvmem_access_with_keepouts(nvmem, offset, val, bytes, false); ++} ++ ++static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ if (!nvmem->nkeepout) ++ return __nvmem_reg_write(nvmem, offset, val, bytes); ++ ++ return nvmem_access_with_keepouts(nvmem, offset, val, bytes, true); ++} ++ + #ifdef CONFIG_NVMEM_SYSFS + static const char * const nvmem_type_str[] = { + [NVMEM_TYPE_UNKNOWN] = "Unknown", +@@ -535,6 +619,59 @@ nvmem_find_cell_by_name(struct nvmem_dev + return cell; + } + ++static int nvmem_validate_keepouts(struct nvmem_device *nvmem) ++{ ++ unsigned int cur = 0; ++ const struct nvmem_keepout *keepout = nvmem->keepout; ++ const struct nvmem_keepout *keepoutend = keepout + nvmem->nkeepout; ++ ++ while (keepout < keepoutend) { ++ /* Ensure keepouts are sorted and don't overlap. */ ++ if (keepout->start < cur) { ++ dev_err(&nvmem->dev, ++ "Keepout regions aren't sorted or overlap.\n"); ++ ++ return -ERANGE; ++ } ++ ++ if (keepout->end < keepout->start) { ++ dev_err(&nvmem->dev, ++ "Invalid keepout region.\n"); ++ ++ return -EINVAL; ++ } ++ ++ /* ++ * Validate keepouts (and holes between) don't violate ++ * word_size constraints. ++ */ ++ if ((keepout->end - keepout->start < nvmem->word_size) || ++ ((keepout->start != cur) && ++ (keepout->start - cur < nvmem->word_size))) { ++ ++ dev_err(&nvmem->dev, ++ "Keepout regions violate word_size constraints.\n"); ++ ++ return -ERANGE; ++ } ++ ++ /* Validate keepouts don't violate stride (alignment). */ ++ if (!IS_ALIGNED(keepout->start, nvmem->stride) || ++ !IS_ALIGNED(keepout->end, nvmem->stride)) { ++ ++ dev_err(&nvmem->dev, ++ "Keepout regions violate stride.\n"); ++ ++ return -EINVAL; ++ } ++ ++ cur = keepout->end; ++ keepout++; ++ } ++ ++ return 0; ++} ++ + static int nvmem_add_cells_from_of(struct nvmem_device *nvmem) + { + struct device_node *parent, *child; +@@ -655,6 +792,8 @@ struct nvmem_device *nvmem_register(cons + nvmem->type = config->type; + nvmem->reg_read = config->reg_read; + nvmem->reg_write = config->reg_write; ++ nvmem->keepout = config->keepout; ++ nvmem->nkeepout = config->nkeepout; + if (!config->no_of_node) + nvmem->dev.of_node = config->dev->of_node; + +@@ -679,6 +818,12 @@ struct nvmem_device *nvmem_register(cons + nvmem->dev.groups = nvmem_dev_groups; + #endif + ++ if (nvmem->nkeepout) { ++ rval = nvmem_validate_keepouts(nvmem); ++ if (rval) ++ goto err_put_device; ++ } ++ + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); + + rval = device_register(&nvmem->dev); +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -31,6 +31,19 @@ enum nvmem_type { + #define NVMEM_DEVID_AUTO (-2) + + /** ++ * struct nvmem_keepout - NVMEM register keepout range. ++ * ++ * @start: The first byte offset to avoid. ++ * @end: One beyond the last byte offset to avoid. ++ * @value: The byte to fill reads with for this region. ++ */ ++struct nvmem_keepout { ++ unsigned int start; ++ unsigned int end; ++ unsigned char value; ++}; ++ ++/** + * struct nvmem_config - NVMEM device configuration + * + * @dev: Parent device. +@@ -39,6 +52,8 @@ enum nvmem_type { + * @owner: Pointer to exporter module. Used for refcounting. + * @cells: Optional array of pre-defined NVMEM cells. + * @ncells: Number of elements in cells. ++ * @keepout: Optional array of keepout ranges (sorted ascending by start). ++ * @nkeepout: Number of elements in the keepout array. + * @type: Type of the nvmem storage + * @read_only: Device is read-only. + * @root_only: Device is accessibly to root only. +@@ -66,6 +81,8 @@ struct nvmem_config { + struct gpio_desc *wp_gpio; + const struct nvmem_cell_info *cells; + int ncells; ++ const struct nvmem_keepout *keepout; ++ unsigned int nkeepout; + enum nvmem_type type; + bool read_only; + bool root_only; diff --git a/target/linux/generic/backport-5.10/801-v5.11-0002-nvmem-qfprom-Don-t-touch-certain-fuses.patch b/target/linux/generic/backport-5.10/801-v5.11-0002-nvmem-qfprom-Don-t-touch-certain-fuses.patch new file mode 100644 index 00000000000..ae499e74989 --- /dev/null +++ b/target/linux/generic/backport-5.10/801-v5.11-0002-nvmem-qfprom-Don-t-touch-certain-fuses.patch @@ -0,0 +1,87 @@ +From 044ee8f85267599a9b0112911f5c16d4548b4289 Mon Sep 17 00:00:00 2001 +From: Evan Green +Date: Fri, 27 Nov 2020 10:28:36 +0000 +Subject: [PATCH] nvmem: qfprom: Don't touch certain fuses + +Some fuse ranges are protected by the XPU such that the AP cannot +access them. Attempting to do so causes an SError. Use the newly +introduced per-soc compatible string, and the newly introduced +nvmem keepout support to attach the set of regions +we should not access. + +Reviewed-by: Douglas Anderson +Signed-off-by: Evan Green +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20201127102837.19366-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + + /* Blow timer clock frequency in Mhz */ +@@ -89,6 +90,28 @@ struct qfprom_touched_values { + }; + + /** ++ * struct qfprom_soc_compatible_data - Data matched against the SoC ++ * compatible string. ++ * ++ * @keepout: Array of keepout regions for this SoC. ++ * @nkeepout: Number of elements in the keepout array. ++ */ ++struct qfprom_soc_compatible_data { ++ const struct nvmem_keepout *keepout; ++ unsigned int nkeepout; ++}; ++ ++static const struct nvmem_keepout sc7180_qfprom_keepout[] = { ++ {.start = 0x128, .end = 0x148}, ++ {.start = 0x220, .end = 0x228} ++}; ++ ++static const struct qfprom_soc_compatible_data sc7180_qfprom = { ++ .keepout = sc7180_qfprom_keepout, ++ .nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout) ++}; ++ ++/** + * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. + * @priv: Our driver data. + * @old: The data that was stashed from before fuse blowing. +@@ -302,6 +325,7 @@ static int qfprom_probe(struct platform_ + struct device *dev = &pdev->dev; + struct resource *res; + struct nvmem_device *nvmem; ++ const struct qfprom_soc_compatible_data *soc_data; + struct qfprom_priv *priv; + int ret; + +@@ -320,6 +344,11 @@ static int qfprom_probe(struct platform_ + econfig.priv = priv; + + priv->dev = dev; ++ soc_data = device_get_match_data(dev); ++ if (soc_data) { ++ econfig.keepout = soc_data->keepout; ++ econfig.nkeepout = soc_data->nkeepout; ++ } + + /* + * If more than one region is provided then the OS has the ability +@@ -375,6 +404,7 @@ static int qfprom_probe(struct platform_ + + static const struct of_device_id qfprom_of_match[] = { + { .compatible = "qcom,qfprom",}, ++ { .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom}, + {/* sentinel */}, + }; + MODULE_DEVICE_TABLE(of, qfprom_of_match); diff --git a/target/linux/generic/backport-5.10/801-v5.11-0003-nvmem-imx-ocotp-add-support-for-the-unaliged-word-co.patch b/target/linux/generic/backport-5.10/801-v5.11-0003-nvmem-imx-ocotp-add-support-for-the-unaliged-word-co.patch new file mode 100644 index 00000000000..0a05e0a97f5 --- /dev/null +++ b/target/linux/generic/backport-5.10/801-v5.11-0003-nvmem-imx-ocotp-add-support-for-the-unaliged-word-co.patch @@ -0,0 +1,105 @@ +From 3311bf18467272388039922a5e29c4925b291f73 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Fri, 27 Nov 2020 10:28:37 +0000 +Subject: [PATCH] nvmem: imx-ocotp: add support for the unaliged word count + +When offset is not 4 bytes aligned, directly shift righty by 2 bits +will cause reading out wrong data. Since imx ocotp only supports +4 bytes reading once, we need handle offset is not 4 bytes aligned +and enlarge the bytes to 4 bytes aligned. After reading finished, +copy the needed data from buffer to caller and free buffer. + +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20201127102837.19366-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 30 ++++++++++++++++++++++++------ + 1 file changed, 24 insertions(+), 6 deletions(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -4,6 +4,8 @@ + * + * Copyright (c) 2015 Pengutronix, Philipp Zabel + * ++ * Copyright 2019 NXP ++ * + * Based on the barebox ocotp driver, + * Copyright (c) 2010 Baruch Siach , + * Orex Computed Radiography +@@ -158,22 +160,30 @@ static int imx_ocotp_read(void *context, + { + struct ocotp_priv *priv = context; + unsigned int count; +- u32 *buf = val; ++ u8 *buf, *p; + int i, ret; +- u32 index; ++ u32 index, num_bytes; + + index = offset >> 2; +- count = bytes >> 2; ++ num_bytes = round_up((offset % 4) + bytes, 4); ++ count = num_bytes >> 2; + + if (count > (priv->params->nregs - index)) + count = priv->params->nregs - index; + ++ p = kzalloc(num_bytes, GFP_KERNEL); ++ if (!p) ++ return -ENOMEM; ++ + mutex_lock(&ocotp_mutex); + ++ buf = p; ++ + ret = clk_prepare_enable(priv->clk); + if (ret < 0) { + mutex_unlock(&ocotp_mutex); + dev_err(priv->dev, "failed to prepare/enable ocotp clk\n"); ++ kfree(p); + return ret; + } + +@@ -184,7 +194,7 @@ static int imx_ocotp_read(void *context, + } + + for (i = index; i < (index + count); i++) { +- *buf++ = readl(priv->base + IMX_OCOTP_OFFSET_B0W0 + ++ *(u32 *)buf = readl(priv->base + IMX_OCOTP_OFFSET_B0W0 + + i * IMX_OCOTP_OFFSET_PER_WORD); + + /* 47.3.1.2 +@@ -193,13 +203,21 @@ static int imx_ocotp_read(void *context, + * software before any new write, read or reload access can be + * issued + */ +- if (*(buf - 1) == IMX_OCOTP_READ_LOCKED_VAL) ++ if (*((u32 *)buf) == IMX_OCOTP_READ_LOCKED_VAL) + imx_ocotp_clr_err_if_set(priv); ++ ++ buf += 4; + } + ++ index = offset % 4; ++ memcpy(val, &p[index], bytes); ++ + read_end: + clk_disable_unprepare(priv->clk); + mutex_unlock(&ocotp_mutex); ++ ++ kfree(p); ++ + return ret; + } + +@@ -447,7 +465,7 @@ static struct nvmem_config imx_ocotp_nvm + .name = "imx-ocotp", + .read_only = false, + .word_size = 4, +- .stride = 4, ++ .stride = 1, + .reg_read = imx_ocotp_read, + .reg_write = imx_ocotp_write, + }; diff --git a/target/linux/generic/backport-5.10/802-v5.12-0002-nvmem-imx-iim-Use-of_device_get_match_data.patch b/target/linux/generic/backport-5.10/802-v5.12-0002-nvmem-imx-iim-Use-of_device_get_match_data.patch new file mode 100644 index 00000000000..9a7ba7f565c --- /dev/null +++ b/target/linux/generic/backport-5.10/802-v5.12-0002-nvmem-imx-iim-Use-of_device_get_match_data.patch @@ -0,0 +1,41 @@ +From 579db09c6106977c0496f2cca48606b289df4bdf Mon Sep 17 00:00:00 2001 +From: Fabio Estevam +Date: Fri, 29 Jan 2021 17:14:27 +0000 +Subject: [PATCH] nvmem: imx-iim: Use of_device_get_match_data() + +The retrieval of driver data via of_device_get_match_data() can make +the code simpler. + +Use of_device_get_match_data() to simplify the code. + +Signed-off-by: Fabio Estevam +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210129171430.11328-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-iim.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +--- a/drivers/nvmem/imx-iim.c ++++ b/drivers/nvmem/imx-iim.c +@@ -96,7 +96,6 @@ MODULE_DEVICE_TABLE(of, imx_iim_dt_ids); + + static int imx_iim_probe(struct platform_device *pdev) + { +- const struct of_device_id *of_id; + struct device *dev = &pdev->dev; + struct iim_priv *iim; + struct nvmem_device *nvmem; +@@ -111,11 +110,7 @@ static int imx_iim_probe(struct platform + if (IS_ERR(iim->base)) + return PTR_ERR(iim->base); + +- of_id = of_match_device(imx_iim_dt_ids, dev); +- if (!of_id) +- return -ENODEV; +- +- drvdata = of_id->data; ++ drvdata = of_device_get_match_data(&pdev->dev); + + iim->clk = devm_clk_get(dev, NULL); + if (IS_ERR(iim->clk)) diff --git a/target/linux/generic/backport-5.10/802-v5.12-0003-nvmem-Add-driver-to-expose-reserved-memory-as-nvmem.patch b/target/linux/generic/backport-5.10/802-v5.12-0003-nvmem-Add-driver-to-expose-reserved-memory-as-nvmem.patch new file mode 100644 index 00000000000..f3ed563d201 --- /dev/null +++ b/target/linux/generic/backport-5.10/802-v5.12-0003-nvmem-Add-driver-to-expose-reserved-memory-as-nvmem.patch @@ -0,0 +1,160 @@ +From 5a3fa75a4d9cb6bcfc9081ef224a4cdcd4b3eafe Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Fri, 29 Jan 2021 17:14:29 +0000 +Subject: [PATCH] nvmem: Add driver to expose reserved memory as nvmem + +Firmware/co-processors might use reserved memory areas in order to pass +data stemming from an nvmem device otherwise non accessible to Linux. +For example an EEPROM memory only physically accessible to firmware, or +data only accessible early at boot time. + +In order to expose this data to other drivers and user-space, the driver +models the reserved memory area as an nvmem device. + +Tested-by: Tim Gover +Reviewed-by: Rob Herring +Signed-off-by: Nicolas Saenz Julienne +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210129171430.11328-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 8 ++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/rmem.c | 97 ++++++++++++++++++++++++++++++++++++++++++ + drivers/of/platform.c | 1 + + 4 files changed, 108 insertions(+) + create mode 100644 drivers/nvmem/rmem.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -270,4 +270,12 @@ config SPRD_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem-sprd-efuse. + ++config NVMEM_RMEM ++ tristate "Reserved Memory Based Driver Support" ++ help ++ This drivers maps reserved memory into an nvmem device. It might be ++ useful to expose information left by firmware in memory. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-rmem. + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -55,3 +55,5 @@ obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynq + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o + obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o + nvmem_sprd_efuse-y := sprd-efuse.o ++obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o ++nvmem-rmem-y := rmem.o +--- /dev/null ++++ b/drivers/nvmem/rmem.c +@@ -0,0 +1,97 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2020 Nicolas Saenz Julienne ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct rmem { ++ struct device *dev; ++ struct nvmem_device *nvmem; ++ struct reserved_mem *mem; ++ ++ phys_addr_t size; ++}; ++ ++static int rmem_read(void *context, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ struct rmem *priv = context; ++ size_t available = priv->mem->size; ++ loff_t off = offset; ++ void *addr; ++ int count; ++ ++ /* ++ * Only map the reserved memory at this point to avoid potential rogue ++ * kernel threads inadvertently modifying it. Based on the current ++ * uses-cases for this driver, the performance hit isn't a concern. ++ * Nor is likely to be, given the nature of the subsystem. Most nvmem ++ * devices operate over slow buses to begin with. ++ * ++ * An alternative would be setting the memory as RO, set_memory_ro(), ++ * but as of Dec 2020 this isn't possible on arm64. ++ */ ++ addr = memremap(priv->mem->base, available, MEMREMAP_WB); ++ if (IS_ERR(addr)) { ++ dev_err(priv->dev, "Failed to remap memory region\n"); ++ return PTR_ERR(addr); ++ } ++ ++ count = memory_read_from_buffer(val, bytes, &off, addr, available); ++ ++ memunmap(addr); ++ ++ return count; ++} ++ ++static int rmem_probe(struct platform_device *pdev) ++{ ++ struct nvmem_config config = { }; ++ struct device *dev = &pdev->dev; ++ struct reserved_mem *mem; ++ struct rmem *priv; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ priv->dev = dev; ++ ++ mem = of_reserved_mem_lookup(dev->of_node); ++ if (!mem) { ++ dev_err(dev, "Failed to lookup reserved memory\n"); ++ return -EINVAL; ++ } ++ priv->mem = mem; ++ ++ config.dev = dev; ++ config.priv = priv; ++ config.name = "rmem"; ++ config.size = mem->size; ++ config.reg_read = rmem_read; ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); ++} ++ ++static const struct of_device_id rmem_match[] = { ++ { .compatible = "nvmem-rmem", }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, rmem_match); ++ ++static struct platform_driver rmem_driver = { ++ .probe = rmem_probe, ++ .driver = { ++ .name = "rmem", ++ .of_match_table = rmem_match, ++ }, ++}; ++module_platform_driver(rmem_driver); ++ ++MODULE_AUTHOR("Nicolas Saenz Julienne "); ++MODULE_DESCRIPTION("Reserved Memory Based nvmem Driver"); ++MODULE_LICENSE("GPL"); +--- a/drivers/of/platform.c ++++ b/drivers/of/platform.c +@@ -511,6 +511,7 @@ static const struct of_device_id reserve + { .compatible = "qcom,rmtfs-mem" }, + { .compatible = "qcom,cmd-db" }, + { .compatible = "ramoops" }, ++ { .compatible = "nvmem-rmem" }, + {} + }; + diff --git a/target/linux/generic/backport-5.10/802-v5.12-0005-nvmem-Kconfig-Correct-typo-in-NVMEM_RMEM.patch b/target/linux/generic/backport-5.10/802-v5.12-0005-nvmem-Kconfig-Correct-typo-in-NVMEM_RMEM.patch new file mode 100644 index 00000000000..129d070a62b --- /dev/null +++ b/target/linux/generic/backport-5.10/802-v5.12-0005-nvmem-Kconfig-Correct-typo-in-NVMEM_RMEM.patch @@ -0,0 +1,28 @@ +From b31f1eb41c140d7979f855df73064b3a3ae8055a Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Fri, 5 Feb 2021 10:08:52 +0000 +Subject: [PATCH] nvmem: Kconfig: Correct typo in NVMEM_RMEM + +s/drivers/driver/ as the configuration selects a single driver. + +Suggested-by: Randy Dunlap +Acked-by: Randy Dunlap +Signed-off-by: Nicolas Saenz Julienne +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210205100853.32372-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -273,7 +273,7 @@ config SPRD_EFUSE + config NVMEM_RMEM + tristate "Reserved Memory Based Driver Support" + help +- This drivers maps reserved memory into an nvmem device. It might be ++ This driver maps reserved memory into an nvmem device. It might be + useful to expose information left by firmware in memory. + + This driver can also be built as a module. If so, the module diff --git a/target/linux/generic/backport-5.10/803-v5.13-0001-nvmem-convert-comma-to-semicolon.patch b/target/linux/generic/backport-5.10/803-v5.13-0001-nvmem-convert-comma-to-semicolon.patch new file mode 100644 index 00000000000..b611ffe645a --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0001-nvmem-convert-comma-to-semicolon.patch @@ -0,0 +1,39 @@ +From e050f160d4832ce5227fb6ca934969cec0fc48be Mon Sep 17 00:00:00 2001 +From: Zheng Yongjun +Date: Tue, 30 Mar 2021 12:12:33 +0100 +Subject: [PATCH] nvmem: convert comma to semicolon + +Replace a comma between expression statements by a semicolon. + +Reviewed-by: Bjorn Andersson +Signed-off-by: Zheng Yongjun +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qcom-spmi-sdam.c | 2 +- + drivers/nvmem/snvs_lpgpr.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/qcom-spmi-sdam.c ++++ b/drivers/nvmem/qcom-spmi-sdam.c +@@ -141,7 +141,7 @@ static int sdam_probe(struct platform_de + sdam->sdam_config.dev = &pdev->dev; + sdam->sdam_config.name = "spmi_sdam"; + sdam->sdam_config.id = NVMEM_DEVID_AUTO; +- sdam->sdam_config.owner = THIS_MODULE, ++ sdam->sdam_config.owner = THIS_MODULE; + sdam->sdam_config.stride = 1; + sdam->sdam_config.word_size = 1; + sdam->sdam_config.reg_read = sdam_read; +--- a/drivers/nvmem/snvs_lpgpr.c ++++ b/drivers/nvmem/snvs_lpgpr.c +@@ -123,7 +123,7 @@ static int snvs_lpgpr_probe(struct platf + cfg->dev = dev; + cfg->stride = 4; + cfg->word_size = 4; +- cfg->size = dcfg->size, ++ cfg->size = dcfg->size; + cfg->owner = THIS_MODULE; + cfg->reg_read = snvs_lpgpr_read; + cfg->reg_write = snvs_lpgpr_write; diff --git a/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch b/target/linux/generic/backport-5.10/803-v5.13-0003-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch similarity index 86% rename from target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch rename to target/linux/generic/backport-5.10/803-v5.13-0003-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch index 3a8940b36ae..17be01c14f1 100644 --- a/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch +++ b/target/linux/generic/backport-5.10/803-v5.13-0003-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch @@ -1,6 +1,6 @@ -From b152bbeb0282bfcf6f91d0d5befd7582c1c3fc23 Mon Sep 17 00:00:00 2001 +From 3fef9ed0627af30753a2404b8bd59d92cdb4c0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 5 Mar 2021 19:32:36 +0100 +Date: Tue, 30 Mar 2021 12:12:36 +0100 Subject: [PATCH] nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -10,6 +10,8 @@ This driver provides access to Broadcom's NVRAM. Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/Kconfig | 9 +++++ drivers/nvmem/Makefile | 2 + @@ -19,10 +21,10 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -283,4 +283,13 @@ config NVMEM_U_BOOT_ENV - - If compiled as module it will be called nvmem_u-boot-env. +@@ -278,4 +278,13 @@ config NVMEM_RMEM + This driver can also be built as a module. If so, the module + will be called nvmem-rmem. + +config NVMEM_BRCM_NVRAM + tristate "Broadcom's NVRAM support" @@ -37,8 +39,8 @@ Signed-off-by: Srinivas Kandagatla +++ b/drivers/nvmem/Makefile @@ -57,3 +57,5 @@ obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_e nvmem_sprd_efuse-y := sprd-efuse.o - obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o - nvmem_u-boot-env-y := u-boot-env.o + obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o + nvmem-rmem-y := rmem.o +obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o +nvmem_brcm_nvram-y := brcm_nvram.o --- /dev/null diff --git a/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch b/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch new file mode 100644 index 00000000000..ff2456722f9 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch @@ -0,0 +1,174 @@ +From a28e824fb8270eda43fd0f65c2a5fdf33f55c5eb Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Tue, 30 Mar 2021 12:12:37 +0100 +Subject: [PATCH] nvmem: core: Add functions to make number reading easy + +Sometimes the clients of nvmem just want to get a number out of +nvmem. They don't want to think about exactly how many bytes the nvmem +cell took up. They just want the number. Let's make it easy. + +In general this concept is useful because nvmem space is precious and +usually the fewest bits are allocated that will hold a given value on +a given system. However, even though small numbers might be fine on +one system that doesn't mean that logically the number couldn't be +bigger. Imagine nvmem containing a max frequency for a component. On +one system perhaps that fits in 16 bits. On another system it might +fit in 32 bits. The code reading this number doesn't care--it just +wants the number. + +We'll provide two functions: nvmem_cell_read_variable_le_u32() and +nvmem_cell_read_variable_le_u64(). + +Comparing these to the existing functions like nvmem_cell_read_u32(): +* These new functions have no problems if the value was stored in + nvmem in fewer bytes. It's OK to use these function as long as the + value stored will fit in 32-bits (or 64-bits). +* These functions avoid problems that the earlier APIs had with bit + offsets. For instance, you can't use nvmem_cell_read_u32() to read a + value has nbits=32 and bit_offset=4 because the nvmem cell must be + at least 5 bytes big to hold this value. The new API accounts for + this and works fine. +* These functions make it very explicit that they assume that the + number was stored in little endian format. The old functions made + this assumption whenever bit_offset was non-zero (see + nvmem_shift_read_buffer_in_place()) but didn't whenever the + bit_offset was zero. + +NOTE: it's assumed that we don't need an 8-bit or 16-bit version of +this function. The 32-bit version of the function can be used to read +8-bit or 16-bit data. + +At the moment, I'm only adding the "unsigned" versions of these +functions, but if it ends up being useful someone could add a "signed" +version that did 2's complement sign extension. + +At the moment, I'm only adding the "little endian" versions of these +functions. Adding the "big endian" version would require adding "big +endian" support to nvmem_shift_read_buffer_in_place(). + +Signed-off-by: Douglas Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 95 ++++++++++++++++++++++++++++++++++ + include/linux/nvmem-consumer.h | 4 ++ + 2 files changed, 99 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1612,6 +1612,101 @@ int nvmem_cell_read_u64(struct device *d + } + EXPORT_SYMBOL_GPL(nvmem_cell_read_u64); + ++static void *nvmem_cell_read_variable_common(struct device *dev, ++ const char *cell_id, ++ size_t max_len, size_t *len) ++{ ++ struct nvmem_cell *cell; ++ int nbits; ++ void *buf; ++ ++ cell = nvmem_cell_get(dev, cell_id); ++ if (IS_ERR(cell)) ++ return cell; ++ ++ nbits = cell->nbits; ++ buf = nvmem_cell_read(cell, len); ++ nvmem_cell_put(cell); ++ if (IS_ERR(buf)) ++ return buf; ++ ++ /* ++ * If nbits is set then nvmem_cell_read() can significantly exaggerate ++ * the length of the real data. Throw away the extra junk. ++ */ ++ if (nbits) ++ *len = DIV_ROUND_UP(nbits, 8); ++ ++ if (*len > max_len) { ++ kfree(buf); ++ return ERR_PTR(-ERANGE); ++ } ++ ++ return buf; ++} ++ ++/** ++ * nvmem_cell_read_variable_le_u32() - Read up to 32-bits of data as a little endian number. ++ * ++ * @dev: Device that requests the nvmem cell. ++ * @cell_id: Name of nvmem cell to read. ++ * @val: pointer to output value. ++ * ++ * Return: 0 on success or negative errno. ++ */ ++int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id, ++ u32 *val) ++{ ++ size_t len; ++ u8 *buf; ++ int i; ++ ++ buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); ++ if (IS_ERR(buf)) ++ return PTR_ERR(buf); ++ ++ /* Copy w/ implicit endian conversion */ ++ *val = 0; ++ for (i = 0; i < len; i++) ++ *val |= buf[i] << (8 * i); ++ ++ kfree(buf); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(nvmem_cell_read_variable_le_u32); ++ ++/** ++ * nvmem_cell_read_variable_le_u64() - Read up to 64-bits of data as a little endian number. ++ * ++ * @dev: Device that requests the nvmem cell. ++ * @cell_id: Name of nvmem cell to read. ++ * @val: pointer to output value. ++ * ++ * Return: 0 on success or negative errno. ++ */ ++int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id, ++ u64 *val) ++{ ++ size_t len; ++ u8 *buf; ++ int i; ++ ++ buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); ++ if (IS_ERR(buf)) ++ return PTR_ERR(buf); ++ ++ /* Copy w/ implicit endian conversion */ ++ *val = 0; ++ for (i = 0; i < len; i++) ++ *val |= buf[i] << (8 * i); ++ ++ kfree(buf); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(nvmem_cell_read_variable_le_u64); ++ + /** + * nvmem_device_cell_read() - Read a given nvmem device and cell + * +--- a/include/linux/nvmem-consumer.h ++++ b/include/linux/nvmem-consumer.h +@@ -65,6 +65,10 @@ int nvmem_cell_read_u8(struct device *de + int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); + int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); + int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val); ++int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id, ++ u32 *val); ++int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id, ++ u64 *val); + + /* direct nvmem device read/write interface */ + struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); diff --git a/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch b/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch new file mode 100644 index 00000000000..72133d3a350 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch @@ -0,0 +1,34 @@ +From 55022fdeace8e432f008787ce03703bdcc9c3ca9 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 30 Mar 2021 12:12:38 +0100 +Subject: [PATCH] nvmem: core: Fix unintentional sign extension issue + +The shifting of the u8 integer buf[3] by 24 bits to the left will +be promoted to a 32 bit signed int and then sign-extended to a +u64. In the event that the top bit of buf[3] is set then all +then all the upper 32 bits of the u64 end up as also being set +because of the sign-extension. Fix this by casting buf[i] to +a u64 before the shift. + +Fixes: a28e824fb827 ("nvmem: core: Add functions to make number reading easy") +Reviewed-by: Douglas Anderson +Signed-off-by: Colin Ian King +Signed-off-by: Srinivas Kandagatla +Addresses-Coverity: ("Unintended sign extension") +Link: https://lore.kernel.org/r/20210330111241.19401-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1699,7 +1699,7 @@ int nvmem_cell_read_variable_le_u64(stru + /* Copy w/ implicit endian conversion */ + *val = 0; + for (i = 0; i < len; i++) +- *val |= buf[i] << (8 * i); ++ *val |= (uint64_t)buf[i] << (8 * i); + + kfree(buf); + diff --git a/target/linux/generic/backport-5.10/803-v5.13-0006-nvmem-rmem-fix-undefined-reference-to-memremap.patch b/target/linux/generic/backport-5.10/803-v5.13-0006-nvmem-rmem-fix-undefined-reference-to-memremap.patch new file mode 100644 index 00000000000..9e13fb67083 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0006-nvmem-rmem-fix-undefined-reference-to-memremap.patch @@ -0,0 +1,29 @@ +From cc1bc56fdc76a55bb8fae9a145a2e60bf22fb129 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Tue, 30 Mar 2021 12:12:39 +0100 +Subject: [PATCH] nvmem: rmem: fix undefined reference to memremap + +Fix below error reporte by kernel test robot +rmem.c:(.text+0x14e): undefined reference to memremap +s390x-linux-gnu-ld: rmem.c:(.text+0x1b6): undefined reference to memunmap + +Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem") +Reported-by: kernel test robot +Reviewed-by: Nicolas Saenz Julienne +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -272,6 +272,7 @@ config SPRD_EFUSE + + config NVMEM_RMEM + tristate "Reserved Memory Based Driver Support" ++ depends on HAS_IOMEM + help + This driver maps reserved memory into an nvmem device. It might be + useful to expose information left by firmware in memory. diff --git a/target/linux/generic/backport-5.10/803-v5.13-0007-nvmem-qfprom-Add-support-for-fuse-blowing-on-sc7280.patch b/target/linux/generic/backport-5.10/803-v5.13-0007-nvmem-qfprom-Add-support-for-fuse-blowing-on-sc7280.patch new file mode 100644 index 00000000000..0e75d4c93d7 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0007-nvmem-qfprom-Add-support-for-fuse-blowing-on-sc7280.patch @@ -0,0 +1,102 @@ +From 5a1bea2a2572ce5eb4bdcf432a6929681ee381f2 Mon Sep 17 00:00:00 2001 +From: Rajendra Nayak +Date: Tue, 30 Mar 2021 12:12:41 +0100 +Subject: [PATCH] nvmem: qfprom: Add support for fuse blowing on sc7280 + +Handle the differences across LDO voltage needed for blowing fuses, +and the blow timer value, identified using a minor version of 15 +on sc7280. + +Signed-off-by: Rajendra Nayak +Signed-off-by: Ravi Kumar Bokka +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-11-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -45,11 +45,13 @@ MODULE_PARM_DESC(read_raw_data, "Read ra + * @qfprom_blow_timer_value: The timer value of qfprom when doing efuse blow. + * @qfprom_blow_set_freq: The frequency required to set when we start the + * fuse blowing. ++ * @qfprom_blow_uV: LDO voltage to be set when doing efuse blow + */ + struct qfprom_soc_data { + u32 accel_value; + u32 qfprom_blow_timer_value; + u32 qfprom_blow_set_freq; ++ int qfprom_blow_uV; + }; + + /** +@@ -111,6 +113,15 @@ static const struct qfprom_soc_compatibl + .nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout) + }; + ++static const struct nvmem_keepout sc7280_qfprom_keepout[] = { ++ {.start = 0x128, .end = 0x148}, ++ {.start = 0x238, .end = 0x248} ++}; ++ ++static const struct qfprom_soc_compatible_data sc7280_qfprom = { ++ .keepout = sc7280_qfprom_keepout, ++ .nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout) ++}; + /** + * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. + * @priv: Our driver data. +@@ -168,6 +179,7 @@ static int qfprom_enable_fuse_blowing(co + struct qfprom_touched_values *old) + { + int ret; ++ int qfprom_blow_uV = priv->soc_data->qfprom_blow_uV; + + ret = clk_prepare_enable(priv->secclk); + if (ret) { +@@ -187,9 +199,9 @@ static int qfprom_enable_fuse_blowing(co + * a rail shared do don't specify a max--regulator constraints + * will handle. + */ +- ret = regulator_set_voltage(priv->vcc, 1800000, INT_MAX); ++ ret = regulator_set_voltage(priv->vcc, qfprom_blow_uV, INT_MAX); + if (ret) { +- dev_err(priv->dev, "Failed to set 1.8 voltage\n"); ++ dev_err(priv->dev, "Failed to set %duV\n", qfprom_blow_uV); + goto err_clk_rate_set; + } + +@@ -311,6 +323,14 @@ static const struct qfprom_soc_data qfpr + .accel_value = 0xD10, + .qfprom_blow_timer_value = 25, + .qfprom_blow_set_freq = 4800000, ++ .qfprom_blow_uV = 1800000, ++}; ++ ++static const struct qfprom_soc_data qfprom_7_15_data = { ++ .accel_value = 0xD08, ++ .qfprom_blow_timer_value = 24, ++ .qfprom_blow_set_freq = 4800000, ++ .qfprom_blow_uV = 1900000, + }; + + static int qfprom_probe(struct platform_device *pdev) +@@ -379,6 +399,8 @@ static int qfprom_probe(struct platform_ + + if (major_version == 7 && minor_version == 8) + priv->soc_data = &qfprom_7_8_data; ++ if (major_version == 7 && minor_version == 15) ++ priv->soc_data = &qfprom_7_15_data; + + priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); + if (IS_ERR(priv->vcc)) +@@ -405,6 +427,7 @@ static int qfprom_probe(struct platform_ + static const struct of_device_id qfprom_of_match[] = { + { .compatible = "qcom,qfprom",}, + { .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom}, ++ { .compatible = "qcom,sc7280-qfprom", .data = &sc7280_qfprom}, + {/* sentinel */}, + }; + MODULE_DEVICE_TABLE(of, qfprom_of_match); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch b/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch new file mode 100644 index 00000000000..8c5a55e3646 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch @@ -0,0 +1,80 @@ +From 1333a6779501f4cc662ff5c8b36b0a22f3a7ddc6 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Sat, 24 Apr 2021 13:06:04 +0200 +Subject: [PATCH] nvmem: core: allow specifying of_node + +Until now, the of_node of the parent device is used. Some devices +provide more than just the nvmem provider. To avoid name space clashes, +add a way to allow specifying the nvmem cells in subnodes. Consider the +following example: + + flash@0 { + compatible = "jedec,spi-nor"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x000000 0x010000>; + }; + }; + + otp { + compatible = "user-otp"; + #address-cells = <1>; + #size-cells = <1>; + + serial-number@0 { + reg = <0x0 0x8>; + }; + }; + }; + +There the nvmem provider might be the MTD partition or the OTP region of +the flash. + +Add a new config->of_node parameter, which if set, will be used instead +of the parent's of_node. + +Signed-off-by: Michael Walle +Acked-by: Srinivas Kandagatla +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-2-michael@walle.cc +--- + drivers/nvmem/core.c | 4 +++- + include/linux/nvmem-provider.h | 2 ++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -794,7 +794,9 @@ struct nvmem_device *nvmem_register(cons + nvmem->reg_write = config->reg_write; + nvmem->keepout = config->keepout; + nvmem->nkeepout = config->nkeepout; +- if (!config->no_of_node) ++ if (config->of_node) ++ nvmem->dev.of_node = config->of_node; ++ else if (!config->no_of_node) + nvmem->dev.of_node = config->dev->of_node; + + switch (config->id) { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -57,6 +57,7 @@ struct nvmem_keepout { + * @type: Type of the nvmem storage + * @read_only: Device is read-only. + * @root_only: Device is accessibly to root only. ++ * @of_node: If given, this will be used instead of the parent's of_node. + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. + * @reg_read: Callback to read data. + * @reg_write: Callback to write data. +@@ -86,6 +87,7 @@ struct nvmem_config { + enum nvmem_type type; + bool read_only; + bool root_only; ++ struct device_node *of_node; + bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; diff --git a/target/linux/generic/backport-5.10/804-v5.14-0002-nvmem-sprd-Fix-an-error-message.patch b/target/linux/generic/backport-5.10/804-v5.14-0002-nvmem-sprd-Fix-an-error-message.patch new file mode 100644 index 00000000000..db88328a118 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0002-nvmem-sprd-Fix-an-error-message.patch @@ -0,0 +1,30 @@ +From 20be064ec864086bca7a4eb62c772a397b44afb7 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Fri, 7 May 2021 19:02:48 +0200 +Subject: [PATCH] nvmem: sprd: Fix an error message + +'ret' is known to be 0 here. +The expected error status is stored in 'status', so use it instead. + +Also change %d in %u, because status is an u32, not a int. + +Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support") +Acked-by: Chunyan Zhang +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/5bc44aace2fe7e1c91d8b35c8fe31e7134ceab2c.1620406852.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sprd-efuse.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/sprd-efuse.c ++++ b/drivers/nvmem/sprd-efuse.c +@@ -234,7 +234,7 @@ static int sprd_efuse_raw_prog(struct sp + status = readl(efuse->base + SPRD_EFUSE_ERR_FLAG); + if (status) { + dev_err(efuse->dev, +- "write error status %d of block %d\n", ret, blk); ++ "write error status %u of block %d\n", status, blk); + + writel(SPRD_EFUSE_ERR_CLR_MASK, + efuse->base + SPRD_EFUSE_ERR_CLR); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0003-nvmem-sunxi_sid-Set-type-to-OTP.patch b/target/linux/generic/backport-5.10/804-v5.14-0003-nvmem-sunxi_sid-Set-type-to-OTP.patch new file mode 100644 index 00000000000..37694e54242 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0003-nvmem-sunxi_sid-Set-type-to-OTP.patch @@ -0,0 +1,27 @@ +From 78a005a22d5608b266eafa011b093a33284c52ce Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 11 Jun 2021 09:33:45 +0100 +Subject: [PATCH] nvmem: sunxi_sid: Set type to OTP + +This device currently reports an "Unknown" type in sysfs. +Since it is an eFuse hardware device, set its type to OTP. + +Signed-off-by: Samuel Holland +Acked-by: Chen-Yu Tsai +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunxi_sid.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -142,6 +142,7 @@ static int sunxi_sid_probe(struct platfo + + nvmem_cfg->dev = dev; + nvmem_cfg->name = "sunxi-sid"; ++ nvmem_cfg->type = NVMEM_TYPE_OTP; + nvmem_cfg->read_only = true; + nvmem_cfg->size = cfg->size; + nvmem_cfg->word_size = 1; diff --git a/target/linux/generic/backport-5.10/804-v5.14-0004-nvmem-qfprom-minor-nit-fixes.patch b/target/linux/generic/backport-5.10/804-v5.14-0004-nvmem-qfprom-minor-nit-fixes.patch new file mode 100644 index 00000000000..bcab3e41fd7 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0004-nvmem-qfprom-minor-nit-fixes.patch @@ -0,0 +1,46 @@ +From c813bb37bd32cb967060a2c573fae4ea518d32eb Mon Sep 17 00:00:00 2001 +From: Rajendra Nayak +Date: Fri, 11 Jun 2021 09:33:46 +0100 +Subject: [PATCH] nvmem: qfprom: minor nit fixes + +Fix a missed newline, change an 'if' to 'else if' and update +a comment which is stale after the merge of '5a1bea2a: nvmem: +qfprom: Add support for fuseblowing on sc7280' + +Signed-off-by: Rajendra Nayak +Reviewed-by: Douglas Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -122,6 +122,7 @@ static const struct qfprom_soc_compatibl + .keepout = sc7280_qfprom_keepout, + .nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout) + }; ++ + /** + * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. + * @priv: Our driver data. +@@ -195,7 +196,7 @@ static int qfprom_enable_fuse_blowing(co + } + + /* +- * Hardware requires 1.8V min for fuse blowing; this may be ++ * Hardware requires a min voltage for fuse blowing; this may be + * a rail shared do don't specify a max--regulator constraints + * will handle. + */ +@@ -399,7 +400,7 @@ static int qfprom_probe(struct platform_ + + if (major_version == 7 && minor_version == 8) + priv->soc_data = &qfprom_7_8_data; +- if (major_version == 7 && minor_version == 15) ++ else if (major_version == 7 && minor_version == 15) + priv->soc_data = &qfprom_7_15_data; + + priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch b/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch new file mode 100644 index 00000000000..55c3c5d6fe7 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch @@ -0,0 +1,52 @@ +From 1f7b4d87874624f4beb25253900a25306a193b8b Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Fri, 11 Jun 2021 09:33:47 +0100 +Subject: [PATCH] nvmem: core: constify nvmem_cell_read_variable_common() + return value + +The caller doesn't modify the memory pointed to by the pointer so it +can be const. + +Suggested-by: Stephen Boyd +Signed-off-by: Douglas Anderson +Reviewed-by: Stephen Boyd +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1614,9 +1614,9 @@ int nvmem_cell_read_u64(struct device *d + } + EXPORT_SYMBOL_GPL(nvmem_cell_read_u64); + +-static void *nvmem_cell_read_variable_common(struct device *dev, +- const char *cell_id, +- size_t max_len, size_t *len) ++static const void *nvmem_cell_read_variable_common(struct device *dev, ++ const char *cell_id, ++ size_t max_len, size_t *len) + { + struct nvmem_cell *cell; + int nbits; +@@ -1660,7 +1660,7 @@ int nvmem_cell_read_variable_le_u32(stru + u32 *val) + { + size_t len; +- u8 *buf; ++ const u8 *buf; + int i; + + buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); +@@ -1691,7 +1691,7 @@ int nvmem_cell_read_variable_le_u64(stru + u64 *val) + { + size_t len; +- u8 *buf; ++ const u8 *buf; + int i; + + buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0006-nvmem-qfprom-Improve-the-comment-about-regulator-set.patch b/target/linux/generic/backport-5.10/804-v5.14-0006-nvmem-qfprom-Improve-the-comment-about-regulator-set.patch new file mode 100644 index 00000000000..d7ef8e620f1 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0006-nvmem-qfprom-Improve-the-comment-about-regulator-set.patch @@ -0,0 +1,33 @@ +From 989f77e3fdee2e8f414dd1da9b6397d8763d414e Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Fri, 11 Jun 2021 09:33:48 +0100 +Subject: [PATCH] nvmem: qfprom: Improve the comment about regulator setting + +In review feedback Joe Perches found the existing comment +confusing. Let's use something based on the wording proposed by Joe. + +Suggested-by: Joe Perches +Signed-off-by: Douglas Anderson +Reviewed-by: Stephen Boyd +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -196,9 +196,9 @@ static int qfprom_enable_fuse_blowing(co + } + + /* +- * Hardware requires a min voltage for fuse blowing; this may be +- * a rail shared do don't specify a max--regulator constraints +- * will handle. ++ * Hardware requires a minimum voltage for fuse blowing. ++ * This may be a shared rail so don't specify a maximum. ++ * Regulator constraints will cap to the actual maximum. + */ + ret = regulator_set_voltage(priv->vcc, qfprom_blow_uV, INT_MAX); + if (ret) { diff --git a/target/linux/generic/backport-5.10/804-v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch b/target/linux/generic/backport-5.10/804-v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch new file mode 100644 index 00000000000..06c541b8e67 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch @@ -0,0 +1,36 @@ +From: Rafał Miłecki +Subject: [PATCH] nvmem: add NVMEM_TYPE_FRAM + +Signed-off-by: Rafał Miłecki +--- + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -180,6 +180,7 @@ static const char * const nvmem_type_str + [NVMEM_TYPE_EEPROM] = "EEPROM", + [NVMEM_TYPE_OTP] = "OTP", + [NVMEM_TYPE_BATTERY_BACKED] = "Battery backed", ++ [NVMEM_TYPE_FRAM] = "FRAM", + }; + + #ifdef CONFIG_DEBUG_LOCK_ALLOC +@@ -361,6 +362,9 @@ static int nvmem_sysfs_setup_compat(stru + if (!config->base_dev) + return -EINVAL; + ++ if (config->type == NVMEM_TYPE_FRAM) ++ bin_attr_nvmem_eeprom_compat.attr.name = "fram"; ++ + nvmem->eeprom = bin_attr_nvmem_eeprom_compat; + nvmem->eeprom.attr.mode = nvmem_bin_attr_get_umode(nvmem); + nvmem->eeprom.size = nvmem->size; +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -25,6 +25,7 @@ enum nvmem_type { + NVMEM_TYPE_EEPROM, + NVMEM_TYPE_OTP, + NVMEM_TYPE_BATTERY_BACKED, ++ NVMEM_TYPE_FRAM, + }; + + #define NVMEM_DEVID_NONE (-1) diff --git a/target/linux/generic/backport-5.10/805-v5.15-0002-nvmem-qfprom-sc7280-Handle-the-additional-power-doma.patch b/target/linux/generic/backport-5.10/805-v5.15-0002-nvmem-qfprom-sc7280-Handle-the-additional-power-doma.patch new file mode 100644 index 00000000000..b71edd0306d --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0002-nvmem-qfprom-sc7280-Handle-the-additional-power-doma.patch @@ -0,0 +1,89 @@ +From 7b808449f572d07bee840cd9da7e2fe6a1b8f4b5 Mon Sep 17 00:00:00 2001 +From: Rajendra Nayak +Date: Fri, 6 Aug 2021 09:59:46 +0100 +Subject: [PATCH] nvmem: qfprom: sc7280: Handle the additional power-domains + vote + +On sc7280, to reliably blow fuses, we need an additional vote +on max performance state of 'MX' power-domain. +Add support for power-domain performance state voting in the +driver. + +Reviewed-by: Douglas Anderson +Signed-off-by: Rajendra Nayak +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210806085947.22682-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -12,6 +12,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + +@@ -142,6 +144,9 @@ static void qfprom_disable_fuse_blowing( + writel(old->timer_val, priv->qfpconf + QFPROM_BLOW_TIMER_OFFSET); + writel(old->accel_val, priv->qfpconf + QFPROM_ACCEL_OFFSET); + ++ dev_pm_genpd_set_performance_state(priv->dev, 0); ++ pm_runtime_put(priv->dev); ++ + /* + * This may be a shared rail and may be able to run at a lower rate + * when we're not blowing fuses. At the moment, the regulator framework +@@ -212,6 +217,14 @@ static int qfprom_enable_fuse_blowing(co + goto err_clk_rate_set; + } + ++ ret = pm_runtime_get_sync(priv->dev); ++ if (ret < 0) { ++ pm_runtime_put_noidle(priv->dev); ++ dev_err(priv->dev, "Failed to enable power-domain\n"); ++ goto err_reg_enable; ++ } ++ dev_pm_genpd_set_performance_state(priv->dev, INT_MAX); ++ + old->timer_val = readl(priv->qfpconf + QFPROM_BLOW_TIMER_OFFSET); + old->accel_val = readl(priv->qfpconf + QFPROM_ACCEL_OFFSET); + writel(priv->soc_data->qfprom_blow_timer_value, +@@ -221,6 +234,8 @@ static int qfprom_enable_fuse_blowing(co + + return 0; + ++err_reg_enable: ++ regulator_disable(priv->vcc); + err_clk_rate_set: + clk_set_rate(priv->secclk, old->clk_rate); + err_clk_prepared: +@@ -320,6 +335,11 @@ static int qfprom_reg_read(void *context + return 0; + } + ++static void qfprom_runtime_disable(void *data) ++{ ++ pm_runtime_disable(data); ++} ++ + static const struct qfprom_soc_data qfprom_7_8_data = { + .accel_value = 0xD10, + .qfprom_blow_timer_value = 25, +@@ -420,6 +440,11 @@ static int qfprom_probe(struct platform_ + econfig.reg_write = qfprom_reg_write; + } + ++ pm_runtime_enable(dev); ++ ret = devm_add_action_or_reset(dev, qfprom_runtime_disable, dev); ++ if (ret) ++ return ret; ++ + nvmem = devm_nvmem_register(dev, &econfig); + + return PTR_ERR_OR_ZERO(nvmem); diff --git a/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch b/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch new file mode 100644 index 00000000000..59c9281cdb4 --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch @@ -0,0 +1,36 @@ +From de0534df93474f268486c486ea7e01b44a478026 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Fri, 6 Aug 2021 09:59:47 +0100 +Subject: [PATCH] nvmem: core: fix error handling while validating keepout + regions + +Current error path on failure of validating keepout regions is calling +put_device, eventhough the device is not even registered at that point. + +Fix this by adding proper error handling of freeing ida and nvmem. + +Fixes: fd3bb8f54a88 ("nvmem: core: Add support for keepout regions") +Cc: +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210806085947.22682-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -826,8 +826,11 @@ struct nvmem_device *nvmem_register(cons + + if (nvmem->nkeepout) { + rval = nvmem_validate_keepouts(nvmem); +- if (rval) +- goto err_put_device; ++ if (rval) { ++ ida_free(&nvmem_ida, nvmem->id); ++ kfree(nvmem); ++ return ERR_PTR(rval); ++ } + } + + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); diff --git a/target/linux/generic/backport-5.10/805-v5.15-0004-nvmem-nintendo-otp-Add-new-driver-for-the-Wii-and-Wi.patch b/target/linux/generic/backport-5.10/805-v5.15-0004-nvmem-nintendo-otp-Add-new-driver-for-the-Wii-and-Wi.patch new file mode 100644 index 00000000000..62d9e2aa0f0 --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0004-nvmem-nintendo-otp-Add-new-driver-for-the-Wii-and-Wi.patch @@ -0,0 +1,191 @@ +From 3683b761fe3a10ad18515acd5368dd601268cfe5 Mon Sep 17 00:00:00 2001 +From: Emmanuel Gil Peyrot +Date: Tue, 10 Aug 2021 16:30:36 +0100 +Subject: [PATCH] nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This OTP is read-only and contains various keys used by the console to +decrypt, encrypt or verify various pieces of storage. + +Its size depends on the console, it is 128 bytes on the Wii and +1024 bytes on the Wii U (split into eight 128 bytes banks). + +It can be used directly by writing into one register and reading from +the other one, without any additional synchronisation. + +This driver was written based on reversed documentation, see: +https://wiiubrew.org/wiki/Hardware/OTP + +Tested-by: Jonathan Neuschäfer # on Wii +Tested-by: Emmanuel Gil Peyrot # on Wii U +Signed-off-by: Emmanuel Gil Peyrot +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210810153036.1494-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 11 ++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/nintendo-otp.c | 124 +++++++++++++++++++++++++++++++++++ + 3 files changed, 137 insertions(+) + create mode 100644 drivers/nvmem/nintendo-otp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -107,6 +107,17 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + ++config NVMEM_NINTENDO_OTP ++ tristate "Nintendo Wii and Wii U OTP Support" ++ help ++ This is a driver exposing the OTP of a Nintendo Wii or Wii U console. ++ ++ This memory contains common and per-console keys, signatures and ++ related data required to access peripherals. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-nintendo-otp. ++ + config QCOM_QFPROM + tristate "QCOM QFPROM Support" + depends on ARCH_QCOM || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -23,6 +23,8 @@ obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem + nvmem_lpc18xx_otp-y := lpc18xx_otp.o + obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o + nvmem-mxs-ocotp-y := mxs-ocotp.o ++obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o ++nvmem-nintendo-otp-y := nintendo-otp.o + obj-$(CONFIG_MTK_EFUSE) += nvmem_mtk-efuse.o + nvmem_mtk-efuse-y := mtk-efuse.o + obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o +--- /dev/null ++++ b/drivers/nvmem/nintendo-otp.c +@@ -0,0 +1,124 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Nintendo Wii and Wii U OTP driver ++ * ++ * This is a driver exposing the OTP of a Nintendo Wii or Wii U console. ++ * ++ * This memory contains common and per-console keys, signatures and ++ * related data required to access peripherals. ++ * ++ * Based on reversed documentation from https://wiiubrew.org/wiki/Hardware/OTP ++ * ++ * Copyright (C) 2021 Emmanuel Gil Peyrot ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define HW_OTPCMD 0 ++#define HW_OTPDATA 4 ++#define OTP_READ 0x80000000 ++#define BANK_SIZE 128 ++#define WORD_SIZE 4 ++ ++struct nintendo_otp_priv { ++ void __iomem *regs; ++}; ++ ++struct nintendo_otp_devtype_data { ++ const char *name; ++ unsigned int num_banks; ++}; ++ ++static const struct nintendo_otp_devtype_data hollywood_otp_data = { ++ .name = "wii-otp", ++ .num_banks = 1, ++}; ++ ++static const struct nintendo_otp_devtype_data latte_otp_data = { ++ .name = "wiiu-otp", ++ .num_banks = 8, ++}; ++ ++static int nintendo_otp_reg_read(void *context, ++ unsigned int reg, void *_val, size_t bytes) ++{ ++ struct nintendo_otp_priv *priv = context; ++ u32 *val = _val; ++ int words = bytes / WORD_SIZE; ++ u32 bank, addr; ++ ++ while (words--) { ++ bank = (reg / BANK_SIZE) << 8; ++ addr = (reg / WORD_SIZE) % (BANK_SIZE / WORD_SIZE); ++ iowrite32be(OTP_READ | bank | addr, priv->regs + HW_OTPCMD); ++ *val++ = ioread32be(priv->regs + HW_OTPDATA); ++ reg += WORD_SIZE; ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id nintendo_otp_of_table[] = { ++ { .compatible = "nintendo,hollywood-otp", .data = &hollywood_otp_data }, ++ { .compatible = "nintendo,latte-otp", .data = &latte_otp_data }, ++ {/* sentinel */}, ++}; ++MODULE_DEVICE_TABLE(of, nintendo_otp_of_table); ++ ++static int nintendo_otp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ const struct of_device_id *of_id = ++ of_match_device(nintendo_otp_of_table, dev); ++ struct resource *res; ++ struct nvmem_device *nvmem; ++ struct nintendo_otp_priv *priv; ++ ++ struct nvmem_config config = { ++ .stride = WORD_SIZE, ++ .word_size = WORD_SIZE, ++ .reg_read = nintendo_otp_reg_read, ++ .read_only = true, ++ .root_only = true, ++ }; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ priv->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(priv->regs)) ++ return PTR_ERR(priv->regs); ++ ++ if (of_id->data) { ++ const struct nintendo_otp_devtype_data *data = of_id->data; ++ config.name = data->name; ++ config.size = data->num_banks * BANK_SIZE; ++ } ++ ++ config.dev = dev; ++ config.priv = priv; ++ ++ nvmem = devm_nvmem_register(dev, &config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static struct platform_driver nintendo_otp_driver = { ++ .probe = nintendo_otp_probe, ++ .driver = { ++ .name = "nintendo-otp", ++ .of_match_table = nintendo_otp_of_table, ++ }, ++}; ++module_platform_driver(nintendo_otp_driver); ++MODULE_AUTHOR("Emmanuel Gil Peyrot "); ++MODULE_DESCRIPTION("Nintendo Wii and Wii U OTP driver"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/backport-5.10/805-v5.15-0005-nvmem-NVMEM_NINTENDO_OTP-should-depend-on-WII.patch b/target/linux/generic/backport-5.10/805-v5.15-0005-nvmem-NVMEM_NINTENDO_OTP-should-depend-on-WII.patch new file mode 100644 index 00000000000..02f8b6c5622 --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0005-nvmem-NVMEM_NINTENDO_OTP-should-depend-on-WII.patch @@ -0,0 +1,29 @@ +From 7af526c740bdbd5b4dcebba04ace5b3b0c07801f Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Tue, 14 Sep 2021 11:29:49 +0200 +Subject: [PATCH] nvmem: NVMEM_NINTENDO_OTP should depend on WII + +The Nintendo Wii and Wii U OTP is only present on Nintendo Wii and Wii U +consoles. Hence add a dependency on WII, to prevent asking the user +about this driver when configuring a kernel without Nintendo Wii and Wii +U console support. + +Fixes: 3683b761fe3a10ad ("nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP") +Reviewed-by: Emmanuel Gil Peyrot +Signed-off-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/01318920709dddc4d85fe895e2083ca0eee234d8.1631611652.git.geert+renesas@glider.be +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -109,6 +109,7 @@ config MTK_EFUSE + + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" ++ depends on WII || COMPILE_TEST + help + This is a driver exposing the OTP of a Nintendo Wii or Wii U console. + diff --git a/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch b/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch new file mode 100644 index 00000000000..fca7c5f848c --- /dev/null +++ b/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch @@ -0,0 +1,456 @@ +From 7ae6478b304bc004c3139b422665b0e23b57f05c Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:55 +0100 +Subject: [PATCH] nvmem: core: rework nvmem cell instance creation + +In the existing design, we do not create a instance per nvmem cell consumer +but we directly refer cell from nvmem cell list that are added to provider. + +However this design has some limitations when consumers want to assign name +or connection id the nvmem cell instance, ex: via "nvmem-cell-names" or +id in nvmem_cell_get(id). + +Having a name associated with nvmem cell consumer instance will help +provider drivers in performing post processing of nvmem cell data if required +before data is seen by the consumers. This is pretty normal with some vendors +storing nvmem cells like mac-address in a vendor specific data layouts that +are not directly usable by the consumer drivers. + +With this patch nvmem cell will be created dynamically during nvmem_cell_get +and destroyed in nvmem_cell_put, allowing consumers to associate name with +nvmem cell consumer instance. + +With this patch a new struct nvmem_cell_entry replaces struct nvmem_cell +for storing nvmem cell information within the core. +This patch does not change nvmem-consumer interface based on nvmem_cell. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 165 +++++++++++++++++++++++++++---------------- + 1 file changed, 105 insertions(+), 60 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -45,8 +45,7 @@ struct nvmem_device { + #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev) + + #define FLAG_COMPAT BIT(0) +- +-struct nvmem_cell { ++struct nvmem_cell_entry { + const char *name; + int offset; + int bytes; +@@ -57,6 +56,11 @@ struct nvmem_cell { + struct list_head node; + }; + ++struct nvmem_cell { ++ struct nvmem_cell_entry *entry; ++ const char *id; ++}; ++ + static DEFINE_MUTEX(nvmem_mutex); + static DEFINE_IDA(nvmem_ida); + +@@ -424,7 +428,7 @@ static struct bus_type nvmem_bus_type = + .name = "nvmem", + }; + +-static void nvmem_cell_drop(struct nvmem_cell *cell) ++static void nvmem_cell_entry_drop(struct nvmem_cell_entry *cell) + { + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_REMOVE, cell); + mutex_lock(&nvmem_mutex); +@@ -437,13 +441,13 @@ static void nvmem_cell_drop(struct nvmem + + static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem) + { +- struct nvmem_cell *cell, *p; ++ struct nvmem_cell_entry *cell, *p; + + list_for_each_entry_safe(cell, p, &nvmem->cells, node) +- nvmem_cell_drop(cell); ++ nvmem_cell_entry_drop(cell); + } + +-static void nvmem_cell_add(struct nvmem_cell *cell) ++static void nvmem_cell_entry_add(struct nvmem_cell_entry *cell) + { + mutex_lock(&nvmem_mutex); + list_add_tail(&cell->node, &cell->nvmem->cells); +@@ -451,9 +455,9 @@ static void nvmem_cell_add(struct nvmem_ + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_ADD, cell); + } + +-static int nvmem_cell_info_to_nvmem_cell_nodup(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry_nodup(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + cell->nvmem = nvmem; + cell->offset = info->offset; +@@ -477,13 +481,13 @@ static int nvmem_cell_info_to_nvmem_cell + return 0; + } + +-static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + int err; + +- err = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, cell); ++ err = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, cell); + if (err) + return err; + +@@ -507,7 +511,7 @@ static int nvmem_add_cells(struct nvmem_ + const struct nvmem_cell_info *info, + int ncells) + { +- struct nvmem_cell **cells; ++ struct nvmem_cell_entry **cells; + int i, rval; + + cells = kcalloc(ncells, sizeof(*cells), GFP_KERNEL); +@@ -521,13 +525,13 @@ static int nvmem_add_cells(struct nvmem_ + goto err; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, &info[i], cells[i]); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, &info[i], cells[i]); + if (rval) { + kfree(cells[i]); + goto err; + } + +- nvmem_cell_add(cells[i]); ++ nvmem_cell_entry_add(cells[i]); + } + + /* remove tmp array */ +@@ -536,7 +540,7 @@ static int nvmem_add_cells(struct nvmem_ + return 0; + err: + while (i--) +- nvmem_cell_drop(cells[i]); ++ nvmem_cell_entry_drop(cells[i]); + + kfree(cells); + +@@ -573,7 +577,7 @@ static int nvmem_add_cells_from_table(st + { + const struct nvmem_cell_info *info; + struct nvmem_cell_table *table; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + int rval = 0, i; + + mutex_lock(&nvmem_cell_mutex); +@@ -588,15 +592,13 @@ static int nvmem_add_cells_from_table(st + goto out; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, +- info, +- cell); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, info, cell); + if (rval) { + kfree(cell); + goto out; + } + +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + } + } +@@ -606,10 +608,10 @@ out: + return rval; + } + +-static struct nvmem_cell * +-nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_name(struct nvmem_device *nvmem, const char *cell_id) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -680,7 +682,7 @@ static int nvmem_add_cells_from_of(struc + { + struct device_node *parent, *child; + struct device *dev = &nvmem->dev; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + const __be32 *addr; + int len; + +@@ -729,7 +731,7 @@ static int nvmem_add_cells_from_of(struc + } + + cell->np = of_node_get(child); +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + + return 0; +@@ -1144,9 +1146,33 @@ struct nvmem_device *devm_nvmem_device_g + } + EXPORT_SYMBOL_GPL(devm_nvmem_device_get); + ++static struct nvmem_cell *nvmem_create_cell(struct nvmem_cell_entry *entry, const char *id) ++{ ++ struct nvmem_cell *cell; ++ const char *name = NULL; ++ ++ cell = kzalloc(sizeof(*cell), GFP_KERNEL); ++ if (!cell) ++ return ERR_PTR(-ENOMEM); ++ ++ if (id) { ++ name = kstrdup_const(id, GFP_KERNEL); ++ if (!name) { ++ kfree(cell); ++ return ERR_PTR(-ENOMEM); ++ } ++ } ++ ++ cell->id = name; ++ cell->entry = entry; ++ ++ return cell; ++} ++ + static struct nvmem_cell * + nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) + { ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell = ERR_PTR(-ENOENT); + struct nvmem_cell_lookup *lookup; + struct nvmem_device *nvmem; +@@ -1171,11 +1197,15 @@ nvmem_cell_get_from_lookup(struct device + break; + } + +- cell = nvmem_find_cell_by_name(nvmem, +- lookup->cell_name); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_name(nvmem, ++ lookup->cell_name); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + cell = ERR_PTR(-ENOENT); ++ } else { ++ cell = nvmem_create_cell(cell_entry, con_id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); + } + break; + } +@@ -1186,10 +1216,10 @@ nvmem_cell_get_from_lookup(struct device + } + + #if IS_ENABLED(CONFIG_OF) +-static struct nvmem_cell * +-nvmem_find_cell_by_node(struct nvmem_device *nvmem, struct device_node *np) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_node(struct nvmem_device *nvmem, struct device_node *np) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -1219,6 +1249,7 @@ struct nvmem_cell *of_nvmem_cell_get(str + { + struct device_node *cell_np, *nvmem_np; + struct nvmem_device *nvmem; ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell; + int index = 0; + +@@ -1239,12 +1270,16 @@ struct nvmem_cell *of_nvmem_cell_get(str + if (IS_ERR(nvmem)) + return ERR_CAST(nvmem); + +- cell = nvmem_find_cell_by_node(nvmem, cell_np); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_node(nvmem, cell_np); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + return ERR_PTR(-ENOENT); + } + ++ cell = nvmem_create_cell(cell_entry, id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); ++ + return cell; + } + EXPORT_SYMBOL_GPL(of_nvmem_cell_get); +@@ -1350,13 +1385,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put); + */ + void nvmem_cell_put(struct nvmem_cell *cell) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; ++ ++ if (cell->id) ++ kfree_const(cell->id); + ++ kfree(cell); + __nvmem_device_put(nvmem); + } + EXPORT_SYMBOL_GPL(nvmem_cell_put); + +-static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) ++static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void *buf) + { + u8 *p, *b; + int i, extra, bit_offset = cell->bit_offset; +@@ -1390,8 +1429,8 @@ static void nvmem_shift_read_buffer_in_p + } + + static int __nvmem_cell_read(struct nvmem_device *nvmem, +- struct nvmem_cell *cell, +- void *buf, size_t *len) ++ struct nvmem_cell_entry *cell, ++ void *buf, size_t *len, const char *id) + { + int rc; + +@@ -1422,18 +1461,18 @@ static int __nvmem_cell_read(struct nvme + */ + void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; + u8 *buf; + int rc; + + if (!nvmem) + return ERR_PTR(-EINVAL); + +- buf = kzalloc(cell->bytes, GFP_KERNEL); ++ buf = kzalloc(cell->entry->bytes, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + +- rc = __nvmem_cell_read(nvmem, cell, buf, len); ++ rc = __nvmem_cell_read(nvmem, cell->entry, buf, len, cell->id); + if (rc) { + kfree(buf); + return ERR_PTR(rc); +@@ -1443,7 +1482,7 @@ void *nvmem_cell_read(struct nvmem_cell + } + EXPORT_SYMBOL_GPL(nvmem_cell_read); + +-static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, ++static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell_entry *cell, + u8 *_buf, int len) + { + struct nvmem_device *nvmem = cell->nvmem; +@@ -1496,16 +1535,7 @@ err: + return ERR_PTR(rc); + } + +-/** +- * nvmem_cell_write() - Write to a given nvmem cell +- * +- * @cell: nvmem cell to be written. +- * @buf: Buffer to be written. +- * @len: length of buffer to be written to nvmem cell. +- * +- * Return: length of bytes written or negative on failure. +- */ +-int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++static int __nvmem_cell_entry_write(struct nvmem_cell_entry *cell, void *buf, size_t len) + { + struct nvmem_device *nvmem = cell->nvmem; + int rc; +@@ -1531,6 +1561,21 @@ int nvmem_cell_write(struct nvmem_cell * + + return len; + } ++ ++/** ++ * nvmem_cell_write() - Write to a given nvmem cell ++ * ++ * @cell: nvmem cell to be written. ++ * @buf: Buffer to be written. ++ * @len: length of buffer to be written to nvmem cell. ++ * ++ * Return: length of bytes written or negative on failure. ++ */ ++int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++{ ++ return __nvmem_cell_entry_write(cell->entry, buf, len); ++} ++ + EXPORT_SYMBOL_GPL(nvmem_cell_write); + + static int nvmem_cell_read_common(struct device *dev, const char *cell_id, +@@ -1633,7 +1678,7 @@ static const void *nvmem_cell_read_varia + if (IS_ERR(cell)) + return cell; + +- nbits = cell->nbits; ++ nbits = cell->entry->nbits; + buf = nvmem_cell_read(cell, len); + nvmem_cell_put(cell); + if (IS_ERR(buf)) +@@ -1729,18 +1774,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab + ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + ssize_t len; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- rc = __nvmem_cell_read(nvmem, &cell, buf, &len); ++ rc = __nvmem_cell_read(nvmem, &cell, buf, &len, NULL); + if (rc) + return rc; + +@@ -1760,17 +1805,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read + int nvmem_device_cell_write(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- return nvmem_cell_write(&cell, buf, cell.bytes); ++ return __nvmem_cell_entry_write(&cell, buf, cell.bytes); + } + EXPORT_SYMBOL_GPL(nvmem_device_cell_write); + diff --git a/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch b/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch new file mode 100644 index 00000000000..787fea30375 --- /dev/null +++ b/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch @@ -0,0 +1,82 @@ +From 5008062f1c3f5af3acf86164aa6fcc77b0c7bdce Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:56 +0100 +Subject: [PATCH] nvmem: core: add nvmem cell post processing callback + +Some NVMEM providers have certain nvmem cells encoded, which requires +post processing before actually using it. + +For example mac-address is stored in either in ascii or delimited or reverse-order. + +Having a post-process callback hook to provider drivers would enable them to +do this vendor specific post processing before nvmem consumers see it. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 9 +++++++++ + include/linux/nvmem-provider.h | 5 +++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -38,6 +38,7 @@ struct nvmem_device { + unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + struct gpio_desc *wp_gpio; + void *priv; + }; +@@ -798,6 +799,7 @@ struct nvmem_device *nvmem_register(cons + nvmem->type = config->type; + nvmem->reg_read = config->reg_read; + nvmem->reg_write = config->reg_write; ++ nvmem->cell_post_process = config->cell_post_process; + nvmem->keepout = config->keepout; + nvmem->nkeepout = config->nkeepout; + if (config->of_node) +@@ -1443,6 +1445,13 @@ static int __nvmem_cell_read(struct nvme + if (cell->bit_offset || cell->nbits) + nvmem_shift_read_buffer_in_place(cell, buf); + ++ if (nvmem->cell_post_process) { ++ rc = nvmem->cell_post_process(nvmem->priv, id, ++ cell->offset, buf, cell->bytes); ++ if (rc) ++ return rc; ++ } ++ + if (len) + *len = cell->bytes; + +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -19,6 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *pr + void *val, size_t bytes); + typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, + void *val, size_t bytes); ++/* used for vendor specific post processing of cell data */ ++typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, unsigned int offset, ++ void *buf, size_t bytes); + + enum nvmem_type { + NVMEM_TYPE_UNKNOWN = 0, +@@ -62,6 +65,7 @@ struct nvmem_keepout { + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. + * @reg_read: Callback to read data. + * @reg_write: Callback to write data. ++ * @cell_post_process: Callback for vendor specific post processing of cell data + * @size: Device size. + * @word_size: Minimum read/write access granularity. + * @stride: Minimum read/write access stride. +@@ -92,6 +96,7 @@ struct nvmem_config { + bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + int size; + int word_size; + int stride; diff --git a/target/linux/generic/backport-5.10/806-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch b/target/linux/generic/backport-5.10/806-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch new file mode 100644 index 00000000000..ee19228270d --- /dev/null +++ b/target/linux/generic/backport-5.10/806-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch @@ -0,0 +1,92 @@ +From d0221a780cbc99fec6c27a98dba2828dc5735c00 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:57 +0100 +Subject: [PATCH] nvmem: imx-ocotp: add support for post processing + +Add .cell_post_process callback for imx-ocotp to deal with MAC address, +since MAC address need to be reversed byte for some i.MX SoCs. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -97,6 +97,7 @@ struct ocotp_params { + unsigned int bank_address_words; + void (*set_timing)(struct ocotp_priv *priv); + struct ocotp_ctrl_reg ctrl; ++ bool reverse_mac_address; + }; + + static int imx_ocotp_wait_for_busy(struct ocotp_priv *priv, u32 flags) +@@ -221,6 +222,25 @@ read_end: + return ret; + } + ++static int imx_ocotp_cell_pp(void *context, const char *id, unsigned int offset, ++ void *data, size_t bytes) ++{ ++ struct ocotp_priv *priv = context; ++ ++ /* Deal with some post processing of nvmem cell data */ ++ if (id && !strcmp(id, "mac-address")) { ++ if (priv->params->reverse_mac_address) { ++ u8 *buf = data; ++ int i; ++ ++ for (i = 0; i < bytes/2; i++) ++ swap(buf[i], buf[bytes - i - 1]); ++ } ++ } ++ ++ return 0; ++} ++ + static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) + { + unsigned long clk_rate; +@@ -468,6 +488,7 @@ static struct nvmem_config imx_ocotp_nvm + .stride = 1, + .reg_read = imx_ocotp_read, + .reg_write = imx_ocotp_write, ++ .cell_post_process = imx_ocotp_cell_pp, + }; + + static const struct ocotp_params imx6q_params = { +@@ -530,6 +551,7 @@ static const struct ocotp_params imx8mq_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mm_params = { +@@ -537,6 +559,7 @@ static const struct ocotp_params imx8mm_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mn_params = { +@@ -544,6 +567,7 @@ static const struct ocotp_params imx8mn_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mp_params = { +@@ -551,6 +575,7 @@ static const struct ocotp_params imx8mp_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_8MP, ++ .reverse_mac_address = true, + }; + + static const struct of_device_id imx_ocotp_dt_ids[] = { diff --git a/target/linux/mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch b/target/linux/generic/backport-5.10/807-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch similarity index 100% rename from target/linux/mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch rename to target/linux/generic/backport-5.10/807-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch diff --git a/target/linux/generic/backport-5.10/807-v5.17-0003-nvmem-core-Fix-a-conflict-between-MTD-and-NVMEM-on-w.patch b/target/linux/generic/backport-5.10/807-v5.17-0003-nvmem-core-Fix-a-conflict-between-MTD-and-NVMEM-on-w.patch new file mode 100644 index 00000000000..a9ef3e27e03 --- /dev/null +++ b/target/linux/generic/backport-5.10/807-v5.17-0003-nvmem-core-Fix-a-conflict-between-MTD-and-NVMEM-on-w.patch @@ -0,0 +1,68 @@ +From f6c052afe6f802d87c74153b7a57c43b2e9faf07 Mon Sep 17 00:00:00 2001 +From: Christophe Kerello +Date: Sun, 20 Feb 2022 15:14:31 +0000 +Subject: [PATCH] nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios + property + +Wp-gpios property can be used on NVMEM nodes and the same property can +be also used on MTD NAND nodes. In case of the wp-gpios property is +defined at NAND level node, the GPIO management is done at NAND driver +level. Write protect is disabled when the driver is probed or resumed +and is enabled when the driver is released or suspended. + +When no partitions are defined in the NAND DT node, then the NAND DT node +will be passed to NVMEM framework. If wp-gpios property is defined in +this node, the GPIO resource is taken twice and the NAND controller +driver fails to probe. + +It would be possible to set config->wp_gpio at MTD level before calling +nvmem_register function but NVMEM framework will toggle this GPIO on +each write when this GPIO should only be controlled at NAND level driver +to ensure that the Write Protect has not been enabled. + +A way to fix this conflict is to add a new boolean flag in nvmem_config +named ignore_wp. In case ignore_wp is set, the GPIO resource will +be managed by the provider. + +Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin") +Cc: stable@vger.kernel.org +Signed-off-by: Christophe Kerello +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151432.16605-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 2 +- + include/linux/nvmem-provider.h | 4 +++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -771,7 +771,7 @@ struct nvmem_device *nvmem_register(cons + + if (config->wp_gpio) + nvmem->wp_gpio = config->wp_gpio; +- else ++ else if (!config->ignore_wp) + nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp", + GPIOD_OUT_HIGH); + if (IS_ERR(nvmem->wp_gpio)) { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -70,7 +70,8 @@ struct nvmem_keepout { + * @word_size: Minimum read/write access granularity. + * @stride: Minimum read/write access stride. + * @priv: User context passed to read/write callbacks. +- * @wp-gpio: Write protect pin ++ * @wp-gpio: Write protect pin ++ * @ignore_wp: Write Protect pin is managed by the provider. + * + * Note: A default "nvmem" name will be assigned to the device if + * no name is specified in its configuration. In such case "" is +@@ -92,6 +93,7 @@ struct nvmem_config { + enum nvmem_type type; + bool read_only; + bool root_only; ++ bool ignore_wp; + struct device_node *of_node; + bool no_of_node; + nvmem_reg_read_t reg_read; diff --git a/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch b/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch new file mode 100644 index 00000000000..2005493dc06 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch @@ -0,0 +1,72 @@ +From 190fae468592bc2f0efc8b928920f8f712b5831e Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:15 +0000 +Subject: [PATCH] nvmem: core: Remove unused devm_nvmem_unregister() + +There are no users and seems no will come of the devm_nvmem_unregister(). +Remove the function and remove the unused devm_nvmem_match() along with it. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 ---------------------- + include/linux/nvmem-provider.h | 8 -------- + 2 files changed, 30 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -945,28 +945,6 @@ struct nvmem_device *devm_nvmem_register + } + EXPORT_SYMBOL_GPL(devm_nvmem_register); + +-static int devm_nvmem_match(struct device *dev, void *res, void *data) +-{ +- struct nvmem_device **r = res; +- +- return *r == data; +-} +- +-/** +- * devm_nvmem_unregister() - Unregister previously registered managed nvmem +- * device. +- * +- * @dev: Device that uses the nvmem device. +- * @nvmem: Pointer to previously registered nvmem device. +- * +- * Return: Will be negative on error or zero on success. +- */ +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return devres_release(dev, devm_nvmem_release, devm_nvmem_match, nvmem); +-} +-EXPORT_SYMBOL(devm_nvmem_unregister); +- + static struct nvmem_device *__nvmem_device_get(void *data, + int (*match)(struct device *dev, const void *data)) + { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -135,8 +135,6 @@ void nvmem_unregister(struct nvmem_devic + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *cfg); + +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem); +- + void nvmem_add_cell_table(struct nvmem_cell_table *table); + void nvmem_del_cell_table(struct nvmem_cell_table *table); + +@@ -155,12 +153,6 @@ devm_nvmem_register(struct device *dev, + return nvmem_register(c); + } + +-static inline int +-devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return -EOPNOTSUPP; +-} +- + static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {} + static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {} + diff --git a/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch b/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch new file mode 100644 index 00000000000..01a1cdb2b34 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch @@ -0,0 +1,58 @@ +From 5825b2c6762611e67ccaf3ccf64485365a120f0b Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:16 +0000 +Subject: [PATCH] nvmem: core: Use devm_add_action_or_reset() + +Slightly simplify the devm_nvmem_register() by using the +devm_add_action_or_reset(). + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 +++++++++------------- + 1 file changed, 9 insertions(+), 13 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -907,9 +907,9 @@ void nvmem_unregister(struct nvmem_devic + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + +-static void devm_nvmem_release(struct device *dev, void *res) ++static void devm_nvmem_unregister(void *nvmem) + { +- nvmem_unregister(*(struct nvmem_device **)res); ++ nvmem_unregister(nvmem); + } + + /** +@@ -926,20 +926,16 @@ static void devm_nvmem_release(struct de + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *config) + { +- struct nvmem_device **ptr, *nvmem; +- +- ptr = devres_alloc(devm_nvmem_release, sizeof(*ptr), GFP_KERNEL); +- if (!ptr) +- return ERR_PTR(-ENOMEM); ++ struct nvmem_device *nvmem; ++ int ret; + + nvmem = nvmem_register(config); ++ if (IS_ERR(nvmem)) ++ return nvmem; + +- if (!IS_ERR(nvmem)) { +- *ptr = nvmem; +- devres_add(dev, ptr); +- } else { +- devres_free(ptr); +- } ++ ret = devm_add_action_or_reset(dev, devm_nvmem_unregister, nvmem); ++ if (ret) ++ return ERR_PTR(ret); + + return nvmem; + } diff --git a/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch b/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch new file mode 100644 index 00000000000..3a806fe6223 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch @@ -0,0 +1,30 @@ +From 8c751e0d9a5264376935a84429a2d468c8877d99 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:17 +0000 +Subject: [PATCH] nvmem: core: Check input parameter for NULL in + nvmem_unregister() + +nvmem_unregister() frees resources and standard pattern is to allow +caller to not care if it's NULL or not. This will reduce burden on +the callers to perform this check. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -903,7 +903,8 @@ static void nvmem_device_release(struct + */ + void nvmem_unregister(struct nvmem_device *nvmem) + { +- kref_put(&nvmem->refcnt, nvmem_device_release); ++ if (nvmem) ++ kref_put(&nvmem->refcnt, nvmem_device_release); + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + diff --git a/target/linux/generic/backport-5.10/808-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch b/target/linux/generic/backport-5.10/808-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch new file mode 100644 index 00000000000..c98f8e9d545 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch @@ -0,0 +1,29 @@ +From 05196facc052385960028ac634447ecf6c764ec3 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Sun, 20 Feb 2022 15:15:18 +0000 +Subject: [PATCH] nvmem: qfprom: fix kerneldoc warning + +This patch fixes below kernel doc warning, +warning: expecting prototype for qfprom_efuse_reg_write(). +Prototype was for qfprom_reg_write() instead + +No code changes. + +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -244,7 +244,7 @@ err_clk_prepared: + } + + /** +- * qfprom_efuse_reg_write() - Write to fuses. ++ * qfprom_reg_write() - Write to fuses. + * @context: Our driver data. + * @reg: The offset to write at. + * @_val: Pointer to data to write. diff --git a/target/linux/generic/backport-5.10/808-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch b/target/linux/generic/backport-5.10/808-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch new file mode 100644 index 00000000000..6aad6af0800 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch @@ -0,0 +1,38 @@ +From 07ae4fde9efada7878e1383d6ccc7da70315ca23 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 20 Feb 2022 15:15:20 +0000 +Subject: [PATCH] nvmem: sunxi_sid: Add support for D1 variant + +D1 has a smaller eFuse block than some other recent SoCs, and it no +longer requires a workaround to read the eFuse data. + +Signed-off-by: Samuel Holland +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunxi_sid.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -184,6 +184,11 @@ static const struct sunxi_sid_cfg sun8i_ + .need_register_readout = true, + }; + ++static const struct sunxi_sid_cfg sun20i_d1_cfg = { ++ .value_offset = 0x200, ++ .size = 0x100, ++}; ++ + static const struct sunxi_sid_cfg sun50i_a64_cfg = { + .value_offset = 0x200, + .size = 0x100, +@@ -200,6 +205,7 @@ static const struct of_device_id sunxi_s + { .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg }, + { .compatible = "allwinner,sun8i-a83t-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_cfg }, ++ { .compatible = "allwinner,sun20i-d1-sid", .data = &sun20i_d1_cfg }, + { .compatible = "allwinner,sun50i-a64-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h5-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h6-sid", .data = &sun50i_h6_cfg }, diff --git a/target/linux/generic/backport-5.10/808-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch b/target/linux/generic/backport-5.10/808-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch new file mode 100644 index 00000000000..a73b42c5de3 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch @@ -0,0 +1,28 @@ +From 4dc8d89faed9bb05f116fa1794fc955b14910386 Mon Sep 17 00:00:00 2001 +From: Xiaoke Wang +Date: Sun, 20 Feb 2022 15:15:21 +0000 +Subject: [PATCH] nvmem: meson-mx-efuse: replace unnecessary devm_kstrdup() + +Replace unnecessary devm_kstrdup() so to avoid redundant memory allocation. + +Suggested-by: Martin Blumenstingl +Signed-off-by: Xiaoke Wang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/meson-mx-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/meson-mx-efuse.c ++++ b/drivers/nvmem/meson-mx-efuse.c +@@ -209,8 +209,7 @@ static int meson_mx_efuse_probe(struct p + if (IS_ERR(efuse->base)) + return PTR_ERR(efuse->base); + +- efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name, +- GFP_KERNEL); ++ efuse->config.name = drvdata->name; + efuse->config.owner = THIS_MODULE; + efuse->config.dev = &pdev->dev; + efuse->config.priv = efuse; diff --git a/target/linux/generic/backport-5.10/808-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch b/target/linux/generic/backport-5.10/808-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch new file mode 100644 index 00000000000..6afb68b3f91 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch @@ -0,0 +1,139 @@ +From f78451012b9e159afdba31c3eb69f223a9f42adc Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Sun, 20 Feb 2022 15:15:23 +0000 +Subject: [PATCH] nvmem: add driver for Layerscape SFP (Security Fuse + Processor) + +Add support for the Security Fuse Processor found on Layerscape SoCs. +This driver implements basic read access. + +Signed-off-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 +++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/layerscape-sfp.c | 89 ++++++++++++++++++++++++++++++++++ + 3 files changed, 103 insertions(+) + create mode 100644 drivers/nvmem/layerscape-sfp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -300,4 +300,16 @@ config NVMEM_BRCM_NVRAM + This driver provides support for Broadcom's NVRAM that can be accessed + using I/O mapping. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. + nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o + nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o +--- /dev/null ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -0,0 +1,89 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Layerscape SFP driver ++ * ++ * Copyright (c) 2022 Michael Walle ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 ++ ++struct layerscape_sfp_priv { ++ void __iomem *base; ++}; ++ ++struct layerscape_sfp_data { ++ int size; ++}; ++ ++static int layerscape_sfp_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct layerscape_sfp_priv *priv = context; ++ ++ memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, ++ bytes); ++ ++ return 0; ++} ++ ++static struct nvmem_config layerscape_sfp_nvmem_config = { ++ .name = "fsl-sfp", ++ .reg_read = layerscape_sfp_read, ++}; ++ ++static int layerscape_sfp_probe(struct platform_device *pdev) ++{ ++ const struct layerscape_sfp_data *data; ++ struct layerscape_sfp_priv *priv; ++ struct nvmem_device *nvmem; ++ ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(priv->base)) ++ return PTR_ERR(priv->base); ++ ++ data = device_get_match_data(&pdev->dev); ++ ++ layerscape_sfp_nvmem_config.size = data->size; ++ layerscape_sfp_nvmem_config.dev = &pdev->dev; ++ layerscape_sfp_nvmem_config.priv = priv; ++ ++ nvmem = devm_nvmem_register(&pdev->dev, &layerscape_sfp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct layerscape_sfp_data ls1028a_data = { ++ .size = 0x88, ++}; ++ ++static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, layerscape_sfp_dt_ids); ++ ++static struct platform_driver layerscape_sfp_driver = { ++ .probe = layerscape_sfp_probe, ++ .driver = { ++ .name = "layerscape_sfp", ++ .of_match_table = layerscape_sfp_dt_ids, ++ }, ++}; ++module_platform_driver(layerscape_sfp_driver); ++ ++MODULE_AUTHOR("Michael Walle "); ++MODULE_DESCRIPTION("Layerscape Security Fuse Processor driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/808-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch b/target/linux/generic/backport-5.10/808-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch new file mode 100644 index 00000000000..74bd4a7eb67 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch @@ -0,0 +1,32 @@ +From bc5c75e0a5a9400f81a987cc720100ac475fa4d8 Mon Sep 17 00:00:00 2001 +From: Knox Chiou +Date: Wed, 23 Feb 2022 22:35:00 +0000 +Subject: [PATCH] nvmem: qfprom: Increase fuse blow timeout to prevent write + fail + +sc7180 blow fuses got slightly chances to hit qfprom_reg_write timeout. +Current timeout is simply too low. Since blowing fuses is a +very rare operation, so the risk associated with overestimating this +number is low. +Increase fuse blow timeout from 1ms to 10ms. + +Reviewed-by: Douglas Anderson +Signed-off-by: Knox Chiou +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -22,7 +22,7 @@ + + /* Amount of time required to hold charge to blow fuse in micro-seconds */ + #define QFPROM_FUSE_BLOW_POLL_US 100 +-#define QFPROM_FUSE_BLOW_TIMEOUT_US 1000 ++#define QFPROM_FUSE_BLOW_TIMEOUT_US 10000 + + #define QFPROM_BLOW_STATUS_OFFSET 0x048 + #define QFPROM_BLOW_STATUS_BUSY 0x1 diff --git a/target/linux/generic/backport-5.10/808-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.10/808-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch new file mode 100644 index 00000000000..9520140a673 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -0,0 +1,277 @@ +From 8747ec2e9762ed9ae53b3a590938f454b6a1abdf Mon Sep 17 00:00:00 2001 +From: Vincent Shih +Date: Wed, 23 Feb 2022 22:35:01 +0000 +Subject: [PATCH] nvmem: Add driver for OCOTP in Sunplus SP7021 + +Add driver for OCOTP in Sunplus SP7021 + +Signed-off-by: Vincent Shih +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 5 + + drivers/nvmem/Kconfig | 12 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/sunplus-ocotp.c | 228 ++++++++++++++++++++++++++++++++++ + 4 files changed, 247 insertions(+) + create mode 100644 drivers/nvmem/sunplus-ocotp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -312,4 +312,16 @@ config NVMEM_LAYERSCAPE_SFP + This driver can also be built as a module. If so, the module + will be called layerscape-sfp. + ++config NVMEM_SUNPLUS_OCOTP ++ tristate "Sunplus SoC OTP support" ++ depends on SOC_SP7021 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the On-chip OTP controller (OCOTP) available ++ on Sunplus SoCs. It provides access to 128 bytes of one-time ++ programmable eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-sunplus-ocotp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -63,3 +63,5 @@ obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_ + nvmem_brcm_nvram-y := brcm_nvram.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o ++obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o +--- /dev/null ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -0,0 +1,228 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/* ++ * The OCOTP driver for Sunplus SP7021 ++ * ++ * Copyright (C) 2019 Sunplus Technology Inc., All rights reserved. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * OTP memory ++ * Each bank contains 4 words (32 bits). ++ * Bank 0 starts at offset 0 from the base. ++ */ ++ ++#define OTP_WORDS_PER_BANK 4 ++#define OTP_WORD_SIZE sizeof(u32) ++#define OTP_BIT_ADDR_OF_BANK (8 * OTP_WORD_SIZE * OTP_WORDS_PER_BANK) ++#define QAC628_OTP_NUM_BANKS 8 ++#define QAC628_OTP_SIZE (QAC628_OTP_NUM_BANKS * OTP_WORDS_PER_BANK * OTP_WORD_SIZE) ++#define OTP_READ_TIMEOUT_US 200000 ++ ++/* HB_GPIO */ ++#define ADDRESS_8_DATA 0x20 ++ ++/* OTP_RX */ ++#define OTP_CONTROL_2 0x48 ++#define OTP_RD_PERIOD GENMASK(15, 8) ++#define OTP_RD_PERIOD_MASK ~GENMASK(15, 8) ++#define CPU_CLOCK FIELD_PREP(OTP_RD_PERIOD, 30) ++#define SEL_BAK_KEY2 BIT(5) ++#define SEL_BAK_KEY2_MASK ~BIT(5) ++#define SW_TRIM_EN BIT(4) ++#define SW_TRIM_EN_MASK ~BIT(4) ++#define SEL_BAK_KEY BIT(3) ++#define SEL_BAK_KEY_MASK ~BIT(3) ++#define OTP_READ BIT(2) ++#define OTP_LOAD_SECURE_DATA BIT(1) ++#define OTP_LOAD_SECURE_DATA_MASK ~BIT(1) ++#define OTP_DO_CRC BIT(0) ++#define OTP_DO_CRC_MASK ~BIT(0) ++#define OTP_STATUS 0x4c ++#define OTP_READ_DONE BIT(4) ++#define OTP_READ_DONE_MASK ~BIT(4) ++#define OTP_LOAD_SECURE_DONE_MASK ~BIT(2) ++#define OTP_READ_ADDRESS 0x50 ++ ++enum base_type { ++ HB_GPIO, ++ OTPRX, ++ BASEMAX, ++}; ++ ++struct sp_ocotp_priv { ++ struct device *dev; ++ void __iomem *base[BASEMAX]; ++ struct clk *clk; ++}; ++ ++struct sp_ocotp_data { ++ int size; ++}; ++ ++const struct sp_ocotp_data sp_otp_v0 = { ++ .size = QAC628_OTP_SIZE, ++}; ++ ++static int sp_otp_read_real(struct sp_ocotp_priv *otp, int addr, char *value) ++{ ++ unsigned int addr_data; ++ unsigned int byte_shift; ++ unsigned int status; ++ int ret; ++ ++ addr_data = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr_data = addr_data / OTP_WORD_SIZE; ++ ++ byte_shift = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ byte_shift = byte_shift % OTP_WORD_SIZE; ++ ++ addr = addr / (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr = addr * OTP_BIT_ADDR_OF_BANK; ++ ++ writel(readl(otp->base[OTPRX] + OTP_STATUS) & OTP_READ_DONE_MASK & ++ OTP_LOAD_SECURE_DONE_MASK, otp->base[OTPRX] + OTP_STATUS); ++ writel(addr, otp->base[OTPRX] + OTP_READ_ADDRESS); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) | OTP_READ, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) & SEL_BAK_KEY2_MASK & SW_TRIM_EN_MASK ++ & SEL_BAK_KEY_MASK & OTP_LOAD_SECURE_DATA_MASK & OTP_DO_CRC_MASK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel((readl(otp->base[OTPRX] + OTP_CONTROL_2) & OTP_RD_PERIOD_MASK) | CPU_CLOCK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ ++ ret = readl_poll_timeout(otp->base[OTPRX] + OTP_STATUS, status, ++ status & OTP_READ_DONE, 10, OTP_READ_TIMEOUT_US); ++ ++ if (ret < 0) ++ return ret; ++ ++ *value = (readl(otp->base[HB_GPIO] + ADDRESS_8_DATA + addr_data * OTP_WORD_SIZE) ++ >> (8 * byte_shift)) & 0xff; ++ ++ return ret; ++} ++ ++static int sp_ocotp_read(void *priv, unsigned int offset, void *value, size_t bytes) ++{ ++ struct sp_ocotp_priv *otp = priv; ++ unsigned int addr; ++ char *buf = value; ++ char val[4]; ++ int ret; ++ ++ ret = clk_enable(otp->clk); ++ if (ret) ++ return ret; ++ ++ *buf = 0; ++ for (addr = offset; addr < (offset + bytes); addr++) { ++ ret = sp_otp_read_real(otp, addr, val); ++ if (ret < 0) { ++ dev_err(otp->dev, "OTP read fail:%d at %d", ret, addr); ++ goto disable_clk; ++ } ++ ++ *buf++ = *val; ++ } ++ ++disable_clk: ++ clk_disable(otp->clk); ++ ++ return ret; ++} ++ ++static struct nvmem_config sp_ocotp_nvmem_config = { ++ .name = "sp-ocotp", ++ .read_only = true, ++ .word_size = 1, ++ .size = QAC628_OTP_SIZE, ++ .stride = 1, ++ .reg_read = sp_ocotp_read, ++ .owner = THIS_MODULE, ++}; ++ ++static int sp_ocotp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct sp_ocotp_priv *otp; ++ struct resource *res; ++ int ret; ++ ++ otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hb_gpio"); ++ otp->base[HB_GPIO] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[HB_GPIO])) ++ return PTR_ERR(otp->base[HB_GPIO]); ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otprx"); ++ otp->base[OTPRX] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[OTPRX])) ++ return PTR_ERR(otp->base[OTPRX]); ++ ++ otp->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(otp->clk)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(otp->clk), ++ "devm_clk_get fail\n"); ++ ++ ret = clk_prepare(otp->clk); ++ if (ret < 0) { ++ dev_err(dev, "failed to prepare clk: %d\n", ret); ++ return ret; ++ } ++ ++ sp_ocotp_nvmem_config.priv = otp; ++ sp_ocotp_nvmem_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &sp_ocotp_nvmem_config); ++ if (IS_ERR(nvmem)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(nvmem), ++ "register nvmem device fail\n"); ++ ++ platform_set_drvdata(pdev, nvmem); ++ ++ dev_dbg(dev, "banks:%d x wpb:%d x wsize:%d = %d", ++ (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, ++ (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); ++ ++ dev_info(dev, "by Sunplus (C) 2020"); ++ ++ return 0; ++} ++ ++static const struct of_device_id sp_ocotp_dt_ids[] = { ++ { .compatible = "sunplus,sp7021-ocotp", .data = &sp_otp_v0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, sp_ocotp_dt_ids); ++ ++static struct platform_driver sp_otp_driver = { ++ .probe = sp_ocotp_probe, ++ .driver = { ++ .name = "sunplus,sp7021-ocotp", ++ .of_match_table = sp_ocotp_dt_ids, ++ } ++}; ++module_platform_driver(sp_otp_driver); ++ ++MODULE_AUTHOR("Vincent Shih "); ++MODULE_DESCRIPTION("Sunplus On-Chip OTP driver"); ++MODULE_LICENSE("GPL"); ++ diff --git a/target/linux/bcm53xx/patches-5.10/081-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch b/target/linux/generic/backport-5.10/808-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.10/081-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch rename to target/linux/generic/backport-5.10/808-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch diff --git a/target/linux/generic/backport-5.10/809-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch b/target/linux/generic/backport-5.10/809-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch new file mode 100644 index 00000000000..ef3107db946 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch @@ -0,0 +1,32 @@ +From 6bd0ffeaa389866089e9573b2298ae58d6359b75 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:24 +0100 +Subject: [PATCH] nvmem: bcm-ocotp: mark ACPI device ID table as maybe unused +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +"bcm_otpc_acpi_ids" is used with ACPI_PTR, so a build with !CONFIG_ACPI +has a warning: + + drivers/nvmem/bcm-ocotp.c:247:36: error: + ‘bcm_otpc_acpi_ids’ defined but not used [-Werror=unused-const-variable=] + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-1-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/bcm-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/bcm-ocotp.c ++++ b/drivers/nvmem/bcm-ocotp.c +@@ -244,7 +244,7 @@ static const struct of_device_id bcm_otp + }; + MODULE_DEVICE_TABLE(of, bcm_otpc_dt_ids); + +-static const struct acpi_device_id bcm_otpc_acpi_ids[] = { ++static const struct acpi_device_id bcm_otpc_acpi_ids[] __maybe_unused = { + { .id = "BRCM0700", .driver_data = (kernel_ulong_t)&otp_map }, + { .id = "BRCM0701", .driver_data = (kernel_ulong_t)&otp_map_v2 }, + { /* sentinel */ } diff --git a/target/linux/generic/backport-5.10/809-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch b/target/linux/generic/backport-5.10/809-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch new file mode 100644 index 00000000000..a84d2316f0c --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch @@ -0,0 +1,30 @@ +From 1066f8156351fcd997125257cea47cf805ba4f6d Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:25 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: staticize sp_otp_v0 + +The "sp_otp_v0" file scope variable is not used outside, so make it +static to fix warning: + + drivers/nvmem/sunplus-ocotp.c:74:29: sparse: + sparse: symbol 'sp_otp_v0' was not declared. Should it be static? + +Reported-by: kernel test robot +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-2-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -71,7 +71,7 @@ struct sp_ocotp_data { + int size; + }; + +-const struct sp_ocotp_data sp_otp_v0 = { ++static const struct sp_ocotp_data sp_otp_v0 = { + .size = QAC628_OTP_SIZE, + }; + diff --git a/target/linux/generic/backport-5.10/809-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch b/target/linux/generic/backport-5.10/809-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch new file mode 100644 index 00000000000..886ebc12a9c --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch @@ -0,0 +1,27 @@ +From 874dfbcf219ccc42a2cbd187d087c7db82c3024b Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:26 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: drop useless probe confirmation + +Printing probe success is discouraged, because we can use tracing for +this purpose. Remove useless print message after Sunplus OCOTP driver +probe. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-3-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -202,8 +202,6 @@ static int sp_ocotp_probe(struct platfor + (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, + (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); + +- dev_info(dev, "by Sunplus (C) 2020"); +- + return 0; + } + diff --git a/target/linux/generic/backport-5.15/803-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch b/target/linux/generic/backport-5.10/809-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch similarity index 95% rename from target/linux/generic/backport-5.15/803-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch rename to target/linux/generic/backport-5.10/809-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch index 1acc6947fe1..3b1e76147a8 100644 --- a/target/linux/generic/backport-5.15/803-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch +++ b/target/linux/generic/backport-5.10/809-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch @@ -21,7 +21,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -462,6 +462,7 @@ static int nvmem_cell_info_to_nvmem_cell +@@ -467,6 +467,7 @@ static int nvmem_cell_info_to_nvmem_cell cell->bit_offset = info->bit_offset; cell->nbits = info->nbits; diff --git a/target/linux/bcm53xx/patches-5.10/082-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.10/809-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.10/082-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.10/809-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch diff --git a/target/linux/generic/backport-5.10/809-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch b/target/linux/generic/backport-5.10/809-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch new file mode 100644 index 00000000000..ebeb6f5ad39 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch @@ -0,0 +1,130 @@ +From b6b7ef932ae838209254f016ecf8862d716a5ced Mon Sep 17 00:00:00 2001 +From: Sven Peter +Date: Fri, 29 Apr 2022 17:26:50 +0100 +Subject: [PATCH] nvmem: Add Apple eFuse driver + +Apple SoCs contain eFuses used to store factory-programmed data such +as calibration values for the PCIe or the Type-C PHY. They are organized +as 32bit values exposed as MMIO. + +Signed-off-by: Sven Peter +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 ++++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/apple-efuses.c | 80 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 94 insertions(+) + create mode 100644 drivers/nvmem/apple-efuses.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -324,4 +324,16 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -65,3 +65,5 @@ obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nv + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o + nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o +--- /dev/null ++++ b/drivers/nvmem/apple-efuses.c +@@ -0,0 +1,80 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Apple SoC eFuse driver ++ * ++ * Copyright (C) The Asahi Linux Contributors ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct apple_efuses_priv { ++ void __iomem *fuses; ++}; ++ ++static int apple_efuses_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct apple_efuses_priv *priv = context; ++ u32 *dst = val; ++ ++ while (bytes >= sizeof(u32)) { ++ *dst++ = readl_relaxed(priv->fuses + offset); ++ bytes -= sizeof(u32); ++ offset += sizeof(u32); ++ } ++ ++ return 0; ++} ++ ++static int apple_efuses_probe(struct platform_device *pdev) ++{ ++ struct apple_efuses_priv *priv; ++ struct resource *res; ++ struct nvmem_config config = { ++ .dev = &pdev->dev, ++ .read_only = true, ++ .reg_read = apple_efuses_read, ++ .stride = sizeof(u32), ++ .word_size = sizeof(u32), ++ .name = "apple_efuses_nvmem", ++ .id = NVMEM_DEVID_AUTO, ++ .root_only = true, ++ }; ++ ++ priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->fuses = devm_platform_get_and_ioremap_resource(pdev, 0, &res); ++ if (IS_ERR(priv->fuses)) ++ return PTR_ERR(priv->fuses); ++ ++ config.priv = priv; ++ config.size = resource_size(res); ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(config.dev, &config)); ++} ++ ++static const struct of_device_id apple_efuses_of_match[] = { ++ { .compatible = "apple,efuses", }, ++ {} ++}; ++ ++MODULE_DEVICE_TABLE(of, apple_efuses_of_match); ++ ++static struct platform_driver apple_efuses_driver = { ++ .driver = { ++ .name = "apple_efuses", ++ .of_match_table = apple_efuses_of_match, ++ }, ++ .probe = apple_efuses_probe, ++}; ++ ++module_platform_driver(apple_efuses_driver); ++ ++MODULE_AUTHOR("Sven Peter "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/809-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch b/target/linux/generic/backport-5.10/809-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch new file mode 100644 index 00000000000..cd51d970069 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch @@ -0,0 +1,31 @@ +From 517f6e2641a2802dce5a5aa0d18c7d37a35678d2 Mon Sep 17 00:00:00 2001 +From: Minghao Chi +Date: Fri, 29 Apr 2022 17:26:54 +0100 +Subject: [PATCH] nvmem: qfprom: using pm_runtime_resume_and_get instead of + pm_runtime_get_sync + +Using pm_runtime_resume_and_get is more appropriate +for simplifing code + +Reported-by: Zeal Robot +Signed-off-by: Minghao Chi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -217,9 +217,8 @@ static int qfprom_enable_fuse_blowing(co + goto err_clk_rate_set; + } + +- ret = pm_runtime_get_sync(priv->dev); ++ ret = pm_runtime_resume_and_get(priv->dev); + if (ret < 0) { +- pm_runtime_put_noidle(priv->dev); + dev_err(priv->dev, "Failed to enable power-domain\n"); + goto err_reg_enable; + } diff --git a/target/linux/generic/backport-5.10/809-v5.19-0008-nvmem-sfp-Use-regmap.patch b/target/linux/generic/backport-5.10/809-v5.19-0008-nvmem-sfp-Use-regmap.patch new file mode 100644 index 00000000000..e187238ca38 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0008-nvmem-sfp-Use-regmap.patch @@ -0,0 +1,109 @@ +From 943eadbdb11314b41eacbcc484dfb7f93e271ff4 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:00 +0100 +Subject: [PATCH] nvmem: sfp: Use regmap + +This converts the SFP driver to use regmap. This will allow easily +supporting devices with different endians. We disallow byte-level +access, as regmap_bulk_read doesn't support it (and it's unclear what +the correct result would be when we have an endianness difference). + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-16-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + drivers/nvmem/layerscape-sfp.c | 30 ++++++++++++++++++++++-------- + 2 files changed, 23 insertions(+), 8 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -304,6 +304,7 @@ config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST + depends on HAS_IOMEM ++ select REGMAP_MMIO + help + This driver provides support to read the eFuses on Freescale + Layerscape SoC's. For example, the vendor provides a per part +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -13,15 +13,17 @@ + #include + #include + #include ++#include + + #define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 + + struct layerscape_sfp_priv { +- void __iomem *base; ++ struct regmap *regmap; + }; + + struct layerscape_sfp_data { + int size; ++ enum regmap_endian endian; + }; + + static int layerscape_sfp_read(void *context, unsigned int offset, void *val, +@@ -29,15 +31,16 @@ static int layerscape_sfp_read(void *con + { + struct layerscape_sfp_priv *priv = context; + +- memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, +- bytes); +- +- return 0; ++ return regmap_bulk_read(priv->regmap, ++ LAYERSCAPE_SFP_OTP_OFFSET + offset, val, ++ bytes / 4); + } + + static struct nvmem_config layerscape_sfp_nvmem_config = { + .name = "fsl-sfp", + .reg_read = layerscape_sfp_read, ++ .word_size = 4, ++ .stride = 4, + }; + + static int layerscape_sfp_probe(struct platform_device *pdev) +@@ -45,16 +48,26 @@ static int layerscape_sfp_probe(struct p + const struct layerscape_sfp_data *data; + struct layerscape_sfp_priv *priv; + struct nvmem_device *nvmem; ++ struct regmap_config config = { 0 }; ++ void __iomem *base; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +- priv->base = devm_platform_ioremap_resource(pdev, 0); +- if (IS_ERR(priv->base)) +- return PTR_ERR(priv->base); ++ base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); + + data = device_get_match_data(&pdev->dev); ++ config.reg_bits = 32; ++ config.reg_stride = 4; ++ config.val_bits = 32; ++ config.val_format_endian = data->endian; ++ config.max_register = LAYERSCAPE_SFP_OTP_OFFSET + data->size - 4; ++ priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, &config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); + + layerscape_sfp_nvmem_config.size = data->size; + layerscape_sfp_nvmem_config.dev = &pdev->dev; +@@ -67,6 +80,7 @@ static int layerscape_sfp_probe(struct p + + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, ++ .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { diff --git a/target/linux/generic/backport-5.10/809-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch b/target/linux/generic/backport-5.10/809-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch new file mode 100644 index 00000000000..ee000986181 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch @@ -0,0 +1,38 @@ +From 33a1c6618677fe33f8e84cb7bedc45abbce89a50 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:01 +0100 +Subject: [PATCH] nvmem: sfp: Add support for TA 2.1 devices + +This adds support for Trust Architecture (TA) 2.1 devices to the SFP driver. +There are few differences between TA 2.1 and TA 3.0, especially for +read-only support, so just re-use the existing data. + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-17-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/layerscape-sfp.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -78,12 +78,18 @@ static int layerscape_sfp_probe(struct p + return PTR_ERR_OR_ZERO(nvmem); + } + ++static const struct layerscape_sfp_data ls1021a_data = { ++ .size = 0x88, ++ .endian = REGMAP_ENDIAN_BIG, ++}; ++ + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, + .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1021a-sfp", .data = &ls1021a_data }, + { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, + {}, + }; diff --git a/target/linux/generic/backport-5.10/810-v6.0-0001-nvmem-microchip-otpc-add-support.patch b/target/linux/generic/backport-5.10/810-v6.0-0001-nvmem-microchip-otpc-add-support.patch new file mode 100644 index 00000000000..eb99ec190cb --- /dev/null +++ b/target/linux/generic/backport-5.10/810-v6.0-0001-nvmem-microchip-otpc-add-support.patch @@ -0,0 +1,389 @@ +From 98830350d3fc824c1ff5c338140fe20f041a5916 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Wed, 6 Jul 2022 11:06:22 +0100 +Subject: [PATCH] nvmem: microchip-otpc: add support + +Add support for Microchip OTP controller available on SAMA7G5. The OTPC +controls the access to a non-volatile memory. The memory behind OTPC is +organized into packets, packets are composed by a fixed length header +(4 bytes long) and a variable length payload (payload length is available +in the header). When software request the data at an offset in memory +the OTPC will return (via header + data registers) the whole packet that +has a word at that offset. For the OTP memory layout like below: + +offset OTP Memory layout + + . . + . ... . + . . +0x0E +-----------+ <--- packet X + | header X | +0x12 +-----------+ + | payload X | +0x16 | | + | | +0x1A | | + +-----------+ + . . + . ... . + . . + +if user requests data at address 0x16 the data started at 0x0E will be +returned by controller. User will be able to fetch the whole packet +starting at 0x0E (or parts of the packet) via proper registers. The same +packet will be returned if software request the data at offset 0x0E or +0x12 or 0x1A. + +The OTP will be populated by Microchip with at least 2 packets first one +being boot configuration packet and the 2nd one being temperature +calibration packet. The packet order will be preserved b/w different chip +revisions but the packet sizes may change. + +For the above reasons and to keep the same software able to work on all +chip variants the read function of the driver is working with a packet +id instead of an offset in OTP memory. + +Signed-off-by: Claudiu Beznea +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 8 + + drivers/nvmem/Kconfig | 7 + + drivers/nvmem/Makefile | 2 + + drivers/nvmem/microchip-otpc.c | 288 +++++++++++++++++++++++++++++++++ + 4 files changed, 305 insertions(+) + create mode 100644 drivers/nvmem/microchip-otpc.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -11565,6 +11565,14 @@ S: Supported + F: Documentation/devicetree/bindings/mtd/atmel-nand.txt + F: drivers/mtd/nand/raw/atmel/* + ++MICROCHIP OTPC DRIVER ++M: Claudiu Beznea ++L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) ++S: Supported ++F: Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml ++F: drivers/nvmem/microchip-otpc.c ++F: dt-bindings/nvmem/microchip,sama7g5-otpc.h ++ + MICROCHIP PWM DRIVER + M: Claudiu Beznea + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -107,6 +107,13 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + ++config MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. ++ + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" + depends on WII || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -67,3 +67,5 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o +--- /dev/null ++++ b/drivers/nvmem/microchip-otpc.c +@@ -0,0 +1,288 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * OTP Memory controller ++ * ++ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries ++ * ++ * Author: Claudiu Beznea ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MCHP_OTPC_CR (0x0) ++#define MCHP_OTPC_CR_READ BIT(6) ++#define MCHP_OTPC_MR (0x4) ++#define MCHP_OTPC_MR_ADDR GENMASK(31, 16) ++#define MCHP_OTPC_AR (0x8) ++#define MCHP_OTPC_SR (0xc) ++#define MCHP_OTPC_SR_READ BIT(6) ++#define MCHP_OTPC_HR (0x20) ++#define MCHP_OTPC_HR_SIZE GENMASK(15, 8) ++#define MCHP_OTPC_DR (0x24) ++ ++#define MCHP_OTPC_NAME "mchp-otpc" ++#define MCHP_OTPC_SIZE (11 * 1024) ++ ++/** ++ * struct mchp_otpc - OTPC private data structure ++ * @base: base address ++ * @dev: struct device pointer ++ * @packets: list of packets in OTP memory ++ * @npackets: number of packets in OTP memory ++ */ ++struct mchp_otpc { ++ void __iomem *base; ++ struct device *dev; ++ struct list_head packets; ++ u32 npackets; ++}; ++ ++/** ++ * struct mchp_otpc_packet - OTPC packet data structure ++ * @list: list head ++ * @id: packet ID ++ * @offset: packet offset (in words) in OTP memory ++ */ ++struct mchp_otpc_packet { ++ struct list_head list; ++ u32 id; ++ u32 offset; ++}; ++ ++static struct mchp_otpc_packet *mchp_otpc_id_to_packet(struct mchp_otpc *otpc, ++ u32 id) ++{ ++ struct mchp_otpc_packet *packet; ++ ++ if (id >= otpc->npackets) ++ return NULL; ++ ++ list_for_each_entry(packet, &otpc->packets, list) { ++ if (packet->id == id) ++ return packet; ++ } ++ ++ return NULL; ++} ++ ++static int mchp_otpc_prepare_read(struct mchp_otpc *otpc, ++ unsigned int offset) ++{ ++ u32 tmp; ++ ++ /* Set address. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_MR); ++ tmp &= ~MCHP_OTPC_MR_ADDR; ++ tmp |= FIELD_PREP(MCHP_OTPC_MR_ADDR, offset); ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_MR); ++ ++ /* Set read. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_CR); ++ tmp |= MCHP_OTPC_CR_READ; ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_CR); ++ ++ /* Wait for packet to be transferred into temporary buffers. */ ++ return read_poll_timeout(readl_relaxed, tmp, !(tmp & MCHP_OTPC_SR_READ), ++ 10000, 2000, false, otpc->base + MCHP_OTPC_SR); ++} ++ ++/* ++ * OTPC memory is organized into packets. Each packets contains a header and ++ * a payload. Header is 4 bytes long and contains the size of the payload. ++ * Payload size varies. The memory footprint is something as follows: ++ * ++ * Memory offset Memory footprint Packet ID ++ * ------------- ---------------- --------- ++ * ++ * 0x0 +------------+ <-- packet 0 ++ * | header 0 | ++ * 0x4 +------------+ ++ * | payload 0 | ++ * . . ++ * . ... . ++ * . . ++ * offset1 +------------+ <-- packet 1 ++ * | header 1 | ++ * offset1 + 0x4 +------------+ ++ * | payload 1 | ++ * . . ++ * . ... . ++ * . . ++ * offset2 +------------+ <-- packet 2 ++ * . . ++ * . ... . ++ * . . ++ * offsetN +------------+ <-- packet N ++ * | header N | ++ * offsetN + 0x4 +------------+ ++ * | payload N | ++ * . . ++ * . ... . ++ * . . ++ * +------------+ ++ * ++ * where offset1, offset2, offsetN depends on the size of payload 0, payload 1, ++ * payload N-1. ++ * ++ * The access to memory is done on a per packet basis: the control registers ++ * need to be updated with an offset address (within a packet range) and the ++ * data registers will be update by controller with information contained by ++ * that packet. E.g. if control registers are updated with any address within ++ * the range [offset1, offset2) the data registers are updated by controller ++ * with packet 1. Header data is accessible though MCHP_OTPC_HR register. ++ * Payload data is accessible though MCHP_OTPC_DR and MCHP_OTPC_AR registers. ++ * There is no direct mapping b/w the offset requested by software and the ++ * offset returned by hardware. ++ * ++ * For this, the read function will return the first requested bytes in the ++ * packet. The user will have to be aware of the memory footprint before doing ++ * the read request. ++ */ ++static int mchp_otpc_read(void *priv, unsigned int off, void *val, ++ size_t bytes) ++{ ++ struct mchp_otpc *otpc = priv; ++ struct mchp_otpc_packet *packet; ++ u32 *buf = val; ++ u32 offset; ++ size_t len = 0; ++ int ret, payload_size; ++ ++ /* ++ * We reach this point with off being multiple of stride = 4 to ++ * be able to cross the subsystem. Inside the driver we use continuous ++ * unsigned integer numbers for packet id, thus devide off by 4 ++ * before passing it to mchp_otpc_id_to_packet(). ++ */ ++ packet = mchp_otpc_id_to_packet(otpc, off / 4); ++ if (!packet) ++ return -EINVAL; ++ offset = packet->offset; ++ ++ while (len < bytes) { ++ ret = mchp_otpc_prepare_read(otpc, offset); ++ if (ret) ++ return ret; ++ ++ /* Read and save header content. */ ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ len += sizeof(*buf); ++ offset++; ++ if (len >= bytes) ++ break; ++ ++ /* Read and save payload content. */ ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, *(buf - 1)); ++ writel_relaxed(0UL, otpc->base + MCHP_OTPC_AR); ++ do { ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_DR); ++ len += sizeof(*buf); ++ offset++; ++ payload_size--; ++ } while (payload_size >= 0 && len < bytes); ++ } ++ ++ return 0; ++} ++ ++static int mchp_otpc_init_packets_list(struct mchp_otpc *otpc, u32 *size) ++{ ++ struct mchp_otpc_packet *packet; ++ u32 word, word_pos = 0, id = 0, npackets = 0, payload_size; ++ int ret; ++ ++ INIT_LIST_HEAD(&otpc->packets); ++ *size = 0; ++ ++ while (*size < MCHP_OTPC_SIZE) { ++ ret = mchp_otpc_prepare_read(otpc, word_pos); ++ if (ret) ++ return ret; ++ ++ word = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, word); ++ if (!payload_size) ++ break; ++ ++ packet = devm_kzalloc(otpc->dev, sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ ++ packet->id = id++; ++ packet->offset = word_pos; ++ INIT_LIST_HEAD(&packet->list); ++ list_add_tail(&packet->list, &otpc->packets); ++ ++ /* Count size by adding header and paload sizes. */ ++ *size += 4 * (payload_size + 1); ++ /* Next word: this packet (header, payload) position + 1. */ ++ word_pos += payload_size + 2; ++ ++ npackets++; ++ } ++ ++ otpc->npackets = npackets; ++ ++ return 0; ++} ++ ++static struct nvmem_config mchp_nvmem_config = { ++ .name = MCHP_OTPC_NAME, ++ .type = NVMEM_TYPE_OTP, ++ .read_only = true, ++ .word_size = 4, ++ .stride = 4, ++ .reg_read = mchp_otpc_read, ++}; ++ ++static int mchp_otpc_probe(struct platform_device *pdev) ++{ ++ struct nvmem_device *nvmem; ++ struct mchp_otpc *otpc; ++ u32 size; ++ int ret; ++ ++ otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); ++ if (!otpc) ++ return -ENOMEM; ++ ++ otpc->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otpc->base)) ++ return PTR_ERR(otpc->base); ++ ++ otpc->dev = &pdev->dev; ++ ret = mchp_otpc_init_packets_list(otpc, &size); ++ if (ret) ++ return ret; ++ ++ mchp_nvmem_config.dev = otpc->dev; ++ mchp_nvmem_config.size = size; ++ mchp_nvmem_config.priv = otpc; ++ nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id __maybe_unused mchp_otpc_ids[] = { ++ { .compatible = "microchip,sama7g5-otpc", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, mchp_otpc_ids); ++ ++static struct platform_driver mchp_otpc_driver = { ++ .probe = mchp_otpc_probe, ++ .driver = { ++ .name = MCHP_OTPC_NAME, ++ .of_match_table = of_match_ptr(mchp_otpc_ids), ++ }, ++}; ++module_platform_driver(mchp_otpc_driver); ++ ++MODULE_AUTHOR("Claudiu Beznea "); ++MODULE_DESCRIPTION("Microchip SAMA7G5 OTPC driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/810-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch b/target/linux/generic/backport-5.10/810-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch new file mode 100644 index 00000000000..6a4126b9ded --- /dev/null +++ b/target/linux/generic/backport-5.10/810-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch @@ -0,0 +1,32 @@ +From f5c97da8037b18d1256a58459fa96ed68e50fb41 Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Wed, 6 Jul 2022 11:06:27 +0100 +Subject: [PATCH] nvmem: mtk-efuse: Simplify with + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +No functional changes. + +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/mtk-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -41,8 +41,7 @@ static int mtk_efuse_probe(struct platfo + if (!priv) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->base = devm_ioremap_resource(dev, res); ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + diff --git a/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch b/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch new file mode 100644 index 00000000000..4d7ad9bba75 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch @@ -0,0 +1,52 @@ +From bd1244561fa2a4531ded40dbf09c9599084f8b29 Mon Sep 17 00:00:00 2001 +From: Gaosheng Cui +Date: Fri, 16 Sep 2022 13:04:02 +0100 +Subject: [PATCH] nvmem: core: Fix memleak in nvmem_register() + +dev_set_name will alloc memory for nvmem->dev.kobj.name in +nvmem_register, when nvmem_validate_keepouts failed, nvmem's +memory will be freed and return, but nobody will free memory +for nvmem->dev.kobj.name, there will be memleak, so moving +nvmem_validate_keepouts() after device_register() and let +the device core deal with cleaning name in error cases. + +Fixes: de0534df9347 ("nvmem: core: fix error handling while validating keepout regions") +Cc: stable@vger.kernel.org +Signed-off-by: Gaosheng Cui +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916120402.38753-1-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -829,21 +829,18 @@ struct nvmem_device *nvmem_register(cons + nvmem->dev.groups = nvmem_dev_groups; + #endif + +- if (nvmem->nkeepout) { +- rval = nvmem_validate_keepouts(nvmem); +- if (rval) { +- ida_free(&nvmem_ida, nvmem->id); +- kfree(nvmem); +- return ERR_PTR(rval); +- } +- } +- + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); + + rval = device_register(&nvmem->dev); + if (rval) + goto err_put_device; + ++ if (nvmem->nkeepout) { ++ rval = nvmem_validate_keepouts(nvmem); ++ if (rval) ++ goto err_device_del; ++ } ++ + if (config->compat) { + rval = nvmem_sysfs_setup_compat(nvmem, config); + if (rval) diff --git a/target/linux/generic/backport-5.10/801-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch b/target/linux/generic/backport-5.10/811-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch similarity index 90% rename from target/linux/generic/backport-5.10/801-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch rename to target/linux/generic/backport-5.10/811-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch index 1459d1184eb..9138807bc91 100644 --- a/target/linux/generic/backport-5.10/801-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch @@ -1,6 +1,6 @@ -From f955dc14450695564926711cf9fa8e1d5d854302 Mon Sep 17 00:00:00 2001 +From d5542923f200f95bddf524f36fd495f78aa28e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 15 Jun 2022 21:43:00 +0200 +Date: Fri, 16 Sep 2022 13:20:48 +0100 Subject: [PATCH] nvmem: add driver handling U-Boot environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -22,16 +22,24 @@ Kernel-parsed NVMEM cells can be read however by Linux drivers. This may be useful for Ethernet drivers for reading device MAC address which is often stored as U-Boot env variable. -Signed-off-by: Rafał Miłecki Reviewed-by: Ahmad Fatoum +Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- + MAINTAINERS | 1 + + drivers/nvmem/Kconfig | 13 +++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/u-boot-env.c | 218 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 234 insertions(+) + create mode 100644 drivers/nvmem/u-boot-env.c --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -270,4 +270,17 @@ config SPRD_EFUSE - This driver can also be built as a module. If so, the module - will be called nvmem-sprd-efuse. +@@ -344,4 +344,17 @@ config NVMEM_APPLE_EFUSES + This driver can also be built as a module. If so, the module will + be called nvmem-apple-efuses. +config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" @@ -49,10 +57,10 @@ Signed-off-by: Srinivas Kandagatla endif --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile -@@ -55,3 +55,5 @@ obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynq - nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o - obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o - nvmem_sprd_efuse-y := sprd-efuse.o +@@ -69,3 +69,5 @@ obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvme + nvmem-apple-efuses-y := apple-efuses.o + obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o +obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +nvmem_u-boot-env-y := u-boot-env.o --- /dev/null diff --git a/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch b/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch new file mode 100644 index 00000000000..34a28fa6fe3 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch @@ -0,0 +1,47 @@ +From 5544e90c81261e82e02bbf7c6015a4b9c8c825ef Mon Sep 17 00:00:00 2001 +From: Gaosheng Cui +Date: Fri, 16 Sep 2022 13:20:50 +0100 +Subject: [PATCH] nvmem: core: add error handling for dev_set_name + +The type of return value of dev_set_name is int, which may return +wrong result, so we add error handling for it to reclaim memory +of nvmem resource, and return early when an error occurs. + +Signed-off-by: Gaosheng Cui +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -810,18 +810,24 @@ struct nvmem_device *nvmem_register(cons + + switch (config->id) { + case NVMEM_DEVID_NONE: +- dev_set_name(&nvmem->dev, "%s", config->name); ++ rval = dev_set_name(&nvmem->dev, "%s", config->name); + break; + case NVMEM_DEVID_AUTO: +- dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); ++ rval = dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); + break; + default: +- dev_set_name(&nvmem->dev, "%s%d", ++ rval = dev_set_name(&nvmem->dev, "%s%d", + config->name ? : "nvmem", + config->name ? config->id : nvmem->id); + break; + } + ++ if (rval) { ++ ida_free(&nvmem_ida, nvmem->id); ++ kfree(nvmem); ++ return ERR_PTR(rval); ++ } ++ + nvmem->read_only = device_property_present(config->dev, "read-only") || + config->read_only || !nvmem->reg_write; + diff --git a/target/linux/generic/backport-5.10/811-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch b/target/linux/generic/backport-5.10/811-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch new file mode 100644 index 00000000000..48ad63fab5f --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch @@ -0,0 +1,29 @@ +From d3524bb5b9a0c567b853a0024526afe87dde01ed Mon Sep 17 00:00:00 2001 +From: Kenneth Lee +Date: Fri, 16 Sep 2022 13:20:52 +0100 +Subject: [PATCH] nvmem: brcm_nvram: Use kzalloc for allocating only one + element + +Use kzalloc(...) rather than kcalloc(1, ...) because the number of +elements we are specifying in this case is 1, so kzalloc would +accomplish the same thing and we can simplify. + +Signed-off-by: Kenneth Lee +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/brcm_nvram.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/brcm_nvram.c ++++ b/drivers/nvmem/brcm_nvram.c +@@ -96,7 +96,7 @@ static int brcm_nvram_parse(struct brcm_ + + len = le32_to_cpu(header.len); + +- data = kcalloc(1, len, GFP_KERNEL); ++ data = kzalloc(len, GFP_KERNEL); + memcpy_fromio(data, priv->base, len); + data[len - 1] = '\0'; + diff --git a/target/linux/generic/backport-5.10/811-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch b/target/linux/generic/backport-5.10/811-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch new file mode 100644 index 00000000000..a3d256d5c7a --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch @@ -0,0 +1,270 @@ +From 28fc7c986f01fdcfd28af648be2597624cac0e27 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:54 +0100 +Subject: [PATCH] nvmem: prefix all symbols with NVMEM_ +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This unifies all NVMEM symbols. They follow one style now. + +Reviewed-by: Matthias Brugger +Acked-by: Arnd Bergmann +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/configs/multi_v7_defconfig | 6 +++--- + arch/arm/configs/qcom_defconfig | 2 +- + arch/arm64/configs/defconfig | 10 +++++----- + arch/mips/configs/ci20_defconfig | 2 +- + drivers/cpufreq/Kconfig.arm | 2 +- + drivers/nvmem/Kconfig | 24 ++++++++++++------------ + drivers/nvmem/Makefile | 24 ++++++++++++------------ + drivers/soc/mediatek/Kconfig | 2 +- + drivers/thermal/qcom/Kconfig | 2 +- + 9 files changed, 37 insertions(+), 37 deletions(-) + +--- a/arch/arm/configs/multi_v7_defconfig ++++ b/arch/arm/configs/multi_v7_defconfig +@@ -1085,10 +1085,10 @@ CONFIG_OMAP_USB2=y + CONFIG_TI_PIPE3=y + CONFIG_TWL4030_USB=m + CONFIG_NVMEM_IMX_OCOTP=y +-CONFIG_ROCKCHIP_EFUSE=m ++CONFIG_NVMEM_ROCKCHIP_EFUSE=m + CONFIG_NVMEM_SUNXI_SID=y + CONFIG_NVMEM_VF610_OCOTP=y +-CONFIG_MESON_MX_EFUSE=m ++CONFIG_NVMEM_MESON_MX_EFUSE=m + CONFIG_FSI=m + CONFIG_FSI_MASTER_GPIO=m + CONFIG_FSI_MASTER_HUB=m +--- a/arch/arm/configs/qcom_defconfig ++++ b/arch/arm/configs/qcom_defconfig +@@ -257,7 +257,7 @@ CONFIG_PHY_QCOM_APQ8064_SATA=y + CONFIG_PHY_QCOM_IPQ806X_SATA=y + CONFIG_PHY_QCOM_USB_HS=y + CONFIG_PHY_QCOM_USB_HSIC=y +-CONFIG_QCOM_QFPROM=y ++CONFIG_NVMEM_QCOM_QFPROM=y + CONFIG_INTERCONNECT=y + CONFIG_INTERCONNECT_QCOM=y + CONFIG_INTERCONNECT_QCOM_MSM8974=m +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -1022,11 +1022,11 @@ CONFIG_QCOM_L2_PMU=y + CONFIG_QCOM_L3_PMU=y + CONFIG_NVMEM_IMX_OCOTP=y + CONFIG_NVMEM_IMX_OCOTP_SCU=y +-CONFIG_QCOM_QFPROM=y +-CONFIG_ROCKCHIP_EFUSE=y ++CONFIG_NVMEM_QCOM_QFPROM=y ++CONFIG_NVMEM_ROCKCHIP_EFUSE=y + CONFIG_NVMEM_SUNXI_SID=y +-CONFIG_UNIPHIER_EFUSE=y +-CONFIG_MESON_EFUSE=m ++CONFIG_NVMEM_UNIPHIER_EFUSE=y ++CONFIG_NVMEM_MESON_EFUSE=m + CONFIG_FPGA=y + CONFIG_FPGA_MGR_STRATIX10_SOC=m + CONFIG_FPGA_BRIDGE=m +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -131,7 +131,7 @@ config ARM_OMAP2PLUS_CPUFREQ + config ARM_QCOM_CPUFREQ_NVMEM + tristate "Qualcomm nvmem based CPUFreq" + depends on ARCH_QCOM +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on QCOM_SMEM + select PM_OPP + help +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -52,7 +52,7 @@ config NVMEM_IMX_OCOTP_SCU + This is a driver for the SCU On-Chip OTP Controller (OCOTP) + available on i.MX8 SoCs. + +-config JZ4780_EFUSE ++config NVMEM_JZ4780_EFUSE + tristate "JZ4780 EFUSE Memory Support" + depends on MACH_INGENIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -96,7 +96,7 @@ config NVMEM_MXS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-mxs-ocotp. + +-config MTK_EFUSE ++config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on HAS_IOMEM +@@ -107,7 +107,7 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config MICROCHIP_OTPC ++config NVMEM_MICROCHIP_OTPC + tristate "Microchip OTPC support" + depends on ARCH_AT91 || COMPILE_TEST + help +@@ -126,7 +126,7 @@ config NVMEM_NINTENDO_OTP + This driver can also be built as a module. If so, the module + will be called nvmem-nintendo-otp. + +-config QCOM_QFPROM ++config NVMEM_QCOM_QFPROM + tristate "QCOM QFPROM Support" + depends on ARCH_QCOM || COMPILE_TEST + depends on HAS_IOMEM +@@ -145,7 +145,7 @@ config NVMEM_SPMI_SDAM + Qualcomm Technologies, Inc. PMICs. It provides the clients + an interface to read/write to the SDAM module's shared memory. + +-config ROCKCHIP_EFUSE ++config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -156,7 +156,7 @@ config ROCKCHIP_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_efuse. + +-config ROCKCHIP_OTP ++config NVMEM_ROCKCHIP_OTP + tristate "Rockchip OTP controller support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -199,7 +199,7 @@ config NVMEM_SUNXI_SID + This driver can also be built as a module. If so, the module + will be called nvmem_sunxi_sid. + +-config UNIPHIER_EFUSE ++config NVMEM_UNIPHIER_EFUSE + tristate "UniPhier SoCs eFuse support" + depends on ARCH_UNIPHIER || COMPILE_TEST + depends on HAS_IOMEM +@@ -221,7 +221,7 @@ config NVMEM_VF610_OCOTP + This driver can also be build as a module. If so, the module will + be called nvmem-vf610-ocotp. + +-config MESON_EFUSE ++config NVMEM_MESON_EFUSE + tristate "Amlogic Meson GX eFuse Support" + depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +@@ -231,7 +231,7 @@ config MESON_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_meson_efuse. + +-config MESON_MX_EFUSE ++config NVMEM_MESON_MX_EFUSE + tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" + depends on ARCH_MESON || COMPILE_TEST + help +@@ -251,13 +251,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config RAVE_SP_EEPROM ++config NVMEM_RAVE_SP_EEPROM + tristate "Rave SP EEPROM Support" + depends on RAVE_SP_CORE + help + Say y here to enable Rave SP EEPROM support. + +-config SC27XX_EFUSE ++config NVMEM_SC27XX_EFUSE + tristate "Spreadtrum SC27XX eFuse Support" + depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -278,7 +278,7 @@ config NVMEM_ZYNQMP + + If sure, say yes. If unsure, say no. + +-config SPRD_EFUSE ++config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" + depends on ARCH_SPRD || COMPILE_TEST + depends on HAS_IOMEM +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -15,7 +15,7 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-i + nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o + nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +@@ -25,37 +25,37 @@ obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-m + nvmem-mxs-ocotp-y := mxs-ocotp.o + obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o + nvmem-nintendo-otp-y := nintendo-otp.o +-obj-$(CONFIG_MTK_EFUSE) += nvmem_mtk-efuse.o ++obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o + nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o + nvmem_qfprom-y := qfprom.o + obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o + nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o +-obj-$(CONFIG_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o + nvmem_rockchip_efuse-y := rockchip-efuse.o +-obj-$(CONFIG_ROCKCHIP_OTP) += nvmem-rockchip-otp.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o + nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o + nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o + nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o + nvmem-uniphier-efuse-y := uniphier-efuse.o + obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o + nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_MESON_EFUSE) += nvmem_meson_efuse.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o + nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o + nvmem_meson_mx_efuse-y := meson-mx-efuse.o + obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o + nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o + nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o +-obj-$(CONFIG_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o + nvmem-sc27xx-efuse-y := sc27xx-efuse.o + obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o + nvmem_sprd_efuse-y := sprd-efuse.o + obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o + nvmem-rmem-y := rmem.o +@@ -67,7 +67,7 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o + nvmem_u-boot-env-y := u-boot-env.o +--- a/drivers/thermal/qcom/Kconfig ++++ b/drivers/thermal/qcom/Kconfig +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config QCOM_TSENS + tristate "Qualcomm TSENS Temperature Alarm" +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on ARCH_QCOM || COMPILE_TEST + help + This enables the thermal sysfs driver for the TSENS device. It shows diff --git a/target/linux/generic/backport-5.10/811-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch b/target/linux/generic/backport-5.10/811-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch new file mode 100644 index 00000000000..4e45524bffc --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch @@ -0,0 +1,535 @@ +From a06d9e5a63b7c2f622c908cd9600ce735e70f7c6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:55 +0100 +Subject: [PATCH] nvmem: sort config symbols alphabetically +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Match what most subsystems do +2. Simplify maintenance a bit +3. Reduce amount of conflicts for new drivers patches + +While at it unify indent level in Makefile. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 300 +++++++++++++++++++++-------------------- + drivers/nvmem/Makefile | 114 ++++++++-------- + 2 files changed, 208 insertions(+), 206 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -21,6 +21,40 @@ config NVMEM_SYSFS + This interface is mostly used by userspace applications to + read/write directly into nvmem. + ++# Devices ++ ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ ++config NVMEM_BCM_OCOTP ++ tristate "Broadcom On-Chip OTP Controller support" ++ depends on ARCH_BCM_IPROC || COMPILE_TEST ++ depends on HAS_IOMEM ++ default ARCH_BCM_IPROC ++ help ++ Say y here to enable read/write access to the Broadcom OTP ++ controller. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-bcm-ocotp. ++ ++config NVMEM_BRCM_NVRAM ++ tristate "Broadcom's NVRAM support" ++ depends on ARCH_BCM_5301X || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support for Broadcom's NVRAM that can be accessed ++ using I/O mapping. ++ + config NVMEM_IMX_IIM + tristate "i.MX IC Identification Module support" + depends on ARCH_MXC || COMPILE_TEST +@@ -64,6 +98,19 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ select REGMAP_MMIO ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + config NVMEM_LPC18XX_EEPROM + tristate "NXP LPC18XX EEPROM Memory Support" + depends on ARCH_LPC18XX || COMPILE_TEST +@@ -84,17 +131,32 @@ config NVMEM_LPC18XX_OTP + To compile this driver as a module, choose M here: the module + will be called nvmem_lpc18xx_otp. + +-config NVMEM_MXS_OCOTP +- tristate "Freescale MXS On-Chip OTP Memory Support" +- depends on ARCH_MXS || COMPILE_TEST +- depends on HAS_IOMEM ++config NVMEM_MESON_EFUSE ++ tristate "Amlogic Meson GX eFuse Support" ++ depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +- If you say Y here, you will get readonly access to the +- One Time Programmable memory pages that are stored +- on the Freescale i.MX23/i.MX28 processor. ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson GX SoCs. + + This driver can also be built as a module. If so, the module +- will be called nvmem-mxs-ocotp. ++ will be called nvmem_meson_efuse. ++ ++config NVMEM_MESON_MX_EFUSE ++ tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" ++ depends on ARCH_MESON || COMPILE_TEST ++ help ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_meson_mx_efuse. ++ ++config NVMEM_MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" +@@ -107,12 +169,17 @@ config NVMEM_MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config NVMEM_MICROCHIP_OTPC +- tristate "Microchip OTPC support" +- depends on ARCH_AT91 || COMPILE_TEST ++config NVMEM_MXS_OCOTP ++ tristate "Freescale MXS On-Chip OTP Memory Support" ++ depends on ARCH_MXS || COMPILE_TEST ++ depends on HAS_IOMEM + help +- This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ If you say Y here, you will get readonly access to the ++ One Time Programmable memory pages that are stored ++ on the Freescale i.MX23/i.MX28 processor. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-mxs-ocotp. + + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" +@@ -137,13 +204,21 @@ config NVMEM_QCOM_QFPROM + This driver can also be built as a module. If so, the module + will be called nvmem_qfprom. + +-config NVMEM_SPMI_SDAM +- tristate "SPMI SDAM Support" +- depends on SPMI ++config NVMEM_RAVE_SP_EEPROM ++ tristate "Rave SP EEPROM Support" ++ depends on RAVE_SP_CORE + help +- This driver supports the Shared Direct Access Memory Module on +- Qualcomm Technologies, Inc. PMICs. It provides the clients +- an interface to read/write to the SDAM module's shared memory. ++ Say y here to enable Rave SP EEPROM support. ++ ++config NVMEM_RMEM ++ tristate "Reserved Memory Based Driver Support" ++ depends on HAS_IOMEM ++ help ++ This driver maps reserved memory into an nvmem device. It might be ++ useful to expose information left by firmware in memory. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-rmem. + + config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" +@@ -167,79 +242,16 @@ config NVMEM_ROCKCHIP_OTP + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_otp. + +-config NVMEM_BCM_OCOTP +- tristate "Broadcom On-Chip OTP Controller support" +- depends on ARCH_BCM_IPROC || COMPILE_TEST +- depends on HAS_IOMEM +- default ARCH_BCM_IPROC +- help +- Say y here to enable read/write access to the Broadcom OTP +- controller. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-bcm-ocotp. +- +-config NVMEM_STM32_ROMEM +- tristate "STMicroelectronics STM32 factory-programmed memory support" +- depends on ARCH_STM32 || COMPILE_TEST +- help +- Say y here to enable read-only access for STMicroelectronics STM32 +- factory-programmed memory area. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-stm32-romem. +- +-config NVMEM_SUNXI_SID +- tristate "Allwinner SoCs SID support" +- depends on ARCH_SUNXI +- help +- This is a driver for the 'security ID' available on various Allwinner +- devices. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_sunxi_sid. +- +-config NVMEM_UNIPHIER_EFUSE +- tristate "UniPhier SoCs eFuse support" +- depends on ARCH_UNIPHIER || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of UniPhier SoC +- from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-uniphier-efuse. +- +-config NVMEM_VF610_OCOTP +- tristate "VF610 SoC OCOTP support" +- depends on SOC_VF610 || COMPILE_TEST ++config NVMEM_SC27XX_EFUSE ++ tristate "Spreadtrum SC27XX eFuse Support" ++ depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM + help +- This is a driver for the 'OCOTP' peripheral available on Vybrid +- devices like VF5xx and VF6xx. +- +- This driver can also be build as a module. If so, the module will +- be called nvmem-vf610-ocotp. +- +-config NVMEM_MESON_EFUSE +- tristate "Amlogic Meson GX eFuse Support" +- depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson GX SoCs. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_meson_efuse. +- +-config NVMEM_MESON_MX_EFUSE +- tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" +- depends on ARCH_MESON || COMPILE_TEST +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ This is a simple driver to dump specified values of Spreadtrum ++ SC27XX PMICs from eFuse. + + This driver can also be built as a module. If so, the module +- will be called nvmem_meson_mx_efuse. ++ will be called nvmem-sc27xx-efuse. + + config NVMEM_SNVS_LPGPR + tristate "Support for Low Power General Purpose Register" +@@ -251,32 +263,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config NVMEM_RAVE_SP_EEPROM +- tristate "Rave SP EEPROM Support" +- depends on RAVE_SP_CORE +- help +- Say y here to enable Rave SP EEPROM support. +- +-config NVMEM_SC27XX_EFUSE +- tristate "Spreadtrum SC27XX eFuse Support" +- depends on MFD_SC27XX_PMIC || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of Spreadtrum +- SC27XX PMICs from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-sc27xx-efuse. +- +-config NVMEM_ZYNQMP +- bool "Xilinx ZYNQMP SoC nvmem firmware support" +- depends on ARCH_ZYNQMP ++config NVMEM_SPMI_SDAM ++ tristate "SPMI SDAM Support" ++ depends on SPMI + help +- This is a driver to access hardware related data like +- soc revision, IDCODE... etc by using the firmware +- interface. +- +- If sure, say yes. If unsure, say no. ++ This driver supports the Shared Direct Access Memory Module on ++ Qualcomm Technologies, Inc. PMICs. It provides the clients ++ an interface to read/write to the SDAM module's shared memory. + + config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" +@@ -289,36 +282,15 @@ config NVMEM_SPRD_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem-sprd-efuse. + +-config NVMEM_RMEM +- tristate "Reserved Memory Based Driver Support" +- depends on HAS_IOMEM +- help +- This driver maps reserved memory into an nvmem device. It might be +- useful to expose information left by firmware in memory. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-rmem. +- +-config NVMEM_BRCM_NVRAM +- tristate "Broadcom's NVRAM support" +- depends on ARCH_BCM_5301X || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This driver provides support for Broadcom's NVRAM that can be accessed +- using I/O mapping. +- +-config NVMEM_LAYERSCAPE_SFP +- tristate "Layerscape SFP (Security Fuse Processor) support" +- depends on ARCH_LAYERSCAPE || COMPILE_TEST +- depends on HAS_IOMEM +- select REGMAP_MMIO ++config NVMEM_STM32_ROMEM ++ tristate "STMicroelectronics STM32 factory-programmed memory support" ++ depends on ARCH_STM32 || COMPILE_TEST + help +- This driver provides support to read the eFuses on Freescale +- Layerscape SoC's. For example, the vendor provides a per part +- unique ID there. ++ Say y here to enable read-only access for STMicroelectronics STM32 ++ factory-programmed memory area. + + This driver can also be built as a module. If so, the module +- will be called layerscape-sfp. ++ will be called nvmem-stm32-romem. + + config NVMEM_SUNPLUS_OCOTP + tristate "Sunplus SoC OTP support" +@@ -332,17 +304,15 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + +-config NVMEM_APPLE_EFUSES +- tristate "Apple eFuse support" +- depends on ARCH_APPLE || COMPILE_TEST +- default ARCH_APPLE ++config NVMEM_SUNXI_SID ++ tristate "Allwinner SoCs SID support" ++ depends on ARCH_SUNXI + help +- Say y here to enable support for reading eFuses on Apple SoCs +- such as the M1. These are e.g. used to store factory programmed +- calibration data required for the PCIe or the USB-C PHY. ++ This is a driver for the 'security ID' available on various Allwinner ++ devices. + +- This driver can also be built as a module. If so, the module will +- be called nvmem-apple-efuses. ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_sunxi_sid. + + config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" +@@ -357,4 +327,36 @@ config NVMEM_U_BOOT_ENV + + If compiled as module it will be called nvmem_u-boot-env. + ++config NVMEM_UNIPHIER_EFUSE ++ tristate "UniPhier SoCs eFuse support" ++ depends on ARCH_UNIPHIER || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a simple driver to dump specified values of UniPhier SoC ++ from eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-uniphier-efuse. ++ ++config NVMEM_VF610_OCOTP ++ tristate "VF610 SoC OCOTP support" ++ depends on SOC_VF610 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the 'OCOTP' peripheral available on Vybrid ++ devices like VF5xx and VF6xx. ++ ++ This driver can also be build as a module. If so, the module will ++ be called nvmem-vf610-ocotp. ++ ++config NVMEM_ZYNQMP ++ bool "Xilinx ZYNQMP SoC nvmem firmware support" ++ depends on ARCH_ZYNQMP ++ help ++ This is a driver to access hardware related data like ++ soc revision, IDCODE... etc by using the firmware ++ interface. ++ ++ If sure, say yes. If unsure, say no. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -7,67 +7,67 @@ obj-$(CONFIG_NVMEM) += nvmem_core.o + nvmem_core-y := core.o + + # Devices +-obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o +-nvmem-bcm-ocotp-y := bcm-ocotp.o +-obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o +-nvmem-imx-iim-y := imx-iim.o +-obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o +-nvmem-imx-ocotp-y := imx-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o ++nvmem-bcm-ocotp-y := bcm-ocotp.o ++obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o ++nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o ++nvmem-imx-iim-y := imx-iim.o ++obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o ++nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o +-nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o +-nvmem_jz4780_efuse-y := jz4780-efuse.o ++nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +-nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +-obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o +-nvmem_lpc18xx_otp-y := lpc18xx_otp.o +-obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o +-nvmem-mxs-ocotp-y := mxs-ocotp.o +-obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o +-nvmem-nintendo-otp-y := nintendo-otp.o ++nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o ++obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o ++nvmem_lpc18xx_otp-y := lpc18xx_otp.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o ++nvmem_meson_efuse-y := meson-efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++nvmem_meson_mx_efuse-y := meson-mx-efuse.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o +-nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o +-nvmem_qfprom-y := qfprom.o +-obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o +-nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++nvmem_mtk-efuse-y := mtk-efuse.o ++obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o ++nvmem-mxs-ocotp-y := mxs-ocotp.o ++obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o ++nvmem-nintendo-otp-y := nintendo-otp.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o ++nvmem_qfprom-y := qfprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o ++nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o +-nvmem_rockchip_efuse-y := rockchip-efuse.o ++nvmem_rockchip_efuse-y := rockchip-efuse.o + obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o +-nvmem-rockchip-otp-y := rockchip-otp.o +-obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o +-nvmem_stm32_romem-y := stm32-romem.o +-obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o +-nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o +-nvmem-uniphier-efuse-y := uniphier-efuse.o +-obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o +-nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o +-nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o +-nvmem_meson_mx_efuse-y := meson-mx-efuse.o +-obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o +-nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o +-nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o +-nvmem-sc27xx-efuse-y := sc27xx-efuse.o +-obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o +-nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o +-nvmem_sprd_efuse-y := sprd-efuse.o +-obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o +-nvmem-rmem-y := rmem.o +-obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o +-nvmem_brcm_nvram-y := brcm_nvram.o +-obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o +-nvmem-layerscape-sfp-y := layerscape-sfp.o ++nvmem-sc27xx-efuse-y := sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o ++nvmem_snvs_lpgpr-y := snvs_lpgpr.o ++obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o ++nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o ++nvmem_sprd_efuse-y := sprd-efuse.o ++obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o ++nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o +-nvmem_sunplus_ocotp-y := sunplus-ocotp.o +-obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o +-nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o +-nvmem-microchip-otpc-y := microchip-otpc.o +-obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +-nvmem_u-boot-env-y := u-boot-env.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o ++nvmem_sunxi_sid-y := sunxi_sid.o ++obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o ++nvmem_u-boot-env-y := u-boot-env.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++nvmem-uniphier-efuse-y := uniphier-efuse.o ++obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o ++nvmem-vf610-ocotp-y := vf610-ocotp.o ++obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o ++nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o diff --git a/target/linux/generic/backport-5.15/802-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.10/811-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 79% rename from target/linux/generic/backport-5.15/802-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.10/811-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch index 3a6b76a221e..e0a082adc45 100644 --- a/target/linux/generic/backport-5.15/802-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch @@ -1,6 +1,6 @@ -From d69efcf951df4dcc74a0e1554969c533aec8aa9b Mon Sep 17 00:00:00 2001 +From d4d432670f7dee0a5432fcffcfc8699b25181ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 15 Sep 2022 22:06:29 +0200 +Date: Fri, 16 Sep 2022 13:20:57 +0100 Subject: [PATCH] nvmem: u-boot-env: find Device Tree nodes for NVMEM cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -13,6 +13,8 @@ This allows NVMEM consumers to use U-Boot environment variables. Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-11-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/backport-5.10/811-v6.1-0008-nvmem-lan9662-otp-add-support.patch b/target/linux/generic/backport-5.10/811-v6.1-0008-nvmem-lan9662-otp-add-support.patch new file mode 100644 index 00000000000..945c6128ff4 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0008-nvmem-lan9662-otp-add-support.patch @@ -0,0 +1,274 @@ +From 9e8f208ad5229ddda97cd4a83ecf89c735d99592 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 16 Sep 2022 13:20:59 +0100 +Subject: [PATCH] nvmem: lan9662-otp: add support + +Add support for OTP controller available on LAN9662. The OTPC controls +the access to a non-volatile memory. The size of the memory is 8KB. +The OTPC can access the memory based on an offset. +Implement both the read and the write functionality. + +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-13-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 8 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/lan9662-otpc.c | 222 +++++++++++++++++++++++++++++++++++ + 3 files changed, 232 insertions(+) + create mode 100644 drivers/nvmem/lan9662-otpc.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -98,6 +98,14 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAN9662_OTPC ++ tristate "Microchip LAN9662 OTP controller support" ++ depends on SOC_LAN966 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver enables the OTP controller available on Microchip LAN9662 ++ SoCs. It controls the access to the OTP memory connected to it. ++ + config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -21,6 +21,8 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvm + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o + obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAN9662_OTPC) += nvmem-lan9662-otpc.o ++nvmem-lan9662-otpc-y := lan9662-otpc.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +--- /dev/null ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -0,0 +1,222 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define OTP_OTP_PWR_DN(t) (t + 0x00) ++#define OTP_OTP_PWR_DN_OTP_PWRDN_N BIT(0) ++#define OTP_OTP_ADDR_HI(t) (t + 0x04) ++#define OTP_OTP_ADDR_LO(t) (t + 0x08) ++#define OTP_OTP_PRGM_DATA(t) (t + 0x10) ++#define OTP_OTP_PRGM_MODE(t) (t + 0x14) ++#define OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE BIT(0) ++#define OTP_OTP_RD_DATA(t) (t + 0x18) ++#define OTP_OTP_FUNC_CMD(t) (t + 0x20) ++#define OTP_OTP_FUNC_CMD_OTP_PROGRAM BIT(1) ++#define OTP_OTP_FUNC_CMD_OTP_READ BIT(0) ++#define OTP_OTP_CMD_GO(t) (t + 0x28) ++#define OTP_OTP_CMD_GO_OTP_GO BIT(0) ++#define OTP_OTP_PASS_FAIL(t) (t + 0x2c) ++#define OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED BIT(3) ++#define OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED BIT(2) ++#define OTP_OTP_PASS_FAIL_OTP_FAIL BIT(0) ++#define OTP_OTP_STATUS(t) (t + 0x30) ++#define OTP_OTP_STATUS_OTP_CPUMPEN BIT(1) ++#define OTP_OTP_STATUS_OTP_BUSY BIT(0) ++ ++#define OTP_MEM_SIZE 8192 ++#define OTP_SLEEP_US 10 ++#define OTP_TIMEOUT_US 500000 ++ ++struct lan9662_otp { ++ struct device *dev; ++ void __iomem *base; ++}; ++ ++static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++{ ++ u32 val; ++ ++ return readl_poll_timeout(reg, val, !(val & flag), ++ OTP_SLEEP_US, OTP_TIMEOUT_US); ++} ++ ++static int lan9662_otp_power(struct lan9662_otp *otp, bool up) ++{ ++ void __iomem *pwrdn = OTP_OTP_PWR_DN(otp->base); ++ ++ if (up) { ++ writel(readl(pwrdn) & ~OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_CPUMPEN)) ++ return -ETIMEDOUT; ++ } else { ++ writel(readl(pwrdn) | OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ } ++ ++ return 0; ++} ++ ++static int lan9662_otp_execute(struct lan9662_otp *otp) ++{ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_CMD_GO(otp->base), ++ OTP_OTP_CMD_GO_OTP_GO)) ++ return -ETIMEDOUT; ++ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_BUSY)) ++ return -ETIMEDOUT; ++ ++ return 0; ++} ++ ++static void lan9662_otp_set_address(struct lan9662_otp *otp, u32 offset) ++{ ++ writel(0xff & (offset >> 8), OTP_OTP_ADDR_HI(otp->base)); ++ writel(0xff & offset, OTP_OTP_ADDR_LO(otp->base)); ++} ++ ++static int lan9662_otp_read_byte(struct lan9662_otp *otp, u32 offset, u8 *dst) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_FUNC_CMD_OTP_READ, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED) ++ return -EACCES; ++ *dst = (u8) readl(OTP_OTP_RD_DATA(otp->base)); ++ } ++ return rc; ++} ++ ++static int lan9662_otp_write_byte(struct lan9662_otp *otp, u32 offset, u8 data) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE, OTP_OTP_PRGM_MODE(otp->base)); ++ writel(data, OTP_OTP_PRGM_DATA(otp->base)); ++ writel(OTP_OTP_FUNC_CMD_OTP_PROGRAM, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED) ++ return -EACCES; ++ if (pass & OTP_OTP_PASS_FAIL_OTP_FAIL) ++ return -EIO; ++ } ++ return rc; ++} ++ ++static int lan9662_otp_read(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ uint8_t data; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ *val++ = data; ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static int lan9662_otp_write(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ u8 data, newdata; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ /* Skip zero bytes */ ++ if (val[i]) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ ++ newdata = data | val[i]; ++ if (newdata == data) ++ continue; ++ ++ rc = lan9662_otp_write_byte(otp, offset + i, ++ newdata); ++ if (rc < 0) ++ break; ++ } ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static struct nvmem_config otp_config = { ++ .name = "lan9662-otp", ++ .stride = 1, ++ .word_size = 1, ++ .reg_read = lan9662_otp_read, ++ .reg_write = lan9662_otp_write, ++ .size = OTP_MEM_SIZE, ++}; ++ ++static int lan9662_otp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct lan9662_otp *otp; ++ ++ otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ otp->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otp->base)) ++ return PTR_ERR(otp->base); ++ ++ otp_config.priv = otp; ++ otp_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &otp_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id lan9662_otp_match[] = { ++ { .compatible = "microchip,lan9662-otp", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, lan9662_otp_match); ++ ++static struct platform_driver lan9662_otp_driver = { ++ .probe = lan9662_otp_probe, ++ .driver = { ++ .name = "lan9662-otp", ++ .of_match_table = lan9662_otp_match, ++ }, ++}; ++module_platform_driver(lan9662_otp_driver); ++ ++MODULE_AUTHOR("Horatiu Vultur "); ++MODULE_DESCRIPTION("lan9662 OTP driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/802-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch b/target/linux/generic/backport-5.10/811-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch similarity index 74% rename from target/linux/generic/backport-5.15/802-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch rename to target/linux/generic/backport-5.10/811-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch index 6b405571160..633a668a962 100644 --- a/target/linux/generic/backport-5.15/802-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch @@ -1,6 +1,6 @@ -From 60bbaad38109684b156e21112322e0a922f92cde Mon Sep 17 00:00:00 2001 +From 3717ca3e0cc8683f93b41d3f06ca79631eb58715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 18 Aug 2022 06:38:37 +0200 +Date: Fri, 16 Sep 2022 13:21:00 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32 casting type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,10 +9,12 @@ Content-Transfer-Encoding: 8bit This fixes: drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32 +Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Reported-by: kernel test robot -Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-14-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.10/811-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch b/target/linux/generic/backport-5.10/811-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch new file mode 100644 index 00000000000..b663a1328df --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch @@ -0,0 +1,34 @@ +From 1aeb122d214b92474c86fde00a03d6e2d69381b5 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Wed, 28 Sep 2022 21:51:12 +0200 +Subject: [PATCH] nvmem: lan9662-otp: Fix compatible string + +The device tree bindings for lan9662-otp expects the compatible string +to be one of following compatible strings: +microchip,lan9662-otpc +microchip,lan9668-otpc + +The problem is that the lan9662-otp driver contains the +microchip,lan9662-otp compatible string instead of +microchip,lan9662-otpc. +Fix this by updating the compatible string in the driver. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Signed-off-by: Horatiu Vultur +Link: https://lore.kernel.org/r/20220928195112.630351-1-horatiu.vultur@microchip.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -203,7 +203,7 @@ static int lan9662_otp_probe(struct plat + } + + static const struct of_device_id lan9662_otp_match[] = { +- { .compatible = "microchip,lan9662-otp", }, ++ { .compatible = "microchip,lan9662-otpc", }, + { }, + }; + MODULE_DEVICE_TABLE(of, lan9662_otp_match); diff --git a/target/linux/generic/backport-5.15/804-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch b/target/linux/generic/backport-5.10/811-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch similarity index 89% rename from target/linux/generic/backport-5.15/804-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch rename to target/linux/generic/backport-5.10/811-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch index 69d5a1b8459..967e891dbd9 100644 --- a/target/linux/generic/backport-5.15/804-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch @@ -1,4 +1,4 @@ -From 7a69ff9c9bde03a690ea783970f664782fc303d8 Mon Sep 17 00:00:00 2001 +From ee424f7d3960152f5f862bbb6943e59828dc7917 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 4 Nov 2022 17:52:03 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32_data_offset on redundant @@ -37,8 +37,11 @@ crc32 sum... which is unfortunate :( | [0] https://github.com/sbabic/libubootenv/blob/master/src/uboot_env.c#L951 + Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Christian Lamparter +Link: https://lore.kernel.org/r/70a16eae113e08db2390b76e174f4837caa135c3.1667580636.git.chunkeey@gmail.com +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.10/811-v6.1-0012-nvmem-rmem-Fix-return-value-check-in-rmem_read.patch b/target/linux/generic/backport-5.10/811-v6.1-0012-nvmem-rmem-Fix-return-value-check-in-rmem_read.patch new file mode 100644 index 00000000000..b0e1b0c2196 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0012-nvmem-rmem-Fix-return-value-check-in-rmem_read.patch @@ -0,0 +1,36 @@ +From 58e92c4a496b27156020a59a98c7f4a92c2b1533 Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Fri, 18 Nov 2022 06:38:38 +0000 +Subject: [PATCH] nvmem: rmem: Fix return value check in rmem_read() + +In case of error, the function memremap() returns NULL pointer +not ERR_PTR(). The IS_ERR() test in the return value check +should be replaced with NULL test. + +Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem") +Cc: Srinivas Kandagatla +Cc: Nicolas Saenz Julienne +Signed-off-by: Wei Yongjun +Acked-by: Nicolas Saenz Julienne +Signed-off-by: Yang Yingliang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063840.6357-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rmem.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/rmem.c ++++ b/drivers/nvmem/rmem.c +@@ -37,9 +37,9 @@ static int rmem_read(void *context, unsi + * but as of Dec 2020 this isn't possible on arm64. + */ + addr = memremap(priv->mem->base, available, MEMREMAP_WB); +- if (IS_ERR(addr)) { ++ if (!addr) { + dev_err(priv->dev, "Failed to remap memory region\n"); +- return PTR_ERR(addr); ++ return -ENOMEM; + } + + count = memory_read_from_buffer(val, bytes, &off, addr, available); diff --git a/target/linux/generic/backport-5.10/811-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch b/target/linux/generic/backport-5.10/811-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch new file mode 100644 index 00000000000..0c842f07932 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch @@ -0,0 +1,35 @@ +From 022b68f271de0e53024e6d5e96fee8e76d25eb95 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 18 Nov 2022 06:38:40 +0000 +Subject: [PATCH] nvmem: lan9662-otp: Change return type of + lan9662_otp_wait_flag_clear() + +The blamed commit introduced the following smatch warning in the +function lan9662_otp_wait_flag_clear: +drivers/nvmem/lan9662-otpc.c:43 lan9662_otp_wait_flag_clear() warn: signedness bug returning '(-110)' + +Fix this by changing the return type of the function +lan9662_otp_wait_flag_clear() to be int instead of bool. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063840.6357-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -36,7 +36,7 @@ struct lan9662_otp { + void __iomem *base; + }; + +-static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++static int lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) + { + u32 val; + diff --git a/target/linux/generic/backport-5.10/812-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch b/target/linux/generic/backport-5.10/812-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch new file mode 100644 index 00000000000..33759632ebe --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch @@ -0,0 +1,82 @@ +From fbfc4ca465a1f8d81bf2d67d95bf7fc67c3cf0c2 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:20 +0000 +Subject: [PATCH] nvmem: stm32: move STM32MP15_BSEC_NUM_LOWER in config + +Support STM32MP15_BSEC_NUM_LOWER in stm32 romem config to prepare +the next SoC in STM32MP family. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -22,16 +22,15 @@ + /* shadow registers offest */ + #define STM32MP15_BSEC_DATA0 0x200 + +-/* 32 (x 32-bits) lower shadow registers */ +-#define STM32MP15_BSEC_NUM_LOWER 32 +- + struct stm32_romem_cfg { + int size; ++ u8 lower; + }; + + struct stm32_romem_priv { + void __iomem *base; + struct nvmem_config cfg; ++ u8 lower; + }; + + static int stm32_romem_read(void *context, unsigned int offset, void *buf, +@@ -85,7 +84,7 @@ static int stm32_bsec_read(void *context + for (i = roffset; (i < roffset + rbytes); i += 4) { + u32 otp = i >> 2; + +- if (otp < STM32MP15_BSEC_NUM_LOWER) { ++ if (otp < priv->lower) { + /* read lower data from shadow registers */ + val = readl_relaxed( + priv->base + STM32MP15_BSEC_DATA0 + i); +@@ -159,6 +158,8 @@ static int stm32_romem_probe(struct plat + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; + ++ priv->lower = 0; ++ + cfg = (const struct stm32_romem_cfg *) + of_match_device(dev->driver->of_match_table, dev)->data; + if (!cfg) { +@@ -167,6 +168,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.reg_read = stm32_romem_read; + } else { + priv->cfg.size = cfg->size; ++ priv->lower = cfg->lower; + priv->cfg.reg_read = stm32_bsec_read; + priv->cfg.reg_write = stm32_bsec_write; + } +@@ -174,8 +176,17 @@ static int stm32_romem_probe(struct plat + return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &priv->cfg)); + } + ++/* ++ * STM32MP15 BSEC OTP regions: 4096 OTP bits (with 3072 effective bits) ++ * => 96 x 32-bits data words ++ * - Lower: 1K bits, 2:1 redundancy, incremental bit programming ++ * => 32 (x 32-bits) lower shadow registers = words 0 to 31 ++ * - Upper: 2K bits, ECC protection, word programming only ++ * => 64 (x 32-bits) = words 32 to 95 ++ */ + static const struct stm32_romem_cfg stm32mp15_bsec_cfg = { +- .size = 384, /* 96 x 32-bits data words */ ++ .size = 384, ++ .lower = 32, + }; + + static const struct of_device_id stm32_romem_of_match[] = { diff --git a/target/linux/generic/backport-5.10/812-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch b/target/linux/generic/backport-5.10/812-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch new file mode 100644 index 00000000000..5791df2606f --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch @@ -0,0 +1,34 @@ +From d61784e6410f3df2028e6eb91b06ffed37a660e0 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:21 +0000 +Subject: [PATCH] nvmem: stm32: add warning when upper OTPs are updated + +As the upper OTPs are ECC protected, they support only one 32 bits word +programming. +For a second modification of this word, these ECC become invalid and +this OTP will be no more accessible, the shadowed value is invalid. + +This patch adds a warning to indicate an upper OTP update, because this +operation is dangerous as OTP is not locked by the driver after the first +update to avoid a second update. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -132,6 +132,9 @@ static int stm32_bsec_write(void *contex + } + } + ++ if (offset + bytes >= priv->lower * 4) ++ dev_warn(dev, "Update of upper OTPs with ECC protection (word programming, only once)\n"); ++ + return 0; + } + diff --git a/target/linux/generic/backport-5.10/812-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch b/target/linux/generic/backport-5.10/812-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch new file mode 100644 index 00000000000..b83ad69c6b4 --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch @@ -0,0 +1,26 @@ +From a3816a7d7c097c1da46aad5f5d1e229b607dce04 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:22 +0000 +Subject: [PATCH] nvmem: stm32: add nvmem type attribute + +Inform NVMEM framework of type attribute for stm32-romem as NVMEM_TYPE_OTP +so userspace is able to know how the data is stored in BSEC. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -160,6 +160,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.dev = dev; + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; ++ priv->cfg.type = NVMEM_TYPE_OTP; + + priv->lower = 0; + diff --git a/target/linux/generic/backport-5.10/812-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch b/target/linux/generic/backport-5.10/812-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch new file mode 100644 index 00000000000..52ba1e65b56 --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch @@ -0,0 +1,27 @@ +From 06aac0e11960a7ddccc1888326b5906d017e0f24 Mon Sep 17 00:00:00 2001 +From: Jiangshan Yi +Date: Fri, 18 Nov 2022 06:39:24 +0000 +Subject: [PATCH] nvmem: stm32: fix spelling typo in comment + +Fix spelling typo in comment. + +Reported-by: k2ci +Signed-off-by: Jiangshan Yi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -19,7 +19,7 @@ + #define STM32_SMC_WRITE_SHADOW 0x03 + #define STM32_SMC_READ_OTP 0x04 + +-/* shadow registers offest */ ++/* shadow registers offset */ + #define STM32MP15_BSEC_DATA0 0x200 + + struct stm32_romem_cfg { diff --git a/target/linux/generic/backport-5.10/812-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch b/target/linux/generic/backport-5.10/812-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch new file mode 100644 index 00000000000..8f024f4c1ac --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch @@ -0,0 +1,27 @@ +From fb817c4ef63e8cfb6e77ae4a2875ae854c80708f Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 18 Nov 2022 06:39:26 +0000 +Subject: [PATCH] nvmem: Kconfig: Fix spelling mistake "controlls" -> + "controls" + +There is a spelling mistake in a Kconfig description. Fix it. + +Signed-off-by: Colin Ian King +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -164,7 +164,7 @@ config NVMEM_MICROCHIP_OTPC + depends on ARCH_AT91 || COMPILE_TEST + help + This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ SoCs. It controls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" diff --git a/target/linux/generic/backport-5.10/803-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch b/target/linux/generic/backport-5.10/812-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch similarity index 90% rename from target/linux/generic/backport-5.10/803-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch rename to target/linux/generic/backport-5.10/812-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch index 429b24f0f3a..861386ad310 100644 --- a/target/linux/generic/backport-5.10/803-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch +++ b/target/linux/generic/backport-5.10/812-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch @@ -1,6 +1,6 @@ -From 5b4eaafbeac472fc19049152f18e88aecb2b2829 Mon Sep 17 00:00:00 2001 +From ada84d07af6097b2addd18262668ce6cb9e15206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 17 Oct 2022 09:17:22 +0200 +Date: Fri, 18 Nov 2022 06:39:27 +0000 Subject: [PATCH] nvmem: u-boot-env: add Broadcom format support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -15,6 +15,8 @@ Add support for Broadcom's specific binding and their custom format. Ref: 6b0584c19d87 ("dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/linux/generic/backport-5.10/803-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/backport-5.10/813-nvmem-u-boot-env-align-endianness-of-crc32-values.patch similarity index 96% rename from target/linux/generic/backport-5.10/803-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch rename to target/linux/generic/backport-5.10/813-nvmem-u-boot-env-align-endianness-of-crc32-values.patch index 7d6723bb8e9..4010232300c 100644 --- a/target/linux/generic/backport-5.10/803-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch +++ b/target/linux/generic/backport-5.10/813-nvmem-u-boot-env-align-endianness-of-crc32-values.patch @@ -36,7 +36,7 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c -@@ -143,7 +143,7 @@ static int u_boot_env_parse(struct u_boo +@@ -156,7 +156,7 @@ static int u_boot_env_parse(struct u_boo crc32_data_len = priv->mtd->size - crc32_data_offset; data_len = priv->mtd->size - data_offset; diff --git a/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch b/target/linux/generic/backport-5.10/818-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch similarity index 100% rename from target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch rename to target/linux/generic/backport-5.10/818-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch diff --git a/target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch b/target/linux/generic/backport-5.10/819-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch similarity index 100% rename from target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch rename to target/linux/generic/backport-5.10/819-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch diff --git a/target/linux/generic/backport-5.10/825-v5.15-of-unify-of_count_phandle_with_args-arguments-with-C.patch b/target/linux/generic/backport-5.10/825-v5.15-of-unify-of_count_phandle_with_args-arguments-with-C.patch new file mode 100644 index 00000000000..ee5b7a0f7e8 --- /dev/null +++ b/target/linux/generic/backport-5.10/825-v5.15-of-unify-of_count_phandle_with_args-arguments-with-C.patch @@ -0,0 +1,27 @@ +From a065d5615fc83908ef21ed8159ffb63d816ff5de Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 28 Jul 2021 16:42:27 +0200 +Subject: [PATCH] of: unify of_count_phandle_with_args() arguments with + !CONFIG_OF + +Unify the declaration of of_count_phandle_with_args() between enabled +and disabled OF by making constifying pointed device_node. + +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Rob Herring +Signed-off-by: Bartosz Golaszewski +--- + include/linux/of.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -889,7 +889,7 @@ static inline int of_parse_phandle_with_ + return -ENOSYS; + } + +-static inline int of_count_phandle_with_args(struct device_node *np, ++static inline int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, + const char *cells_name) + { diff --git a/target/linux/generic/backport-5.10/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch b/target/linux/generic/backport-5.10/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch new file mode 100644 index 00000000000..b6ef67dfa79 --- /dev/null +++ b/target/linux/generic/backport-5.10/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch @@ -0,0 +1,359 @@ +From 66a8f7f04979f4ad739085f01d99c8caf620b4f5 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 18 Jan 2022 18:35:02 +0100 +Subject: [PATCH] of: base: make small of_parse_phandle() variants static + inline + +Make all the smaller variants of the of_parse_phandle() static inline. +This also let us remove the empty function stubs if CONFIG_OF is not +defined. + +Suggested-by: Rob Herring +Signed-off-by: Michael Walle +[robh: move index < 0 check into __of_parse_phandle_with_args] +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc +--- + drivers/of/base.c | 131 +++------------------------------------ + include/linux/of.h | 148 ++++++++++++++++++++++++++++++++++++--------- + 2 files changed, 129 insertions(+), 150 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -1372,15 +1372,18 @@ int of_phandle_iterator_args(struct of_p + return count; + } + +-static int __of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int cell_count, int index, +- struct of_phandle_args *out_args) ++int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, int index, ++ struct of_phandle_args *out_args) + { + struct of_phandle_iterator it; + int rc, cur_index = 0; + ++ if (index < 0) ++ return -EINVAL; ++ + /* Loop over the phandles until all the requested entry is found */ + of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { + /* +@@ -1423,82 +1426,7 @@ static int __of_parse_phandle_with_args( + of_node_put(it.node); + return rc; + } +- +-/** +- * of_parse_phandle - Resolve a phandle property to a device_node pointer +- * @np: Pointer to device node holding phandle property +- * @phandle_name: Name of property holding a phandle value +- * @index: For properties holding a table of phandles, this is the index into +- * the table +- * +- * Return: The device_node pointer with refcount incremented. Use +- * of_node_put() on it when done. +- */ +-struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, int index) +-{ +- struct of_phandle_args args; +- +- if (index < 0) +- return NULL; +- +- if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, +- index, &args)) +- return NULL; +- +- return args.np; +-} +-EXPORT_SYMBOL(of_parse_phandle); +- +-/** +- * of_parse_phandle_with_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cells_name: property name that specifies phandles' arguments count +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * #list-cells = <2>; +- * }; +- * +- * phandle2: node2 { +- * #list-cells = <1>; +- * }; +- * +- * node3 { +- * list = <&phandle1 1 2 &phandle2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); +- */ +-int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, +- const char *cells_name, int index, +- struct of_phandle_args *out_args) +-{ +- int cell_count = -1; +- +- if (index < 0) +- return -EINVAL; +- +- /* If cells_name is NULL we assume a cell count of 0 */ +- if (!cells_name) +- cell_count = 0; +- +- return __of_parse_phandle_with_args(np, list_name, cells_name, +- cell_count, index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_args); ++EXPORT_SYMBOL(__of_parse_phandle_with_args); + + /** + * of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it +@@ -1685,47 +1613,6 @@ free: + EXPORT_SYMBOL(of_parse_phandle_with_args_map); + + /** +- * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cell_count: number of argument cells following the phandle +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * }; +- * +- * phandle2: node2 { +- * }; +- * +- * node3 { +- * list = <&phandle1 0 2 &phandle2 2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); +- */ +-int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cell_count, +- int index, struct of_phandle_args *out_args) +-{ +- if (index < 0) +- return -EINVAL; +- return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, +- index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_fixed_args); +- +-/** + * of_count_phandle_with_args() - Find the number of phandles references in a property + * @np: pointer to a device tree node containing a list + * @list_name: property name that contains a list +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -363,18 +363,12 @@ extern const struct of_device_id *of_mat + const struct of_device_id *matches, const struct device_node *node); + extern int of_modalias_node(struct device_node *node, char *modalias, int len); + extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args); +-extern struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index); +-extern int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, const char *cells_name, int index, +- struct of_phandle_args *out_args); ++extern int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, const char *cells_name, int cell_count, ++ int index, struct of_phandle_args *out_args); + extern int of_parse_phandle_with_args_map(const struct device_node *np, + const char *list_name, const char *stem_name, int index, + struct of_phandle_args *out_args); +-extern int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args); + extern int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, const char *cells_name); + +@@ -857,18 +851,12 @@ static inline int of_property_read_strin + return -ENOSYS; + } + +-static inline struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index) +-{ +- return NULL; +-} +- +-static inline int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int index, +- struct of_phandle_args *out_args) ++static inline int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) + { + return -ENOSYS; + } +@@ -882,13 +870,6 @@ static inline int of_parse_phandle_with_ + return -ENOSYS; + } + +-static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args) +-{ +- return -ENOSYS; +-} +- + static inline int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, + const char *cells_name) +@@ -1065,6 +1046,117 @@ static inline bool of_node_is_type(const + } + + /** ++ * of_parse_phandle - Resolve a phandle property to a device_node pointer ++ * @np: Pointer to device node holding phandle property ++ * @phandle_name: Name of property holding a phandle value ++ * @index: For properties holding a table of phandles, this is the index into ++ * the table ++ * ++ * Return: The device_node pointer with refcount incremented. Use ++ * of_node_put() on it when done. ++ */ ++static inline struct device_node *of_parse_phandle(const struct device_node *np, ++ const char *phandle_name, ++ int index) ++{ ++ struct of_phandle_args args; ++ ++ if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, ++ index, &args)) ++ return NULL; ++ ++ return args.np; ++} ++ ++/** ++ * of_parse_phandle_with_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * #list-cells = <2>; ++ * }; ++ * ++ * phandle2: node2 { ++ * #list-cells = <1>; ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 1 2 &phandle2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); ++ */ ++static inline int of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ int cell_count = -1; ++ ++ /* If cells_name is NULL we assume a cell count of 0 */ ++ if (!cells_name) ++ cell_count = 0; ++ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ cell_count, index, out_args); ++} ++ ++/** ++ * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cell_count: number of argument cells following the phandle ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * }; ++ * ++ * phandle2: node2 { ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 0 2 &phandle2 2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); ++ */ ++static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, ++ const char *list_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, ++ index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.10/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch b/target/linux/generic/backport-5.10/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch new file mode 100644 index 00000000000..a3df3ce75c6 --- /dev/null +++ b/target/linux/generic/backport-5.10/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch @@ -0,0 +1,56 @@ +From 8eddceb280f5deb8046fcb660de9f9f683b408b9 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:21 +0100 +Subject: [PATCH] of: base: add of_parse_phandle_with_optional_args() + +Add a new variant of the of_parse_phandle_with_args() which treats the +cells name as optional. If it's missing, it is assumed that the phandle +has no arguments. + +Up until now, a nvmem node didn't have any arguments, so all the device +trees haven't any '#*-cells' property. But there is a need for an +additional argument for the phandle, for which we need a '#*-cells' +property. Therefore, we need to support nvmem nodes with and without +this property. + +Signed-off-by: Michael Walle +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + include/linux/of.h | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -1157,6 +1157,31 @@ static inline int of_parse_phandle_with_ + } + + /** ++ * of_parse_phandle_with_optional_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * Same as of_parse_phandle_with_args() except that if the cells_name property ++ * is not found, cell_count of 0 is assumed. ++ * ++ * This is used to useful, if you have a phandle which didn't have arguments ++ * before and thus doesn't have a '#*-cells' property but is now migrated to ++ * having arguments while retaining backwards compatibility. ++ */ ++static inline int of_parse_phandle_with_optional_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ 0, index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.10/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch b/target/linux/generic/backport-5.10/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch new file mode 100644 index 00000000000..95b0e60d564 --- /dev/null +++ b/target/linux/generic/backport-5.10/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch @@ -0,0 +1,32 @@ +From 4f4145c9fee8c7a445dbbbadceccce5391e6b287 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:22 +0100 +Subject: [PATCH] of: property: make #.*-cells optional for simple props + +Sometimes, future bindings for phandles will get additional arguments. +Thus the target node of the phandle will need a new #.*-cells property. +To be backwards compatible, this needs to be optional. + +Prepare the DEFINE_SIMPLE_PROPS() to handle the cells name as optional. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1267,8 +1267,8 @@ static struct device_node *parse_suffix_ + if (strcmp_suffix(prop_name, suffix)) + return NULL; + +- if (of_parse_phandle_with_args(np, prop_name, cells_name, index, +- &sup_args)) ++ if (__of_parse_phandle_with_args(np, prop_name, cells_name, 0, index, ++ &sup_args)) + return NULL; + + return sup_args.np; diff --git a/target/linux/generic/backport-5.10/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch b/target/linux/generic/backport-5.10/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch new file mode 100644 index 00000000000..5d1df95ff1e --- /dev/null +++ b/target/linux/generic/backport-5.10/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch @@ -0,0 +1,28 @@ +From 9cf9486a6a7e8a3d76154d0c506051ba3740e8b6 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:23 +0100 +Subject: [PATCH] of: property: add #nvmem-cell-cells property + +Bindings describe the new '#nvmem-cell-cells' property. Now that the +arguments count property is optional, we just add this property to the +nvmem-cells. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1314,7 +1314,7 @@ DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", " + DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) + DEFINE_SIMPLE_PROP(interrupts_extended, "interrupts-extended", + "#interrupt-cells") +-DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", NULL) ++DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", "#nvmem-cell-cells") + DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells") + DEFINE_SIMPLE_PROP(wakeup_parent, "wakeup-parent", NULL) + DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) diff --git a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch index 53dce95ffb2..e0b95cb76bb 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch @@ -297,7 +297,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 } --- a/kernel/fork.c +++ b/kernel/fork.c -@@ -1080,6 +1080,7 @@ static struct mm_struct *mm_init(struct +@@ -1083,6 +1083,7 @@ static struct mm_struct *mm_init(struct goto fail_nocontext; mm->user_ns = get_user_ns(user_ns); @@ -305,7 +305,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 return mm; fail_nocontext: -@@ -1122,6 +1123,7 @@ static inline void __mmput(struct mm_str +@@ -1125,6 +1126,7 @@ static inline void __mmput(struct mm_str } if (mm->binfmt) module_put(mm->binfmt->module); @@ -313,7 +313,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 mmdrop(mm); } -@@ -2617,6 +2619,13 @@ pid_t kernel_clone(struct kernel_clone_a +@@ -2622,6 +2624,13 @@ pid_t kernel_clone(struct kernel_clone_a get_task_struct(p); } diff --git a/target/linux/generic/backport-5.15/402-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch b/target/linux/generic/backport-5.15/402-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch index 8b8e478b005..ee385416d1d 100644 --- a/target/linux/generic/backport-5.15/402-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch +++ b/target/linux/generic/backport-5.15/402-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch @@ -103,4 +103,4 @@ Link: https://lore.kernel.org/linux-mtd/20220622010628.30414-4-ansuelsmth@gmail. + mtd_check_of_node(mtd); of_node_get(mtd_get_of_node(mtd)); error = device_register(&mtd->dev); - if (error) + if (error) { diff --git a/target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch b/target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch index be1aa9cfb84..acef46f2b91 100644 --- a/target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch +++ b/target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch @@ -25,7 +25,7 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -1227,6 +1227,34 @@ int __get_mtd_device(struct mtd_info *mt +@@ -1229,6 +1229,34 @@ int __get_mtd_device(struct mtd_info *mt EXPORT_SYMBOL_GPL(__get_mtd_device); /** diff --git a/target/linux/generic/backport-5.15/408-v6.2-mtd-core-set-ROOT_DEV-for-partitions-marked-as-rootf.patch b/target/linux/generic/backport-5.15/408-v6.2-mtd-core-set-ROOT_DEV-for-partitions-marked-as-rootf.patch index 60b17642522..505e347e40e 100644 --- a/target/linux/generic/backport-5.15/408-v6.2-mtd-core-set-ROOT_DEV-for-partitions-marked-as-rootf.patch +++ b/target/linux/generic/backport-5.15/408-v6.2-mtd-core-set-ROOT_DEV-for-partitions-marked-as-rootf.patch @@ -27,7 +27,7 @@ Link: https://lore.kernel.org/linux-mtd/20221022211318.32009-2-zajec5@gmail.com #include #include -@@ -746,6 +747,17 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -748,6 +749,17 @@ int add_mtd_device(struct mtd_info *mtd) not->add(mtd); mutex_unlock(&mtd_table_mutex); diff --git a/target/linux/generic/backport-5.15/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch b/target/linux/generic/backport-5.15/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch new file mode 100644 index 00000000000..2358352e93c --- /dev/null +++ b/target/linux/generic/backport-5.15/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch @@ -0,0 +1,49 @@ +From 6abef37d16d0c570ef5a149e63762fba2a30804b Mon Sep 17 00:00:00 2001 +From: "Leon M. George" +Date: Wed, 30 Mar 2022 16:16:56 +0200 +Subject: [PATCH] mtd: spi-nor: support eon en25qh256a variant + +The EN25QH256A variant of the EN25QH256 doesn't initialize correctly from SFDP +alone and only accesses memory below 8m (addr_width is 4 but read_opcode takes +only 3 bytes). + +Set SNOR_F_4B_OPCODES if the flash chip variant was detected using hwcaps. + +The fix submitted upstream uses the PARSE_SFDP initializer that is not +available in the kernel used with Openwrt. + +Signed-off-by: Leon M. George +--- + drivers/mtd/spi-nor/eon.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/mtd/spi-nor/eon.c ++++ b/drivers/mtd/spi-nor/eon.c +@@ -8,6 +8,16 @@ + + #include "core.h" + ++static void en25qh256_post_sfdp_fixups(struct spi_nor *nor) ++{ ++ if (nor->params->hwcaps.mask & SNOR_HWCAPS_READ_1_1_4) ++ nor->flags |= SNOR_F_4B_OPCODES; ++} ++ ++static const struct spi_nor_fixups en25qh256_fixups = { ++ .post_sfdp = en25qh256_post_sfdp_fixups, ++}; ++ + static const struct flash_info eon_parts[] = { + /* EON -- en25xxx */ + { "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64, SECT_4K) }, +@@ -23,7 +33,9 @@ static const struct flash_info eon_parts + { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128, + SECT_4K | SPI_NOR_DUAL_READ) }, + { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, +- { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, ++ { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, ++ SPI_NOR_DUAL_READ) ++ .fixups = &en25qh256_fixups }, + { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, + }; + diff --git a/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch b/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch index 2f93518e157..d5b1d214133 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-03-net-ethernet-mtk_eth_soc-implement-flow-offloading-t.patch @@ -233,7 +233,7 @@ Signed-off-by: Felix Fietkau static inline void --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -863,6 +863,7 @@ enum net_device_path_type { +@@ -870,6 +870,7 @@ enum net_device_path_type { DEV_PATH_BRIDGE, DEV_PATH_PPPOE, DEV_PATH_DSA, @@ -241,7 +241,7 @@ Signed-off-by: Felix Fietkau }; struct net_device_path { -@@ -888,6 +889,12 @@ struct net_device_path { +@@ -895,6 +896,12 @@ struct net_device_path { int port; u16 proto; } dsa; diff --git a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch index 7890c995517..521bad896af 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch @@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_tx_descriptors(priv, queue); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -7398,6 +7393,25 @@ int stmmac_suspend(struct device *dev) +@@ -7400,6 +7395,25 @@ int stmmac_suspend(struct device *dev) } EXPORT_SYMBOL_GPL(stmmac_suspend); @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski /** * stmmac_reset_queues_param - reset queue parameters * @priv: device pointer -@@ -7408,22 +7422,11 @@ static void stmmac_reset_queues_param(st +@@ -7410,22 +7424,11 @@ static void stmmac_reset_queues_param(st u32 tx_cnt = priv->plat->tx_queues_to_use; u32 queue; diff --git a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch index 46375a6fa98..e65d8b1960c 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch @@ -1210,7 +1210,7 @@ Signed-off-by: Jakub Kicinski if (netif_running(dev)) ret = stmmac_open(dev); -@@ -7344,7 +7348,7 @@ int stmmac_suspend(struct device *dev) +@@ -7346,7 +7350,7 @@ int stmmac_suspend(struct device *dev) stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1219,7 +1219,7 @@ Signed-off-by: Jakub Kicinski if (priv->eee_enabled) { priv->tx_path_in_lpi_mode = false; -@@ -7395,7 +7399,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); +@@ -7397,7 +7401,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1228,7 +1228,7 @@ Signed-off-by: Jakub Kicinski rx_q->cur_rx = 0; rx_q->dirty_rx = 0; -@@ -7403,7 +7407,7 @@ static void stmmac_reset_rx_queue(struct +@@ -7405,7 +7409,7 @@ static void stmmac_reset_rx_queue(struct static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1250,7 +1250,7 @@ Signed-off-by: Jakub Kicinski stmmac_set_rx_tail_ptr(priv, priv->ioaddr, tail, i); stmmac_start_rx(priv, priv->ioaddr, i); -@@ -1680,7 +1680,7 @@ cleanup: +@@ -1684,7 +1684,7 @@ cleanup: static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue) { struct stmmac_packet_attrs attr = { }; @@ -1259,7 +1259,7 @@ Signed-off-by: Jakub Kicinski attr.dst = priv->dev->dev_addr; attr.max_size = size - ETH_FCS_LEN; -@@ -1763,7 +1763,7 @@ static int stmmac_test_tbs(struct stmmac +@@ -1767,7 +1767,7 @@ static int stmmac_test_tbs(struct stmmac /* Find first TBS enabled Queue, if any */ for (i = 0; i < priv->plat->tx_queues_to_use; i++) diff --git a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch index 12149edbe9e..80c22c34d01 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch @@ -1150,7 +1150,7 @@ Signed-off-by: Jakub Kicinski dma_desc_error: return ret; } -@@ -7490,7 +7606,7 @@ int stmmac_resume(struct device *dev) +@@ -7492,7 +7608,7 @@ int stmmac_resume(struct device *dev) stmmac_reset_queues_param(priv); stmmac_free_tx_skbufs(priv); diff --git a/target/linux/generic/backport-5.15/777-v6.2-01-net-dsa-qca8k-fix-wrong-length-value-for-mgmt-eth-pa.patch b/target/linux/generic/backport-5.15/777-v6.2-01-net-dsa-qca8k-fix-wrong-length-value-for-mgmt-eth-pa.patch new file mode 100644 index 00000000000..b61e7ede494 --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-01-net-dsa-qca8k-fix-wrong-length-value-for-mgmt-eth-pa.patch @@ -0,0 +1,102 @@ +From 9807ae69746196ee4bbffe7d22d22ab2b61c6ed0 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:32 +0100 +Subject: [PATCH 1/5] net: dsa: qca8k: fix wrong length value for mgmt eth + packet + +The assumption that Documentation was right about how this value work was +wrong. It was discovered that the length value of the mgmt header is in +step of word size. + +As an example to process 4 byte of data the correct length to set is 2. +To process 8 byte 4, 12 byte 6, 16 byte 8... + +Odd values will always return the next size on the ack packet. +(length of 3 (6 byte) will always return 8 bytes of data) + +This means that a value of 15 (0xf) actually means reading/writing 32 bytes +of data instead of 16 bytes. This behaviour is totally absent and not +documented in the switch Documentation. + +In fact from Documentation the max value that mgmt eth can process is +16 byte of data while in reality it can process 32 bytes at once. + +To handle this we always round up the length after deviding it for word +size. We check if the result is odd and we round another time to align +to what the switch will provide in the ack packet. +The workaround for the length limit of 15 is still needed as the length +reg max value is 0xf(15) + +Reported-by: Ronald Wahl +Tested-by: Ronald Wahl +Fixes: 90386223f44e ("net: dsa: qca8k: add support for larger read/write size with mgmt Ethernet") +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org # v5.18+ +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 45 +++++++++++++++++++++++++------- + 1 file changed, 35 insertions(+), 10 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -146,7 +146,16 @@ static void qca8k_rw_reg_ack_handler(str + + command = get_unaligned_le32(&mgmt_ethhdr->command); + cmd = FIELD_GET(QCA_HDR_MGMT_CMD, command); ++ + len = FIELD_GET(QCA_HDR_MGMT_LENGTH, command); ++ /* Special case for len of 15 as this is the max value for len and needs to ++ * be increased before converting it from word to dword. ++ */ ++ if (len == 15) ++ len++; ++ ++ /* We can ignore odd value, we always round up them in the alloc function. */ ++ len *= sizeof(u16); + + /* Make sure the seq match the requested packet */ + if (get_unaligned_le32(&mgmt_ethhdr->seq) == mgmt_eth_data->seq) +@@ -193,17 +202,33 @@ static struct sk_buff *qca8k_alloc_mdio_ + if (!skb) + return NULL; + +- /* Max value for len reg is 15 (0xf) but the switch actually return 16 byte +- * Actually for some reason the steps are: +- * 0: nothing +- * 1-4: first 4 byte +- * 5-6: first 12 byte +- * 7-15: all 16 byte ++ /* Hdr mgmt length value is in step of word size. ++ * As an example to process 4 byte of data the correct length to set is 2. ++ * To process 8 byte 4, 12 byte 6, 16 byte 8... ++ * ++ * Odd values will always return the next size on the ack packet. ++ * (length of 3 (6 byte) will always return 8 bytes of data) ++ * ++ * This means that a value of 15 (0xf) actually means reading/writing 32 bytes ++ * of data. ++ * ++ * To correctly calculate the length we devide the requested len by word and ++ * round up. ++ * On the ack function we can skip the odd check as we already handle the ++ * case here. + */ +- if (len == 16) +- real_len = 15; +- else +- real_len = len; ++ real_len = DIV_ROUND_UP(len, sizeof(u16)); ++ ++ /* We check if the result len is odd and we round up another time to ++ * the next size. (length of 3 will be increased to 4 as switch will always ++ * return 8 bytes) ++ */ ++ if (real_len % sizeof(u16) != 0) ++ real_len++; ++ ++ /* Max reg value is 0xf(15) but switch will always return the next size (32 byte) */ ++ if (real_len == 16) ++ real_len--; + + skb_reset_mac_header(skb); + skb_set_network_header(skb, skb->len); diff --git a/target/linux/generic/backport-5.15/777-v6.2-02-net-dsa-tag_qca-fix-wrong-MGMT_DATA2-size.patch b/target/linux/generic/backport-5.15/777-v6.2-02-net-dsa-tag_qca-fix-wrong-MGMT_DATA2-size.patch new file mode 100644 index 00000000000..55ecb1eb42e --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-02-net-dsa-tag_qca-fix-wrong-MGMT_DATA2-size.patch @@ -0,0 +1,34 @@ +From d9dba91be71f03cc75bcf39fc0d5d99ff33f1ae0 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:33 +0100 +Subject: [PATCH 2/5] net: dsa: tag_qca: fix wrong MGMT_DATA2 size + +It was discovered that MGMT_DATA2 can contain up to 28 bytes of data +instead of the 12 bytes written in the Documentation by accounting the +limit of 16 bytes declared in Documentation subtracting the first 4 byte +in the packet header. + +Update the define with the real world value. + +Tested-by: Ronald Wahl +Fixes: c2ee8181fddb ("net: dsa: tag_qca: add define for handling mgmt Ethernet packet") +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org # v5.18+ +Signed-off-by: David S. Miller +--- + include/linux/dsa/tag_qca.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/include/linux/dsa/tag_qca.h ++++ b/include/linux/dsa/tag_qca.h +@@ -40,8 +40,8 @@ + QCA_HDR_MGMT_COMMAND_LEN + \ + QCA_HDR_MGMT_DATA1_LEN) + +-#define QCA_HDR_MGMT_DATA2_LEN 12 /* Other 12 byte for the mdio data */ +-#define QCA_HDR_MGMT_PADDING_LEN 34 /* Padding to reach the min Ethernet packet */ ++#define QCA_HDR_MGMT_DATA2_LEN 28 /* Other 28 byte for the mdio data */ ++#define QCA_HDR_MGMT_PADDING_LEN 18 /* Padding to reach the min Ethernet packet */ + + #define QCA_HDR_MGMT_PKT_LEN (QCA_HDR_MGMT_HEADER_LEN + \ + QCA_HDR_LEN + \ diff --git a/target/linux/generic/backport-5.15/777-v6.2-03-Revert-net-dsa-qca8k-cache-lo-and-hi-for-mdio-write.patch b/target/linux/generic/backport-5.15/777-v6.2-03-Revert-net-dsa-qca8k-cache-lo-and-hi-for-mdio-write.patch new file mode 100644 index 00000000000..c8e22fd1b81 --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-03-Revert-net-dsa-qca8k-cache-lo-and-hi-for-mdio-write.patch @@ -0,0 +1,172 @@ +From 03cb9e6d0b32b768e3d9d473c5c4ca1100877664 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:34 +0100 +Subject: [PATCH 3/5] Revert "net: dsa: qca8k: cache lo and hi for mdio write" + +This reverts commit 2481d206fae7884cd07014fd1318e63af35e99eb. + +The Documentation is very confusing about the topic. +The cache logic for hi and lo is wrong and actually miss some regs to be +actually written. + +What the Documentation actually intended was that it's possible to skip +writing hi OR lo if half of the reg is not needed to be written or read. + +Revert the change in favor of a better and correct implementation. + +Reported-by: Ronald Wahl +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org # v5.18+ +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 61 +++++++------------------------- + drivers/net/dsa/qca/qca8k.h | 5 --- + 2 files changed, 12 insertions(+), 54 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -37,44 +37,6 @@ qca8k_split_addr(u32 regaddr, u16 *r1, u + } + + static int +-qca8k_set_lo(struct qca8k_priv *priv, int phy_id, u32 regnum, u16 lo) +-{ +- u16 *cached_lo = &priv->mdio_cache.lo; +- struct mii_bus *bus = priv->bus; +- int ret; +- +- if (lo == *cached_lo) +- return 0; +- +- ret = bus->write(bus, phy_id, regnum, lo); +- if (ret < 0) +- dev_err_ratelimited(&bus->dev, +- "failed to write qca8k 32bit lo register\n"); +- +- *cached_lo = lo; +- return 0; +-} +- +-static int +-qca8k_set_hi(struct qca8k_priv *priv, int phy_id, u32 regnum, u16 hi) +-{ +- u16 *cached_hi = &priv->mdio_cache.hi; +- struct mii_bus *bus = priv->bus; +- int ret; +- +- if (hi == *cached_hi) +- return 0; +- +- ret = bus->write(bus, phy_id, regnum, hi); +- if (ret < 0) +- dev_err_ratelimited(&bus->dev, +- "failed to write qca8k 32bit hi register\n"); +- +- *cached_hi = hi; +- return 0; +-} +- +-static int + qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) + { + int ret; +@@ -97,7 +59,7 @@ qca8k_mii_read32(struct mii_bus *bus, in + } + + static void +-qca8k_mii_write32(struct qca8k_priv *priv, int phy_id, u32 regnum, u32 val) ++qca8k_mii_write32(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) + { + u16 lo, hi; + int ret; +@@ -105,9 +67,12 @@ qca8k_mii_write32(struct qca8k_priv *pri + lo = val & 0xffff; + hi = (u16)(val >> 16); + +- ret = qca8k_set_lo(priv, phy_id, regnum, lo); ++ ret = bus->write(bus, phy_id, regnum, lo); + if (ret >= 0) +- ret = qca8k_set_hi(priv, phy_id, regnum + 1, hi); ++ ret = bus->write(bus, phy_id, regnum + 1, hi); ++ if (ret < 0) ++ dev_err_ratelimited(&bus->dev, ++ "failed to write qca8k 32bit register\n"); + } + + static int +@@ -442,7 +407,7 @@ qca8k_regmap_write(void *ctx, uint32_t r + if (ret < 0) + goto exit; + +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + exit: + mutex_unlock(&bus->mdio_lock); +@@ -475,7 +440,7 @@ qca8k_regmap_update_bits(void *ctx, uint + + val &= ~mask; + val |= write_val; +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + exit: + mutex_unlock(&bus->mdio_lock); +@@ -750,14 +715,14 @@ qca8k_mdio_write(struct qca8k_priv *priv + if (ret) + goto exit; + +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(priv, 0x10 | r2, r1, 0); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, 0); + + mutex_unlock(&bus->mdio_lock); + +@@ -787,7 +752,7 @@ qca8k_mdio_read(struct qca8k_priv *priv, + if (ret) + goto exit; + +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); +@@ -798,7 +763,7 @@ qca8k_mdio_read(struct qca8k_priv *priv, + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(priv, 0x10 | r2, r1, 0); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, 0); + + mutex_unlock(&bus->mdio_lock); + +@@ -1914,8 +1879,6 @@ qca8k_sw_probe(struct mdio_device *mdiod + } + + priv->mdio_cache.page = 0xffff; +- priv->mdio_cache.lo = 0xffff; +- priv->mdio_cache.hi = 0xffff; + + /* Check the detected switch id */ + ret = qca8k_read_switch_id(priv); +--- a/drivers/net/dsa/qca/qca8k.h ++++ b/drivers/net/dsa/qca/qca8k.h +@@ -375,11 +375,6 @@ struct qca8k_mdio_cache { + * mdio writes + */ + u16 page; +-/* lo and hi can also be cached and from Documentation we can skip one +- * extra mdio write if lo or hi is didn't change. +- */ +- u16 lo; +- u16 hi; + }; + + struct qca8k_priv { diff --git a/target/linux/generic/backport-5.15/777-v6.2-04-net-dsa-qca8k-introduce-single-mii-read-write-lo-hi.patch b/target/linux/generic/backport-5.15/777-v6.2-04-net-dsa-qca8k-introduce-single-mii-read-write-lo-hi.patch new file mode 100644 index 00000000000..c0320ad6f9d --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-04-net-dsa-qca8k-introduce-single-mii-read-write-lo-hi.patch @@ -0,0 +1,150 @@ +From cfbd6de588ef659c198083205dc954a6d3ed2aec Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:35 +0100 +Subject: [PATCH 4/5] net: dsa: qca8k: introduce single mii read/write lo/hi + +It may be useful to read/write just the lo or hi half of a reg. + +This is especially useful for phy poll with the use of mdio master. +The mdio master reg is composed by the first 16 bit related to setup and +the other half with the returned data or data to write. + +Refactor the mii function to permit single mii read/write of lo or hi +half of the reg. + +Tested-by: Ronald Wahl +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 106 ++++++++++++++++++++++++------- + 1 file changed, 84 insertions(+), 22 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -37,42 +37,104 @@ qca8k_split_addr(u32 regaddr, u16 *r1, u + } + + static int +-qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) ++qca8k_mii_write_lo(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) + { + int ret; ++ u16 lo; + +- ret = bus->read(bus, phy_id, regnum); +- if (ret >= 0) { +- *val = ret; +- ret = bus->read(bus, phy_id, regnum + 1); +- *val |= ret << 16; +- } ++ lo = val & 0xffff; ++ ret = bus->write(bus, phy_id, regnum, lo); ++ if (ret < 0) ++ dev_err_ratelimited(&bus->dev, ++ "failed to write qca8k 32bit lo register\n"); ++ ++ return ret; ++} + +- if (ret < 0) { ++static int ++qca8k_mii_write_hi(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) ++{ ++ int ret; ++ u16 hi; ++ ++ hi = (u16)(val >> 16); ++ ret = bus->write(bus, phy_id, regnum, hi); ++ if (ret < 0) + dev_err_ratelimited(&bus->dev, +- "failed to read qca8k 32bit register\n"); +- *val = 0; +- return ret; +- } ++ "failed to write qca8k 32bit hi register\n"); + ++ return ret; ++} ++ ++static int ++qca8k_mii_read_lo(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) ++{ ++ int ret; ++ ++ ret = bus->read(bus, phy_id, regnum); ++ if (ret < 0) ++ goto err; ++ ++ *val = ret & 0xffff; + return 0; ++ ++err: ++ dev_err_ratelimited(&bus->dev, ++ "failed to read qca8k 32bit lo register\n"); ++ *val = 0; ++ ++ return ret; + } + +-static void +-qca8k_mii_write32(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) ++static int ++qca8k_mii_read_hi(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) + { +- u16 lo, hi; + int ret; + +- lo = val & 0xffff; +- hi = (u16)(val >> 16); ++ ret = bus->read(bus, phy_id, regnum); ++ if (ret < 0) ++ goto err; + +- ret = bus->write(bus, phy_id, regnum, lo); +- if (ret >= 0) +- ret = bus->write(bus, phy_id, regnum + 1, hi); ++ *val = ret << 16; ++ return 0; ++ ++err: ++ dev_err_ratelimited(&bus->dev, ++ "failed to read qca8k 32bit hi register\n"); ++ *val = 0; ++ ++ return ret; ++} ++ ++static int ++qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) ++{ ++ u32 hi, lo; ++ int ret; ++ ++ *val = 0; ++ ++ ret = qca8k_mii_read_lo(bus, phy_id, regnum, &lo); + if (ret < 0) +- dev_err_ratelimited(&bus->dev, +- "failed to write qca8k 32bit register\n"); ++ goto err; ++ ++ ret = qca8k_mii_read_hi(bus, phy_id, regnum + 1, &hi); ++ if (ret < 0) ++ goto err; ++ ++ *val = lo | hi; ++ ++err: ++ return ret; ++} ++ ++static void ++qca8k_mii_write32(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) ++{ ++ if (qca8k_mii_write_lo(bus, phy_id, regnum, val) < 0) ++ return; ++ ++ qca8k_mii_write_hi(bus, phy_id, regnum + 1, val); + } + + static int diff --git a/target/linux/generic/backport-5.15/777-v6.2-05-net-dsa-qca8k-improve-mdio-master-read-write-by-usin.patch b/target/linux/generic/backport-5.15/777-v6.2-05-net-dsa-qca8k-improve-mdio-master-read-write-by-usin.patch new file mode 100644 index 00000000000..4cbb66cf35f --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-05-net-dsa-qca8k-improve-mdio-master-read-write-by-usin.patch @@ -0,0 +1,73 @@ +From a4165830ca237f2b3318faf62562bce8ce12a389 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:36 +0100 +Subject: [PATCH 5/5] net: dsa: qca8k: improve mdio master read/write by using + single lo/hi + +Improve mdio master read/write by using singe mii read/write lo/hi. + +In a read and write we need to poll the mdio master regs in a busy loop +to check for a specific bit present in the upper half of the reg. We can +ignore the other half since it won't contain useful data. This will save +an additional useless read for each read and write operation. + +In a read operation the returned data is present in the mdio master reg +lower half. We can ignore the other half since it won't contain useful +data. This will save an additional useless read for each read operation. + +In a read operation it's needed to just set the hi half of the mdio +master reg as the lo half will be replaced by the result. This will save +an additional useless write for each read operation. + +Tested-by: Ronald Wahl +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -740,9 +740,9 @@ qca8k_mdio_busy_wait(struct mii_bus *bus + + qca8k_split_addr(reg, &r1, &r2, &page); + +- ret = read_poll_timeout(qca8k_mii_read32, ret1, !(val & mask), 0, ++ ret = read_poll_timeout(qca8k_mii_read_hi, ret1, !(val & mask), 0, + QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false, +- bus, 0x10 | r2, r1, &val); ++ bus, 0x10 | r2, r1 + 1, &val); + + /* Check if qca8k_read has failed for a different reason + * before returnting -ETIMEDOUT +@@ -784,7 +784,7 @@ qca8k_mdio_write(struct qca8k_priv *priv + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(bus, 0x10 | r2, r1, 0); ++ qca8k_mii_write_hi(bus, 0x10 | r2, r1 + 1, 0); + + mutex_unlock(&bus->mdio_lock); + +@@ -814,18 +814,18 @@ qca8k_mdio_read(struct qca8k_priv *priv, + if (ret) + goto exit; + +- qca8k_mii_write32(bus, 0x10 | r2, r1, val); ++ qca8k_mii_write_hi(bus, 0x10 | r2, r1 + 1, val); + + ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + if (ret) + goto exit; + +- ret = qca8k_mii_read32(bus, 0x10 | r2, r1, &val); ++ ret = qca8k_mii_read_lo(bus, 0x10 | r2, r1, &val); + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(bus, 0x10 | r2, r1, 0); ++ qca8k_mii_write_hi(bus, 0x10 | r2, r1 + 1, 0); + + mutex_unlock(&bus->mdio_lock); + diff --git a/target/linux/generic/backport-5.15/802-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch b/target/linux/generic/backport-5.15/802-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch new file mode 100644 index 00000000000..d90c28cb4b8 --- /dev/null +++ b/target/linux/generic/backport-5.15/802-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch @@ -0,0 +1,456 @@ +From 7ae6478b304bc004c3139b422665b0e23b57f05c Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:55 +0100 +Subject: [PATCH] nvmem: core: rework nvmem cell instance creation + +In the existing design, we do not create a instance per nvmem cell consumer +but we directly refer cell from nvmem cell list that are added to provider. + +However this design has some limitations when consumers want to assign name +or connection id the nvmem cell instance, ex: via "nvmem-cell-names" or +id in nvmem_cell_get(id). + +Having a name associated with nvmem cell consumer instance will help +provider drivers in performing post processing of nvmem cell data if required +before data is seen by the consumers. This is pretty normal with some vendors +storing nvmem cells like mac-address in a vendor specific data layouts that +are not directly usable by the consumer drivers. + +With this patch nvmem cell will be created dynamically during nvmem_cell_get +and destroyed in nvmem_cell_put, allowing consumers to associate name with +nvmem cell consumer instance. + +With this patch a new struct nvmem_cell_entry replaces struct nvmem_cell +for storing nvmem cell information within the core. +This patch does not change nvmem-consumer interface based on nvmem_cell. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 165 +++++++++++++++++++++++++++---------------- + 1 file changed, 105 insertions(+), 60 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -45,8 +45,7 @@ struct nvmem_device { + #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev) + + #define FLAG_COMPAT BIT(0) +- +-struct nvmem_cell { ++struct nvmem_cell_entry { + const char *name; + int offset; + int bytes; +@@ -57,6 +56,11 @@ struct nvmem_cell { + struct list_head node; + }; + ++struct nvmem_cell { ++ struct nvmem_cell_entry *entry; ++ const char *id; ++}; ++ + static DEFINE_MUTEX(nvmem_mutex); + static DEFINE_IDA(nvmem_ida); + +@@ -424,7 +428,7 @@ static struct bus_type nvmem_bus_type = + .name = "nvmem", + }; + +-static void nvmem_cell_drop(struct nvmem_cell *cell) ++static void nvmem_cell_entry_drop(struct nvmem_cell_entry *cell) + { + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_REMOVE, cell); + mutex_lock(&nvmem_mutex); +@@ -437,13 +441,13 @@ static void nvmem_cell_drop(struct nvmem + + static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem) + { +- struct nvmem_cell *cell, *p; ++ struct nvmem_cell_entry *cell, *p; + + list_for_each_entry_safe(cell, p, &nvmem->cells, node) +- nvmem_cell_drop(cell); ++ nvmem_cell_entry_drop(cell); + } + +-static void nvmem_cell_add(struct nvmem_cell *cell) ++static void nvmem_cell_entry_add(struct nvmem_cell_entry *cell) + { + mutex_lock(&nvmem_mutex); + list_add_tail(&cell->node, &cell->nvmem->cells); +@@ -451,9 +455,9 @@ static void nvmem_cell_add(struct nvmem_ + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_ADD, cell); + } + +-static int nvmem_cell_info_to_nvmem_cell_nodup(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry_nodup(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + cell->nvmem = nvmem; + cell->offset = info->offset; +@@ -477,13 +481,13 @@ static int nvmem_cell_info_to_nvmem_cell + return 0; + } + +-static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + int err; + +- err = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, cell); ++ err = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, cell); + if (err) + return err; + +@@ -507,7 +511,7 @@ static int nvmem_add_cells(struct nvmem_ + const struct nvmem_cell_info *info, + int ncells) + { +- struct nvmem_cell **cells; ++ struct nvmem_cell_entry **cells; + int i, rval; + + cells = kcalloc(ncells, sizeof(*cells), GFP_KERNEL); +@@ -521,13 +525,13 @@ static int nvmem_add_cells(struct nvmem_ + goto err; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, &info[i], cells[i]); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, &info[i], cells[i]); + if (rval) { + kfree(cells[i]); + goto err; + } + +- nvmem_cell_add(cells[i]); ++ nvmem_cell_entry_add(cells[i]); + } + + /* remove tmp array */ +@@ -536,7 +540,7 @@ static int nvmem_add_cells(struct nvmem_ + return 0; + err: + while (i--) +- nvmem_cell_drop(cells[i]); ++ nvmem_cell_entry_drop(cells[i]); + + kfree(cells); + +@@ -573,7 +577,7 @@ static int nvmem_add_cells_from_table(st + { + const struct nvmem_cell_info *info; + struct nvmem_cell_table *table; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + int rval = 0, i; + + mutex_lock(&nvmem_cell_mutex); +@@ -588,15 +592,13 @@ static int nvmem_add_cells_from_table(st + goto out; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, +- info, +- cell); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, info, cell); + if (rval) { + kfree(cell); + goto out; + } + +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + } + } +@@ -606,10 +608,10 @@ out: + return rval; + } + +-static struct nvmem_cell * +-nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_name(struct nvmem_device *nvmem, const char *cell_id) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -680,7 +682,7 @@ static int nvmem_add_cells_from_of(struc + { + struct device_node *parent, *child; + struct device *dev = &nvmem->dev; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + const __be32 *addr; + int len; + +@@ -729,7 +731,7 @@ static int nvmem_add_cells_from_of(struc + } + + cell->np = of_node_get(child); +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + + return 0; +@@ -1141,9 +1143,33 @@ struct nvmem_device *devm_nvmem_device_g + } + EXPORT_SYMBOL_GPL(devm_nvmem_device_get); + ++static struct nvmem_cell *nvmem_create_cell(struct nvmem_cell_entry *entry, const char *id) ++{ ++ struct nvmem_cell *cell; ++ const char *name = NULL; ++ ++ cell = kzalloc(sizeof(*cell), GFP_KERNEL); ++ if (!cell) ++ return ERR_PTR(-ENOMEM); ++ ++ if (id) { ++ name = kstrdup_const(id, GFP_KERNEL); ++ if (!name) { ++ kfree(cell); ++ return ERR_PTR(-ENOMEM); ++ } ++ } ++ ++ cell->id = name; ++ cell->entry = entry; ++ ++ return cell; ++} ++ + static struct nvmem_cell * + nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) + { ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell = ERR_PTR(-ENOENT); + struct nvmem_cell_lookup *lookup; + struct nvmem_device *nvmem; +@@ -1168,11 +1194,15 @@ nvmem_cell_get_from_lookup(struct device + break; + } + +- cell = nvmem_find_cell_by_name(nvmem, +- lookup->cell_name); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_name(nvmem, ++ lookup->cell_name); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + cell = ERR_PTR(-ENOENT); ++ } else { ++ cell = nvmem_create_cell(cell_entry, con_id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); + } + break; + } +@@ -1183,10 +1213,10 @@ nvmem_cell_get_from_lookup(struct device + } + + #if IS_ENABLED(CONFIG_OF) +-static struct nvmem_cell * +-nvmem_find_cell_by_node(struct nvmem_device *nvmem, struct device_node *np) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_node(struct nvmem_device *nvmem, struct device_node *np) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -1216,6 +1246,7 @@ struct nvmem_cell *of_nvmem_cell_get(str + { + struct device_node *cell_np, *nvmem_np; + struct nvmem_device *nvmem; ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell; + int index = 0; + +@@ -1236,12 +1267,16 @@ struct nvmem_cell *of_nvmem_cell_get(str + if (IS_ERR(nvmem)) + return ERR_CAST(nvmem); + +- cell = nvmem_find_cell_by_node(nvmem, cell_np); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_node(nvmem, cell_np); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + return ERR_PTR(-ENOENT); + } + ++ cell = nvmem_create_cell(cell_entry, id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); ++ + return cell; + } + EXPORT_SYMBOL_GPL(of_nvmem_cell_get); +@@ -1347,13 +1382,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put); + */ + void nvmem_cell_put(struct nvmem_cell *cell) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; ++ ++ if (cell->id) ++ kfree_const(cell->id); + ++ kfree(cell); + __nvmem_device_put(nvmem); + } + EXPORT_SYMBOL_GPL(nvmem_cell_put); + +-static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) ++static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void *buf) + { + u8 *p, *b; + int i, extra, bit_offset = cell->bit_offset; +@@ -1387,8 +1426,8 @@ static void nvmem_shift_read_buffer_in_p + } + + static int __nvmem_cell_read(struct nvmem_device *nvmem, +- struct nvmem_cell *cell, +- void *buf, size_t *len) ++ struct nvmem_cell_entry *cell, ++ void *buf, size_t *len, const char *id) + { + int rc; + +@@ -1419,18 +1458,18 @@ static int __nvmem_cell_read(struct nvme + */ + void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; + u8 *buf; + int rc; + + if (!nvmem) + return ERR_PTR(-EINVAL); + +- buf = kzalloc(cell->bytes, GFP_KERNEL); ++ buf = kzalloc(cell->entry->bytes, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + +- rc = __nvmem_cell_read(nvmem, cell, buf, len); ++ rc = __nvmem_cell_read(nvmem, cell->entry, buf, len, cell->id); + if (rc) { + kfree(buf); + return ERR_PTR(rc); +@@ -1440,7 +1479,7 @@ void *nvmem_cell_read(struct nvmem_cell + } + EXPORT_SYMBOL_GPL(nvmem_cell_read); + +-static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, ++static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell_entry *cell, + u8 *_buf, int len) + { + struct nvmem_device *nvmem = cell->nvmem; +@@ -1493,16 +1532,7 @@ err: + return ERR_PTR(rc); + } + +-/** +- * nvmem_cell_write() - Write to a given nvmem cell +- * +- * @cell: nvmem cell to be written. +- * @buf: Buffer to be written. +- * @len: length of buffer to be written to nvmem cell. +- * +- * Return: length of bytes written or negative on failure. +- */ +-int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++static int __nvmem_cell_entry_write(struct nvmem_cell_entry *cell, void *buf, size_t len) + { + struct nvmem_device *nvmem = cell->nvmem; + int rc; +@@ -1528,6 +1558,21 @@ int nvmem_cell_write(struct nvmem_cell * + + return len; + } ++ ++/** ++ * nvmem_cell_write() - Write to a given nvmem cell ++ * ++ * @cell: nvmem cell to be written. ++ * @buf: Buffer to be written. ++ * @len: length of buffer to be written to nvmem cell. ++ * ++ * Return: length of bytes written or negative on failure. ++ */ ++int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++{ ++ return __nvmem_cell_entry_write(cell->entry, buf, len); ++} ++ + EXPORT_SYMBOL_GPL(nvmem_cell_write); + + static int nvmem_cell_read_common(struct device *dev, const char *cell_id, +@@ -1630,7 +1675,7 @@ static const void *nvmem_cell_read_varia + if (IS_ERR(cell)) + return cell; + +- nbits = cell->nbits; ++ nbits = cell->entry->nbits; + buf = nvmem_cell_read(cell, len); + nvmem_cell_put(cell); + if (IS_ERR(buf)) +@@ -1726,18 +1771,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab + ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + ssize_t len; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- rc = __nvmem_cell_read(nvmem, &cell, buf, &len); ++ rc = __nvmem_cell_read(nvmem, &cell, buf, &len, NULL); + if (rc) + return rc; + +@@ -1757,17 +1802,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read + int nvmem_device_cell_write(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- return nvmem_cell_write(&cell, buf, cell.bytes); ++ return __nvmem_cell_entry_write(&cell, buf, cell.bytes); + } + EXPORT_SYMBOL_GPL(nvmem_device_cell_write); + diff --git a/target/linux/generic/backport-5.15/802-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch b/target/linux/generic/backport-5.15/802-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch new file mode 100644 index 00000000000..93a540c2b14 --- /dev/null +++ b/target/linux/generic/backport-5.15/802-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch @@ -0,0 +1,82 @@ +From 5008062f1c3f5af3acf86164aa6fcc77b0c7bdce Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:56 +0100 +Subject: [PATCH] nvmem: core: add nvmem cell post processing callback + +Some NVMEM providers have certain nvmem cells encoded, which requires +post processing before actually using it. + +For example mac-address is stored in either in ascii or delimited or reverse-order. + +Having a post-process callback hook to provider drivers would enable them to +do this vendor specific post processing before nvmem consumers see it. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 9 +++++++++ + include/linux/nvmem-provider.h | 5 +++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -38,6 +38,7 @@ struct nvmem_device { + unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + struct gpio_desc *wp_gpio; + void *priv; + }; +@@ -798,6 +799,7 @@ struct nvmem_device *nvmem_register(cons + nvmem->type = config->type; + nvmem->reg_read = config->reg_read; + nvmem->reg_write = config->reg_write; ++ nvmem->cell_post_process = config->cell_post_process; + nvmem->keepout = config->keepout; + nvmem->nkeepout = config->nkeepout; + if (config->of_node) +@@ -1440,6 +1442,13 @@ static int __nvmem_cell_read(struct nvme + if (cell->bit_offset || cell->nbits) + nvmem_shift_read_buffer_in_place(cell, buf); + ++ if (nvmem->cell_post_process) { ++ rc = nvmem->cell_post_process(nvmem->priv, id, ++ cell->offset, buf, cell->bytes); ++ if (rc) ++ return rc; ++ } ++ + if (len) + *len = cell->bytes; + +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -19,6 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *pr + void *val, size_t bytes); + typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, + void *val, size_t bytes); ++/* used for vendor specific post processing of cell data */ ++typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, unsigned int offset, ++ void *buf, size_t bytes); + + enum nvmem_type { + NVMEM_TYPE_UNKNOWN = 0, +@@ -62,6 +65,7 @@ struct nvmem_keepout { + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. + * @reg_read: Callback to read data. + * @reg_write: Callback to write data. ++ * @cell_post_process: Callback for vendor specific post processing of cell data + * @size: Device size. + * @word_size: Minimum read/write access granularity. + * @stride: Minimum read/write access stride. +@@ -94,6 +98,7 @@ struct nvmem_config { + bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + int size; + int word_size; + int stride; diff --git a/target/linux/generic/backport-5.15/802-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch b/target/linux/generic/backport-5.15/802-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch new file mode 100644 index 00000000000..ee19228270d --- /dev/null +++ b/target/linux/generic/backport-5.15/802-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch @@ -0,0 +1,92 @@ +From d0221a780cbc99fec6c27a98dba2828dc5735c00 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:57 +0100 +Subject: [PATCH] nvmem: imx-ocotp: add support for post processing + +Add .cell_post_process callback for imx-ocotp to deal with MAC address, +since MAC address need to be reversed byte for some i.MX SoCs. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -97,6 +97,7 @@ struct ocotp_params { + unsigned int bank_address_words; + void (*set_timing)(struct ocotp_priv *priv); + struct ocotp_ctrl_reg ctrl; ++ bool reverse_mac_address; + }; + + static int imx_ocotp_wait_for_busy(struct ocotp_priv *priv, u32 flags) +@@ -221,6 +222,25 @@ read_end: + return ret; + } + ++static int imx_ocotp_cell_pp(void *context, const char *id, unsigned int offset, ++ void *data, size_t bytes) ++{ ++ struct ocotp_priv *priv = context; ++ ++ /* Deal with some post processing of nvmem cell data */ ++ if (id && !strcmp(id, "mac-address")) { ++ if (priv->params->reverse_mac_address) { ++ u8 *buf = data; ++ int i; ++ ++ for (i = 0; i < bytes/2; i++) ++ swap(buf[i], buf[bytes - i - 1]); ++ } ++ } ++ ++ return 0; ++} ++ + static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) + { + unsigned long clk_rate; +@@ -468,6 +488,7 @@ static struct nvmem_config imx_ocotp_nvm + .stride = 1, + .reg_read = imx_ocotp_read, + .reg_write = imx_ocotp_write, ++ .cell_post_process = imx_ocotp_cell_pp, + }; + + static const struct ocotp_params imx6q_params = { +@@ -530,6 +551,7 @@ static const struct ocotp_params imx8mq_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mm_params = { +@@ -537,6 +559,7 @@ static const struct ocotp_params imx8mm_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mn_params = { +@@ -544,6 +567,7 @@ static const struct ocotp_params imx8mn_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mp_params = { +@@ -551,6 +575,7 @@ static const struct ocotp_params imx8mp_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_8MP, ++ .reverse_mac_address = true, + }; + + static const struct of_device_id imx_ocotp_dt_ids[] = { diff --git a/target/linux/generic/backport-5.15/803-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch b/target/linux/generic/backport-5.15/803-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch new file mode 100644 index 00000000000..785bfe53f54 --- /dev/null +++ b/target/linux/generic/backport-5.15/803-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch @@ -0,0 +1,47 @@ +From 98e2c4efae214fb7086cac9117616eb6ea11475d Mon Sep 17 00:00:00 2001 +From: Chunfeng Yun +Date: Thu, 9 Dec 2021 17:42:34 +0000 +Subject: [PATCH] nvmem: mtk-efuse: support minimum one byte access stride and + granularity + +In order to support nvmem bits property, should support minimum 1 byte +read stride and minimum 1 byte read granularity at the same time. + +Signed-off-by: Chunfeng Yun +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211209174235.14049-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/mtk-efuse.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -19,11 +19,12 @@ static int mtk_reg_read(void *context, + unsigned int reg, void *_val, size_t bytes) + { + struct mtk_efuse_priv *priv = context; +- u32 *val = _val; +- int i = 0, words = bytes / 4; ++ void __iomem *addr = priv->base + reg; ++ u8 *val = _val; ++ int i; + +- while (words--) +- *val++ = readl(priv->base + reg + (i++ * 4)); ++ for (i = 0; i < bytes; i++, val++) ++ *val = readb(addr + i); + + return 0; + } +@@ -45,8 +46,8 @@ static int mtk_efuse_probe(struct platfo + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + +- econfig.stride = 4; +- econfig.word_size = 4; ++ econfig.stride = 1; ++ econfig.word_size = 1; + econfig.reg_read = mtk_reg_read; + econfig.size = resource_size(res); + econfig.priv = priv; diff --git a/target/linux/generic/backport-5.15/804-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch b/target/linux/generic/backport-5.15/804-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch new file mode 100644 index 00000000000..efa380288a4 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch @@ -0,0 +1,72 @@ +From 190fae468592bc2f0efc8b928920f8f712b5831e Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:15 +0000 +Subject: [PATCH] nvmem: core: Remove unused devm_nvmem_unregister() + +There are no users and seems no will come of the devm_nvmem_unregister(). +Remove the function and remove the unused devm_nvmem_match() along with it. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 ---------------------- + include/linux/nvmem-provider.h | 8 -------- + 2 files changed, 30 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -942,28 +942,6 @@ struct nvmem_device *devm_nvmem_register + } + EXPORT_SYMBOL_GPL(devm_nvmem_register); + +-static int devm_nvmem_match(struct device *dev, void *res, void *data) +-{ +- struct nvmem_device **r = res; +- +- return *r == data; +-} +- +-/** +- * devm_nvmem_unregister() - Unregister previously registered managed nvmem +- * device. +- * +- * @dev: Device that uses the nvmem device. +- * @nvmem: Pointer to previously registered nvmem device. +- * +- * Return: Will be negative on error or zero on success. +- */ +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return devres_release(dev, devm_nvmem_release, devm_nvmem_match, nvmem); +-} +-EXPORT_SYMBOL(devm_nvmem_unregister); +- + static struct nvmem_device *__nvmem_device_get(void *data, + int (*match)(struct device *dev, const void *data)) + { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -135,8 +135,6 @@ void nvmem_unregister(struct nvmem_devic + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *cfg); + +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem); +- + void nvmem_add_cell_table(struct nvmem_cell_table *table); + void nvmem_del_cell_table(struct nvmem_cell_table *table); + +@@ -155,12 +153,6 @@ devm_nvmem_register(struct device *dev, + return nvmem_register(c); + } + +-static inline int +-devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return -EOPNOTSUPP; +-} +- + static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {} + static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {} + diff --git a/target/linux/generic/backport-5.15/804-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch b/target/linux/generic/backport-5.15/804-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch new file mode 100644 index 00000000000..28e8ba465d5 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch @@ -0,0 +1,58 @@ +From 5825b2c6762611e67ccaf3ccf64485365a120f0b Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:16 +0000 +Subject: [PATCH] nvmem: core: Use devm_add_action_or_reset() + +Slightly simplify the devm_nvmem_register() by using the +devm_add_action_or_reset(). + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 +++++++++------------- + 1 file changed, 9 insertions(+), 13 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -904,9 +904,9 @@ void nvmem_unregister(struct nvmem_devic + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + +-static void devm_nvmem_release(struct device *dev, void *res) ++static void devm_nvmem_unregister(void *nvmem) + { +- nvmem_unregister(*(struct nvmem_device **)res); ++ nvmem_unregister(nvmem); + } + + /** +@@ -923,20 +923,16 @@ static void devm_nvmem_release(struct de + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *config) + { +- struct nvmem_device **ptr, *nvmem; +- +- ptr = devres_alloc(devm_nvmem_release, sizeof(*ptr), GFP_KERNEL); +- if (!ptr) +- return ERR_PTR(-ENOMEM); ++ struct nvmem_device *nvmem; ++ int ret; + + nvmem = nvmem_register(config); ++ if (IS_ERR(nvmem)) ++ return nvmem; + +- if (!IS_ERR(nvmem)) { +- *ptr = nvmem; +- devres_add(dev, ptr); +- } else { +- devres_free(ptr); +- } ++ ret = devm_add_action_or_reset(dev, devm_nvmem_unregister, nvmem); ++ if (ret) ++ return ERR_PTR(ret); + + return nvmem; + } diff --git a/target/linux/generic/backport-5.15/804-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch b/target/linux/generic/backport-5.15/804-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch new file mode 100644 index 00000000000..d7933094261 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch @@ -0,0 +1,30 @@ +From 8c751e0d9a5264376935a84429a2d468c8877d99 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:17 +0000 +Subject: [PATCH] nvmem: core: Check input parameter for NULL in + nvmem_unregister() + +nvmem_unregister() frees resources and standard pattern is to allow +caller to not care if it's NULL or not. This will reduce burden on +the callers to perform this check. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -900,7 +900,8 @@ static void nvmem_device_release(struct + */ + void nvmem_unregister(struct nvmem_device *nvmem) + { +- kref_put(&nvmem->refcnt, nvmem_device_release); ++ if (nvmem) ++ kref_put(&nvmem->refcnt, nvmem_device_release); + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + diff --git a/target/linux/generic/backport-5.15/804-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch b/target/linux/generic/backport-5.15/804-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch new file mode 100644 index 00000000000..c98f8e9d545 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch @@ -0,0 +1,29 @@ +From 05196facc052385960028ac634447ecf6c764ec3 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Sun, 20 Feb 2022 15:15:18 +0000 +Subject: [PATCH] nvmem: qfprom: fix kerneldoc warning + +This patch fixes below kernel doc warning, +warning: expecting prototype for qfprom_efuse_reg_write(). +Prototype was for qfprom_reg_write() instead + +No code changes. + +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -244,7 +244,7 @@ err_clk_prepared: + } + + /** +- * qfprom_efuse_reg_write() - Write to fuses. ++ * qfprom_reg_write() - Write to fuses. + * @context: Our driver data. + * @reg: The offset to write at. + * @_val: Pointer to data to write. diff --git a/target/linux/generic/backport-5.15/804-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch b/target/linux/generic/backport-5.15/804-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch new file mode 100644 index 00000000000..6aad6af0800 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch @@ -0,0 +1,38 @@ +From 07ae4fde9efada7878e1383d6ccc7da70315ca23 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 20 Feb 2022 15:15:20 +0000 +Subject: [PATCH] nvmem: sunxi_sid: Add support for D1 variant + +D1 has a smaller eFuse block than some other recent SoCs, and it no +longer requires a workaround to read the eFuse data. + +Signed-off-by: Samuel Holland +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunxi_sid.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -184,6 +184,11 @@ static const struct sunxi_sid_cfg sun8i_ + .need_register_readout = true, + }; + ++static const struct sunxi_sid_cfg sun20i_d1_cfg = { ++ .value_offset = 0x200, ++ .size = 0x100, ++}; ++ + static const struct sunxi_sid_cfg sun50i_a64_cfg = { + .value_offset = 0x200, + .size = 0x100, +@@ -200,6 +205,7 @@ static const struct of_device_id sunxi_s + { .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg }, + { .compatible = "allwinner,sun8i-a83t-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_cfg }, ++ { .compatible = "allwinner,sun20i-d1-sid", .data = &sun20i_d1_cfg }, + { .compatible = "allwinner,sun50i-a64-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h5-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h6-sid", .data = &sun50i_h6_cfg }, diff --git a/target/linux/generic/backport-5.15/804-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch b/target/linux/generic/backport-5.15/804-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch new file mode 100644 index 00000000000..a73b42c5de3 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch @@ -0,0 +1,28 @@ +From 4dc8d89faed9bb05f116fa1794fc955b14910386 Mon Sep 17 00:00:00 2001 +From: Xiaoke Wang +Date: Sun, 20 Feb 2022 15:15:21 +0000 +Subject: [PATCH] nvmem: meson-mx-efuse: replace unnecessary devm_kstrdup() + +Replace unnecessary devm_kstrdup() so to avoid redundant memory allocation. + +Suggested-by: Martin Blumenstingl +Signed-off-by: Xiaoke Wang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/meson-mx-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/meson-mx-efuse.c ++++ b/drivers/nvmem/meson-mx-efuse.c +@@ -209,8 +209,7 @@ static int meson_mx_efuse_probe(struct p + if (IS_ERR(efuse->base)) + return PTR_ERR(efuse->base); + +- efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name, +- GFP_KERNEL); ++ efuse->config.name = drvdata->name; + efuse->config.owner = THIS_MODULE; + efuse->config.dev = &pdev->dev; + efuse->config.priv = efuse; diff --git a/target/linux/generic/backport-5.15/804-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch b/target/linux/generic/backport-5.15/804-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch new file mode 100644 index 00000000000..6afb68b3f91 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch @@ -0,0 +1,139 @@ +From f78451012b9e159afdba31c3eb69f223a9f42adc Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Sun, 20 Feb 2022 15:15:23 +0000 +Subject: [PATCH] nvmem: add driver for Layerscape SFP (Security Fuse + Processor) + +Add support for the Security Fuse Processor found on Layerscape SoCs. +This driver implements basic read access. + +Signed-off-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 +++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/layerscape-sfp.c | 89 ++++++++++++++++++++++++++++++++++ + 3 files changed, 103 insertions(+) + create mode 100644 drivers/nvmem/layerscape-sfp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -300,4 +300,16 @@ config NVMEM_BRCM_NVRAM + This driver provides support for Broadcom's NVRAM that can be accessed + using I/O mapping. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. + nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o + nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o +--- /dev/null ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -0,0 +1,89 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Layerscape SFP driver ++ * ++ * Copyright (c) 2022 Michael Walle ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 ++ ++struct layerscape_sfp_priv { ++ void __iomem *base; ++}; ++ ++struct layerscape_sfp_data { ++ int size; ++}; ++ ++static int layerscape_sfp_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct layerscape_sfp_priv *priv = context; ++ ++ memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, ++ bytes); ++ ++ return 0; ++} ++ ++static struct nvmem_config layerscape_sfp_nvmem_config = { ++ .name = "fsl-sfp", ++ .reg_read = layerscape_sfp_read, ++}; ++ ++static int layerscape_sfp_probe(struct platform_device *pdev) ++{ ++ const struct layerscape_sfp_data *data; ++ struct layerscape_sfp_priv *priv; ++ struct nvmem_device *nvmem; ++ ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(priv->base)) ++ return PTR_ERR(priv->base); ++ ++ data = device_get_match_data(&pdev->dev); ++ ++ layerscape_sfp_nvmem_config.size = data->size; ++ layerscape_sfp_nvmem_config.dev = &pdev->dev; ++ layerscape_sfp_nvmem_config.priv = priv; ++ ++ nvmem = devm_nvmem_register(&pdev->dev, &layerscape_sfp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct layerscape_sfp_data ls1028a_data = { ++ .size = 0x88, ++}; ++ ++static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, layerscape_sfp_dt_ids); ++ ++static struct platform_driver layerscape_sfp_driver = { ++ .probe = layerscape_sfp_probe, ++ .driver = { ++ .name = "layerscape_sfp", ++ .of_match_table = layerscape_sfp_dt_ids, ++ }, ++}; ++module_platform_driver(layerscape_sfp_driver); ++ ++MODULE_AUTHOR("Michael Walle "); ++MODULE_DESCRIPTION("Layerscape Security Fuse Processor driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/804-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch b/target/linux/generic/backport-5.15/804-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch new file mode 100644 index 00000000000..74bd4a7eb67 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch @@ -0,0 +1,32 @@ +From bc5c75e0a5a9400f81a987cc720100ac475fa4d8 Mon Sep 17 00:00:00 2001 +From: Knox Chiou +Date: Wed, 23 Feb 2022 22:35:00 +0000 +Subject: [PATCH] nvmem: qfprom: Increase fuse blow timeout to prevent write + fail + +sc7180 blow fuses got slightly chances to hit qfprom_reg_write timeout. +Current timeout is simply too low. Since blowing fuses is a +very rare operation, so the risk associated with overestimating this +number is low. +Increase fuse blow timeout from 1ms to 10ms. + +Reviewed-by: Douglas Anderson +Signed-off-by: Knox Chiou +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -22,7 +22,7 @@ + + /* Amount of time required to hold charge to blow fuse in micro-seconds */ + #define QFPROM_FUSE_BLOW_POLL_US 100 +-#define QFPROM_FUSE_BLOW_TIMEOUT_US 1000 ++#define QFPROM_FUSE_BLOW_TIMEOUT_US 10000 + + #define QFPROM_BLOW_STATUS_OFFSET 0x048 + #define QFPROM_BLOW_STATUS_BUSY 0x1 diff --git a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch new file mode 100644 index 00000000000..07c5808403b --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -0,0 +1,291 @@ +From 8747ec2e9762ed9ae53b3a590938f454b6a1abdf Mon Sep 17 00:00:00 2001 +From: Vincent Shih +Date: Wed, 23 Feb 2022 22:35:01 +0000 +Subject: [PATCH] nvmem: Add driver for OCOTP in Sunplus SP7021 + +Add driver for OCOTP in Sunplus SP7021 + +Signed-off-by: Vincent Shih +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 5 + + drivers/nvmem/Kconfig | 12 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/sunplus-ocotp.c | 228 ++++++++++++++++++++++++++++++++++ + 4 files changed, 247 insertions(+) + create mode 100644 drivers/nvmem/sunplus-ocotp.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -17953,6 +17953,11 @@ L: netdev@vger.kernel.org + S: Maintained + F: drivers/net/ethernet/dlink/sundance.c + ++SUNPLUS OCOTP DRIVER ++M: Vincent Shih ++S: Maintained ++F: drivers/nvmem/sunplus-ocotp.c ++ + SUPERH + M: Yoshinori Sato + M: Rich Felker +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -312,4 +312,16 @@ config NVMEM_LAYERSCAPE_SFP + This driver can also be built as a module. If so, the module + will be called layerscape-sfp. + ++config NVMEM_SUNPLUS_OCOTP ++ tristate "Sunplus SoC OTP support" ++ depends on SOC_SP7021 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the On-chip OTP controller (OCOTP) available ++ on Sunplus SoCs. It provides access to 128 bytes of one-time ++ programmable eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-sunplus-ocotp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -63,3 +63,5 @@ obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_ + nvmem_brcm_nvram-y := brcm_nvram.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o ++obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o +--- /dev/null ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -0,0 +1,228 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/* ++ * The OCOTP driver for Sunplus SP7021 ++ * ++ * Copyright (C) 2019 Sunplus Technology Inc., All rights reserved. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * OTP memory ++ * Each bank contains 4 words (32 bits). ++ * Bank 0 starts at offset 0 from the base. ++ */ ++ ++#define OTP_WORDS_PER_BANK 4 ++#define OTP_WORD_SIZE sizeof(u32) ++#define OTP_BIT_ADDR_OF_BANK (8 * OTP_WORD_SIZE * OTP_WORDS_PER_BANK) ++#define QAC628_OTP_NUM_BANKS 8 ++#define QAC628_OTP_SIZE (QAC628_OTP_NUM_BANKS * OTP_WORDS_PER_BANK * OTP_WORD_SIZE) ++#define OTP_READ_TIMEOUT_US 200000 ++ ++/* HB_GPIO */ ++#define ADDRESS_8_DATA 0x20 ++ ++/* OTP_RX */ ++#define OTP_CONTROL_2 0x48 ++#define OTP_RD_PERIOD GENMASK(15, 8) ++#define OTP_RD_PERIOD_MASK ~GENMASK(15, 8) ++#define CPU_CLOCK FIELD_PREP(OTP_RD_PERIOD, 30) ++#define SEL_BAK_KEY2 BIT(5) ++#define SEL_BAK_KEY2_MASK ~BIT(5) ++#define SW_TRIM_EN BIT(4) ++#define SW_TRIM_EN_MASK ~BIT(4) ++#define SEL_BAK_KEY BIT(3) ++#define SEL_BAK_KEY_MASK ~BIT(3) ++#define OTP_READ BIT(2) ++#define OTP_LOAD_SECURE_DATA BIT(1) ++#define OTP_LOAD_SECURE_DATA_MASK ~BIT(1) ++#define OTP_DO_CRC BIT(0) ++#define OTP_DO_CRC_MASK ~BIT(0) ++#define OTP_STATUS 0x4c ++#define OTP_READ_DONE BIT(4) ++#define OTP_READ_DONE_MASK ~BIT(4) ++#define OTP_LOAD_SECURE_DONE_MASK ~BIT(2) ++#define OTP_READ_ADDRESS 0x50 ++ ++enum base_type { ++ HB_GPIO, ++ OTPRX, ++ BASEMAX, ++}; ++ ++struct sp_ocotp_priv { ++ struct device *dev; ++ void __iomem *base[BASEMAX]; ++ struct clk *clk; ++}; ++ ++struct sp_ocotp_data { ++ int size; ++}; ++ ++const struct sp_ocotp_data sp_otp_v0 = { ++ .size = QAC628_OTP_SIZE, ++}; ++ ++static int sp_otp_read_real(struct sp_ocotp_priv *otp, int addr, char *value) ++{ ++ unsigned int addr_data; ++ unsigned int byte_shift; ++ unsigned int status; ++ int ret; ++ ++ addr_data = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr_data = addr_data / OTP_WORD_SIZE; ++ ++ byte_shift = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ byte_shift = byte_shift % OTP_WORD_SIZE; ++ ++ addr = addr / (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr = addr * OTP_BIT_ADDR_OF_BANK; ++ ++ writel(readl(otp->base[OTPRX] + OTP_STATUS) & OTP_READ_DONE_MASK & ++ OTP_LOAD_SECURE_DONE_MASK, otp->base[OTPRX] + OTP_STATUS); ++ writel(addr, otp->base[OTPRX] + OTP_READ_ADDRESS); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) | OTP_READ, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) & SEL_BAK_KEY2_MASK & SW_TRIM_EN_MASK ++ & SEL_BAK_KEY_MASK & OTP_LOAD_SECURE_DATA_MASK & OTP_DO_CRC_MASK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel((readl(otp->base[OTPRX] + OTP_CONTROL_2) & OTP_RD_PERIOD_MASK) | CPU_CLOCK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ ++ ret = readl_poll_timeout(otp->base[OTPRX] + OTP_STATUS, status, ++ status & OTP_READ_DONE, 10, OTP_READ_TIMEOUT_US); ++ ++ if (ret < 0) ++ return ret; ++ ++ *value = (readl(otp->base[HB_GPIO] + ADDRESS_8_DATA + addr_data * OTP_WORD_SIZE) ++ >> (8 * byte_shift)) & 0xff; ++ ++ return ret; ++} ++ ++static int sp_ocotp_read(void *priv, unsigned int offset, void *value, size_t bytes) ++{ ++ struct sp_ocotp_priv *otp = priv; ++ unsigned int addr; ++ char *buf = value; ++ char val[4]; ++ int ret; ++ ++ ret = clk_enable(otp->clk); ++ if (ret) ++ return ret; ++ ++ *buf = 0; ++ for (addr = offset; addr < (offset + bytes); addr++) { ++ ret = sp_otp_read_real(otp, addr, val); ++ if (ret < 0) { ++ dev_err(otp->dev, "OTP read fail:%d at %d", ret, addr); ++ goto disable_clk; ++ } ++ ++ *buf++ = *val; ++ } ++ ++disable_clk: ++ clk_disable(otp->clk); ++ ++ return ret; ++} ++ ++static struct nvmem_config sp_ocotp_nvmem_config = { ++ .name = "sp-ocotp", ++ .read_only = true, ++ .word_size = 1, ++ .size = QAC628_OTP_SIZE, ++ .stride = 1, ++ .reg_read = sp_ocotp_read, ++ .owner = THIS_MODULE, ++}; ++ ++static int sp_ocotp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct sp_ocotp_priv *otp; ++ struct resource *res; ++ int ret; ++ ++ otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hb_gpio"); ++ otp->base[HB_GPIO] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[HB_GPIO])) ++ return PTR_ERR(otp->base[HB_GPIO]); ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otprx"); ++ otp->base[OTPRX] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[OTPRX])) ++ return PTR_ERR(otp->base[OTPRX]); ++ ++ otp->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(otp->clk)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(otp->clk), ++ "devm_clk_get fail\n"); ++ ++ ret = clk_prepare(otp->clk); ++ if (ret < 0) { ++ dev_err(dev, "failed to prepare clk: %d\n", ret); ++ return ret; ++ } ++ ++ sp_ocotp_nvmem_config.priv = otp; ++ sp_ocotp_nvmem_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &sp_ocotp_nvmem_config); ++ if (IS_ERR(nvmem)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(nvmem), ++ "register nvmem device fail\n"); ++ ++ platform_set_drvdata(pdev, nvmem); ++ ++ dev_dbg(dev, "banks:%d x wpb:%d x wsize:%d = %d", ++ (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, ++ (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); ++ ++ dev_info(dev, "by Sunplus (C) 2020"); ++ ++ return 0; ++} ++ ++static const struct of_device_id sp_ocotp_dt_ids[] = { ++ { .compatible = "sunplus,sp7021-ocotp", .data = &sp_otp_v0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, sp_ocotp_dt_ids); ++ ++static struct platform_driver sp_otp_driver = { ++ .probe = sp_ocotp_probe, ++ .driver = { ++ .name = "sunplus,sp7021-ocotp", ++ .of_match_table = sp_ocotp_dt_ids, ++ } ++}; ++module_platform_driver(sp_otp_driver); ++ ++MODULE_AUTHOR("Vincent Shih "); ++MODULE_DESCRIPTION("Sunplus On-Chip OTP driver"); ++MODULE_LICENSE("GPL"); ++ diff --git a/target/linux/bcm53xx/patches-5.15/080-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch b/target/linux/generic/backport-5.15/804-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.15/080-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch rename to target/linux/generic/backport-5.15/804-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch diff --git a/target/linux/generic/backport-5.15/805-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch b/target/linux/generic/backport-5.15/805-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch new file mode 100644 index 00000000000..ef3107db946 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch @@ -0,0 +1,32 @@ +From 6bd0ffeaa389866089e9573b2298ae58d6359b75 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:24 +0100 +Subject: [PATCH] nvmem: bcm-ocotp: mark ACPI device ID table as maybe unused +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +"bcm_otpc_acpi_ids" is used with ACPI_PTR, so a build with !CONFIG_ACPI +has a warning: + + drivers/nvmem/bcm-ocotp.c:247:36: error: + ‘bcm_otpc_acpi_ids’ defined but not used [-Werror=unused-const-variable=] + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-1-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/bcm-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/bcm-ocotp.c ++++ b/drivers/nvmem/bcm-ocotp.c +@@ -244,7 +244,7 @@ static const struct of_device_id bcm_otp + }; + MODULE_DEVICE_TABLE(of, bcm_otpc_dt_ids); + +-static const struct acpi_device_id bcm_otpc_acpi_ids[] = { ++static const struct acpi_device_id bcm_otpc_acpi_ids[] __maybe_unused = { + { .id = "BRCM0700", .driver_data = (kernel_ulong_t)&otp_map }, + { .id = "BRCM0701", .driver_data = (kernel_ulong_t)&otp_map_v2 }, + { /* sentinel */ } diff --git a/target/linux/generic/backport-5.15/805-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch b/target/linux/generic/backport-5.15/805-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch new file mode 100644 index 00000000000..a84d2316f0c --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch @@ -0,0 +1,30 @@ +From 1066f8156351fcd997125257cea47cf805ba4f6d Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:25 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: staticize sp_otp_v0 + +The "sp_otp_v0" file scope variable is not used outside, so make it +static to fix warning: + + drivers/nvmem/sunplus-ocotp.c:74:29: sparse: + sparse: symbol 'sp_otp_v0' was not declared. Should it be static? + +Reported-by: kernel test robot +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-2-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -71,7 +71,7 @@ struct sp_ocotp_data { + int size; + }; + +-const struct sp_ocotp_data sp_otp_v0 = { ++static const struct sp_ocotp_data sp_otp_v0 = { + .size = QAC628_OTP_SIZE, + }; + diff --git a/target/linux/generic/backport-5.15/805-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch b/target/linux/generic/backport-5.15/805-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch new file mode 100644 index 00000000000..886ebc12a9c --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch @@ -0,0 +1,27 @@ +From 874dfbcf219ccc42a2cbd187d087c7db82c3024b Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:26 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: drop useless probe confirmation + +Printing probe success is discouraged, because we can use tracing for +this purpose. Remove useless print message after Sunplus OCOTP driver +probe. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-3-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -202,8 +202,6 @@ static int sp_ocotp_probe(struct platfor + (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, + (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); + +- dev_info(dev, "by Sunplus (C) 2020"); +- + return 0; + } + diff --git a/target/linux/generic/backport-5.10/802-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch b/target/linux/generic/backport-5.15/805-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch similarity index 95% rename from target/linux/generic/backport-5.10/802-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch rename to target/linux/generic/backport-5.15/805-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch index b7870eef4bd..3b1e76147a8 100644 --- a/target/linux/generic/backport-5.10/802-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch +++ b/target/linux/generic/backport-5.15/805-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch @@ -21,7 +21,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -374,6 +374,7 @@ static int nvmem_cell_info_to_nvmem_cell +@@ -467,6 +467,7 @@ static int nvmem_cell_info_to_nvmem_cell cell->bit_offset = info->bit_offset; cell->nbits = info->nbits; diff --git a/target/linux/bcm53xx/patches-5.15/081-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.15/805-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.15/081-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.15/805-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch diff --git a/target/linux/generic/backport-5.15/805-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch b/target/linux/generic/backport-5.15/805-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch new file mode 100644 index 00000000000..ebeb6f5ad39 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch @@ -0,0 +1,130 @@ +From b6b7ef932ae838209254f016ecf8862d716a5ced Mon Sep 17 00:00:00 2001 +From: Sven Peter +Date: Fri, 29 Apr 2022 17:26:50 +0100 +Subject: [PATCH] nvmem: Add Apple eFuse driver + +Apple SoCs contain eFuses used to store factory-programmed data such +as calibration values for the PCIe or the Type-C PHY. They are organized +as 32bit values exposed as MMIO. + +Signed-off-by: Sven Peter +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 ++++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/apple-efuses.c | 80 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 94 insertions(+) + create mode 100644 drivers/nvmem/apple-efuses.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -324,4 +324,16 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -65,3 +65,5 @@ obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nv + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o + nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o +--- /dev/null ++++ b/drivers/nvmem/apple-efuses.c +@@ -0,0 +1,80 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Apple SoC eFuse driver ++ * ++ * Copyright (C) The Asahi Linux Contributors ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct apple_efuses_priv { ++ void __iomem *fuses; ++}; ++ ++static int apple_efuses_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct apple_efuses_priv *priv = context; ++ u32 *dst = val; ++ ++ while (bytes >= sizeof(u32)) { ++ *dst++ = readl_relaxed(priv->fuses + offset); ++ bytes -= sizeof(u32); ++ offset += sizeof(u32); ++ } ++ ++ return 0; ++} ++ ++static int apple_efuses_probe(struct platform_device *pdev) ++{ ++ struct apple_efuses_priv *priv; ++ struct resource *res; ++ struct nvmem_config config = { ++ .dev = &pdev->dev, ++ .read_only = true, ++ .reg_read = apple_efuses_read, ++ .stride = sizeof(u32), ++ .word_size = sizeof(u32), ++ .name = "apple_efuses_nvmem", ++ .id = NVMEM_DEVID_AUTO, ++ .root_only = true, ++ }; ++ ++ priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->fuses = devm_platform_get_and_ioremap_resource(pdev, 0, &res); ++ if (IS_ERR(priv->fuses)) ++ return PTR_ERR(priv->fuses); ++ ++ config.priv = priv; ++ config.size = resource_size(res); ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(config.dev, &config)); ++} ++ ++static const struct of_device_id apple_efuses_of_match[] = { ++ { .compatible = "apple,efuses", }, ++ {} ++}; ++ ++MODULE_DEVICE_TABLE(of, apple_efuses_of_match); ++ ++static struct platform_driver apple_efuses_driver = { ++ .driver = { ++ .name = "apple_efuses", ++ .of_match_table = apple_efuses_of_match, ++ }, ++ .probe = apple_efuses_probe, ++}; ++ ++module_platform_driver(apple_efuses_driver); ++ ++MODULE_AUTHOR("Sven Peter "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/805-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch b/target/linux/generic/backport-5.15/805-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch new file mode 100644 index 00000000000..cd51d970069 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch @@ -0,0 +1,31 @@ +From 517f6e2641a2802dce5a5aa0d18c7d37a35678d2 Mon Sep 17 00:00:00 2001 +From: Minghao Chi +Date: Fri, 29 Apr 2022 17:26:54 +0100 +Subject: [PATCH] nvmem: qfprom: using pm_runtime_resume_and_get instead of + pm_runtime_get_sync + +Using pm_runtime_resume_and_get is more appropriate +for simplifing code + +Reported-by: Zeal Robot +Signed-off-by: Minghao Chi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -217,9 +217,8 @@ static int qfprom_enable_fuse_blowing(co + goto err_clk_rate_set; + } + +- ret = pm_runtime_get_sync(priv->dev); ++ ret = pm_runtime_resume_and_get(priv->dev); + if (ret < 0) { +- pm_runtime_put_noidle(priv->dev); + dev_err(priv->dev, "Failed to enable power-domain\n"); + goto err_reg_enable; + } diff --git a/target/linux/generic/backport-5.15/805-v5.19-0008-nvmem-sfp-Use-regmap.patch b/target/linux/generic/backport-5.15/805-v5.19-0008-nvmem-sfp-Use-regmap.patch new file mode 100644 index 00000000000..e187238ca38 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0008-nvmem-sfp-Use-regmap.patch @@ -0,0 +1,109 @@ +From 943eadbdb11314b41eacbcc484dfb7f93e271ff4 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:00 +0100 +Subject: [PATCH] nvmem: sfp: Use regmap + +This converts the SFP driver to use regmap. This will allow easily +supporting devices with different endians. We disallow byte-level +access, as regmap_bulk_read doesn't support it (and it's unclear what +the correct result would be when we have an endianness difference). + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-16-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + drivers/nvmem/layerscape-sfp.c | 30 ++++++++++++++++++++++-------- + 2 files changed, 23 insertions(+), 8 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -304,6 +304,7 @@ config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST + depends on HAS_IOMEM ++ select REGMAP_MMIO + help + This driver provides support to read the eFuses on Freescale + Layerscape SoC's. For example, the vendor provides a per part +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -13,15 +13,17 @@ + #include + #include + #include ++#include + + #define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 + + struct layerscape_sfp_priv { +- void __iomem *base; ++ struct regmap *regmap; + }; + + struct layerscape_sfp_data { + int size; ++ enum regmap_endian endian; + }; + + static int layerscape_sfp_read(void *context, unsigned int offset, void *val, +@@ -29,15 +31,16 @@ static int layerscape_sfp_read(void *con + { + struct layerscape_sfp_priv *priv = context; + +- memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, +- bytes); +- +- return 0; ++ return regmap_bulk_read(priv->regmap, ++ LAYERSCAPE_SFP_OTP_OFFSET + offset, val, ++ bytes / 4); + } + + static struct nvmem_config layerscape_sfp_nvmem_config = { + .name = "fsl-sfp", + .reg_read = layerscape_sfp_read, ++ .word_size = 4, ++ .stride = 4, + }; + + static int layerscape_sfp_probe(struct platform_device *pdev) +@@ -45,16 +48,26 @@ static int layerscape_sfp_probe(struct p + const struct layerscape_sfp_data *data; + struct layerscape_sfp_priv *priv; + struct nvmem_device *nvmem; ++ struct regmap_config config = { 0 }; ++ void __iomem *base; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +- priv->base = devm_platform_ioremap_resource(pdev, 0); +- if (IS_ERR(priv->base)) +- return PTR_ERR(priv->base); ++ base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); + + data = device_get_match_data(&pdev->dev); ++ config.reg_bits = 32; ++ config.reg_stride = 4; ++ config.val_bits = 32; ++ config.val_format_endian = data->endian; ++ config.max_register = LAYERSCAPE_SFP_OTP_OFFSET + data->size - 4; ++ priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, &config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); + + layerscape_sfp_nvmem_config.size = data->size; + layerscape_sfp_nvmem_config.dev = &pdev->dev; +@@ -67,6 +80,7 @@ static int layerscape_sfp_probe(struct p + + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, ++ .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { diff --git a/target/linux/generic/backport-5.15/805-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch b/target/linux/generic/backport-5.15/805-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch new file mode 100644 index 00000000000..ee000986181 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch @@ -0,0 +1,38 @@ +From 33a1c6618677fe33f8e84cb7bedc45abbce89a50 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:01 +0100 +Subject: [PATCH] nvmem: sfp: Add support for TA 2.1 devices + +This adds support for Trust Architecture (TA) 2.1 devices to the SFP driver. +There are few differences between TA 2.1 and TA 3.0, especially for +read-only support, so just re-use the existing data. + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-17-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/layerscape-sfp.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -78,12 +78,18 @@ static int layerscape_sfp_probe(struct p + return PTR_ERR_OR_ZERO(nvmem); + } + ++static const struct layerscape_sfp_data ls1021a_data = { ++ .size = 0x88, ++ .endian = REGMAP_ENDIAN_BIG, ++}; ++ + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, + .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1021a-sfp", .data = &ls1021a_data }, + { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, + {}, + }; diff --git a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch new file mode 100644 index 00000000000..eeffbdaf527 --- /dev/null +++ b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch @@ -0,0 +1,389 @@ +From 98830350d3fc824c1ff5c338140fe20f041a5916 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Wed, 6 Jul 2022 11:06:22 +0100 +Subject: [PATCH] nvmem: microchip-otpc: add support + +Add support for Microchip OTP controller available on SAMA7G5. The OTPC +controls the access to a non-volatile memory. The memory behind OTPC is +organized into packets, packets are composed by a fixed length header +(4 bytes long) and a variable length payload (payload length is available +in the header). When software request the data at an offset in memory +the OTPC will return (via header + data registers) the whole packet that +has a word at that offset. For the OTP memory layout like below: + +offset OTP Memory layout + + . . + . ... . + . . +0x0E +-----------+ <--- packet X + | header X | +0x12 +-----------+ + | payload X | +0x16 | | + | | +0x1A | | + +-----------+ + . . + . ... . + . . + +if user requests data at address 0x16 the data started at 0x0E will be +returned by controller. User will be able to fetch the whole packet +starting at 0x0E (or parts of the packet) via proper registers. The same +packet will be returned if software request the data at offset 0x0E or +0x12 or 0x1A. + +The OTP will be populated by Microchip with at least 2 packets first one +being boot configuration packet and the 2nd one being temperature +calibration packet. The packet order will be preserved b/w different chip +revisions but the packet sizes may change. + +For the above reasons and to keep the same software able to work on all +chip variants the read function of the driver is working with a packet +id instead of an offset in OTP memory. + +Signed-off-by: Claudiu Beznea +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 8 + + drivers/nvmem/Kconfig | 7 + + drivers/nvmem/Makefile | 2 + + drivers/nvmem/microchip-otpc.c | 288 +++++++++++++++++++++++++++++++++ + 4 files changed, 305 insertions(+) + create mode 100644 drivers/nvmem/microchip-otpc.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -12353,6 +12353,14 @@ S: Supported + F: Documentation/devicetree/bindings/mtd/atmel-nand.txt + F: drivers/mtd/nand/raw/atmel/* + ++MICROCHIP OTPC DRIVER ++M: Claudiu Beznea ++L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) ++S: Supported ++F: Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml ++F: drivers/nvmem/microchip-otpc.c ++F: dt-bindings/nvmem/microchip,sama7g5-otpc.h ++ + MICROCHIP PWM DRIVER + M: Claudiu Beznea + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -107,6 +107,13 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + ++config MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. ++ + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" + depends on WII || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -67,3 +67,5 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o +--- /dev/null ++++ b/drivers/nvmem/microchip-otpc.c +@@ -0,0 +1,288 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * OTP Memory controller ++ * ++ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries ++ * ++ * Author: Claudiu Beznea ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MCHP_OTPC_CR (0x0) ++#define MCHP_OTPC_CR_READ BIT(6) ++#define MCHP_OTPC_MR (0x4) ++#define MCHP_OTPC_MR_ADDR GENMASK(31, 16) ++#define MCHP_OTPC_AR (0x8) ++#define MCHP_OTPC_SR (0xc) ++#define MCHP_OTPC_SR_READ BIT(6) ++#define MCHP_OTPC_HR (0x20) ++#define MCHP_OTPC_HR_SIZE GENMASK(15, 8) ++#define MCHP_OTPC_DR (0x24) ++ ++#define MCHP_OTPC_NAME "mchp-otpc" ++#define MCHP_OTPC_SIZE (11 * 1024) ++ ++/** ++ * struct mchp_otpc - OTPC private data structure ++ * @base: base address ++ * @dev: struct device pointer ++ * @packets: list of packets in OTP memory ++ * @npackets: number of packets in OTP memory ++ */ ++struct mchp_otpc { ++ void __iomem *base; ++ struct device *dev; ++ struct list_head packets; ++ u32 npackets; ++}; ++ ++/** ++ * struct mchp_otpc_packet - OTPC packet data structure ++ * @list: list head ++ * @id: packet ID ++ * @offset: packet offset (in words) in OTP memory ++ */ ++struct mchp_otpc_packet { ++ struct list_head list; ++ u32 id; ++ u32 offset; ++}; ++ ++static struct mchp_otpc_packet *mchp_otpc_id_to_packet(struct mchp_otpc *otpc, ++ u32 id) ++{ ++ struct mchp_otpc_packet *packet; ++ ++ if (id >= otpc->npackets) ++ return NULL; ++ ++ list_for_each_entry(packet, &otpc->packets, list) { ++ if (packet->id == id) ++ return packet; ++ } ++ ++ return NULL; ++} ++ ++static int mchp_otpc_prepare_read(struct mchp_otpc *otpc, ++ unsigned int offset) ++{ ++ u32 tmp; ++ ++ /* Set address. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_MR); ++ tmp &= ~MCHP_OTPC_MR_ADDR; ++ tmp |= FIELD_PREP(MCHP_OTPC_MR_ADDR, offset); ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_MR); ++ ++ /* Set read. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_CR); ++ tmp |= MCHP_OTPC_CR_READ; ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_CR); ++ ++ /* Wait for packet to be transferred into temporary buffers. */ ++ return read_poll_timeout(readl_relaxed, tmp, !(tmp & MCHP_OTPC_SR_READ), ++ 10000, 2000, false, otpc->base + MCHP_OTPC_SR); ++} ++ ++/* ++ * OTPC memory is organized into packets. Each packets contains a header and ++ * a payload. Header is 4 bytes long and contains the size of the payload. ++ * Payload size varies. The memory footprint is something as follows: ++ * ++ * Memory offset Memory footprint Packet ID ++ * ------------- ---------------- --------- ++ * ++ * 0x0 +------------+ <-- packet 0 ++ * | header 0 | ++ * 0x4 +------------+ ++ * | payload 0 | ++ * . . ++ * . ... . ++ * . . ++ * offset1 +------------+ <-- packet 1 ++ * | header 1 | ++ * offset1 + 0x4 +------------+ ++ * | payload 1 | ++ * . . ++ * . ... . ++ * . . ++ * offset2 +------------+ <-- packet 2 ++ * . . ++ * . ... . ++ * . . ++ * offsetN +------------+ <-- packet N ++ * | header N | ++ * offsetN + 0x4 +------------+ ++ * | payload N | ++ * . . ++ * . ... . ++ * . . ++ * +------------+ ++ * ++ * where offset1, offset2, offsetN depends on the size of payload 0, payload 1, ++ * payload N-1. ++ * ++ * The access to memory is done on a per packet basis: the control registers ++ * need to be updated with an offset address (within a packet range) and the ++ * data registers will be update by controller with information contained by ++ * that packet. E.g. if control registers are updated with any address within ++ * the range [offset1, offset2) the data registers are updated by controller ++ * with packet 1. Header data is accessible though MCHP_OTPC_HR register. ++ * Payload data is accessible though MCHP_OTPC_DR and MCHP_OTPC_AR registers. ++ * There is no direct mapping b/w the offset requested by software and the ++ * offset returned by hardware. ++ * ++ * For this, the read function will return the first requested bytes in the ++ * packet. The user will have to be aware of the memory footprint before doing ++ * the read request. ++ */ ++static int mchp_otpc_read(void *priv, unsigned int off, void *val, ++ size_t bytes) ++{ ++ struct mchp_otpc *otpc = priv; ++ struct mchp_otpc_packet *packet; ++ u32 *buf = val; ++ u32 offset; ++ size_t len = 0; ++ int ret, payload_size; ++ ++ /* ++ * We reach this point with off being multiple of stride = 4 to ++ * be able to cross the subsystem. Inside the driver we use continuous ++ * unsigned integer numbers for packet id, thus devide off by 4 ++ * before passing it to mchp_otpc_id_to_packet(). ++ */ ++ packet = mchp_otpc_id_to_packet(otpc, off / 4); ++ if (!packet) ++ return -EINVAL; ++ offset = packet->offset; ++ ++ while (len < bytes) { ++ ret = mchp_otpc_prepare_read(otpc, offset); ++ if (ret) ++ return ret; ++ ++ /* Read and save header content. */ ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ len += sizeof(*buf); ++ offset++; ++ if (len >= bytes) ++ break; ++ ++ /* Read and save payload content. */ ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, *(buf - 1)); ++ writel_relaxed(0UL, otpc->base + MCHP_OTPC_AR); ++ do { ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_DR); ++ len += sizeof(*buf); ++ offset++; ++ payload_size--; ++ } while (payload_size >= 0 && len < bytes); ++ } ++ ++ return 0; ++} ++ ++static int mchp_otpc_init_packets_list(struct mchp_otpc *otpc, u32 *size) ++{ ++ struct mchp_otpc_packet *packet; ++ u32 word, word_pos = 0, id = 0, npackets = 0, payload_size; ++ int ret; ++ ++ INIT_LIST_HEAD(&otpc->packets); ++ *size = 0; ++ ++ while (*size < MCHP_OTPC_SIZE) { ++ ret = mchp_otpc_prepare_read(otpc, word_pos); ++ if (ret) ++ return ret; ++ ++ word = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, word); ++ if (!payload_size) ++ break; ++ ++ packet = devm_kzalloc(otpc->dev, sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ ++ packet->id = id++; ++ packet->offset = word_pos; ++ INIT_LIST_HEAD(&packet->list); ++ list_add_tail(&packet->list, &otpc->packets); ++ ++ /* Count size by adding header and paload sizes. */ ++ *size += 4 * (payload_size + 1); ++ /* Next word: this packet (header, payload) position + 1. */ ++ word_pos += payload_size + 2; ++ ++ npackets++; ++ } ++ ++ otpc->npackets = npackets; ++ ++ return 0; ++} ++ ++static struct nvmem_config mchp_nvmem_config = { ++ .name = MCHP_OTPC_NAME, ++ .type = NVMEM_TYPE_OTP, ++ .read_only = true, ++ .word_size = 4, ++ .stride = 4, ++ .reg_read = mchp_otpc_read, ++}; ++ ++static int mchp_otpc_probe(struct platform_device *pdev) ++{ ++ struct nvmem_device *nvmem; ++ struct mchp_otpc *otpc; ++ u32 size; ++ int ret; ++ ++ otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); ++ if (!otpc) ++ return -ENOMEM; ++ ++ otpc->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otpc->base)) ++ return PTR_ERR(otpc->base); ++ ++ otpc->dev = &pdev->dev; ++ ret = mchp_otpc_init_packets_list(otpc, &size); ++ if (ret) ++ return ret; ++ ++ mchp_nvmem_config.dev = otpc->dev; ++ mchp_nvmem_config.size = size; ++ mchp_nvmem_config.priv = otpc; ++ nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id __maybe_unused mchp_otpc_ids[] = { ++ { .compatible = "microchip,sama7g5-otpc", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, mchp_otpc_ids); ++ ++static struct platform_driver mchp_otpc_driver = { ++ .probe = mchp_otpc_probe, ++ .driver = { ++ .name = MCHP_OTPC_NAME, ++ .of_match_table = of_match_ptr(mchp_otpc_ids), ++ }, ++}; ++module_platform_driver(mchp_otpc_driver); ++ ++MODULE_AUTHOR("Claudiu Beznea "); ++MODULE_DESCRIPTION("Microchip SAMA7G5 OTPC driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/806-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch b/target/linux/generic/backport-5.15/806-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch new file mode 100644 index 00000000000..6a4126b9ded --- /dev/null +++ b/target/linux/generic/backport-5.15/806-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch @@ -0,0 +1,32 @@ +From f5c97da8037b18d1256a58459fa96ed68e50fb41 Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Wed, 6 Jul 2022 11:06:27 +0100 +Subject: [PATCH] nvmem: mtk-efuse: Simplify with + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +No functional changes. + +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/mtk-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -41,8 +41,7 @@ static int mtk_efuse_probe(struct platfo + if (!priv) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->base = devm_ioremap_resource(dev, res); ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + diff --git a/target/linux/generic/backport-5.15/802-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch b/target/linux/generic/backport-5.15/807-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch similarity index 89% rename from target/linux/generic/backport-5.15/802-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch rename to target/linux/generic/backport-5.15/807-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch index a40c61f929e..9138807bc91 100644 --- a/target/linux/generic/backport-5.15/802-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch @@ -1,6 +1,6 @@ -From f955dc14450695564926711cf9fa8e1d5d854302 Mon Sep 17 00:00:00 2001 +From d5542923f200f95bddf524f36fd495f78aa28e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 15 Jun 2022 21:43:00 +0200 +Date: Fri, 16 Sep 2022 13:20:48 +0100 Subject: [PATCH] nvmem: add driver handling U-Boot environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -22,16 +22,24 @@ Kernel-parsed NVMEM cells can be read however by Linux drivers. This may be useful for Ethernet drivers for reading device MAC address which is often stored as U-Boot env variable. -Signed-off-by: Rafał Miłecki Reviewed-by: Ahmad Fatoum +Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- + MAINTAINERS | 1 + + drivers/nvmem/Kconfig | 13 +++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/u-boot-env.c | 218 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 234 insertions(+) + create mode 100644 drivers/nvmem/u-boot-env.c --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -300,4 +300,17 @@ config NVMEM_BRCM_NVRAM - This driver provides support for Broadcom's NVRAM that can be accessed - using I/O mapping. +@@ -344,4 +344,17 @@ config NVMEM_APPLE_EFUSES + This driver can also be built as a module. If so, the module will + be called nvmem-apple-efuses. +config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" @@ -49,10 +57,10 @@ Signed-off-by: Srinivas Kandagatla endif --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile -@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. - nvmem-rmem-y := rmem.o - obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o - nvmem_brcm_nvram-y := brcm_nvram.o +@@ -69,3 +69,5 @@ obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvme + nvmem-apple-efuses-y := apple-efuses.o + obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o +obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +nvmem_u-boot-env-y := u-boot-env.o --- /dev/null diff --git a/target/linux/generic/backport-5.15/807-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch b/target/linux/generic/backport-5.15/807-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch new file mode 100644 index 00000000000..34a28fa6fe3 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch @@ -0,0 +1,47 @@ +From 5544e90c81261e82e02bbf7c6015a4b9c8c825ef Mon Sep 17 00:00:00 2001 +From: Gaosheng Cui +Date: Fri, 16 Sep 2022 13:20:50 +0100 +Subject: [PATCH] nvmem: core: add error handling for dev_set_name + +The type of return value of dev_set_name is int, which may return +wrong result, so we add error handling for it to reclaim memory +of nvmem resource, and return early when an error occurs. + +Signed-off-by: Gaosheng Cui +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -810,18 +810,24 @@ struct nvmem_device *nvmem_register(cons + + switch (config->id) { + case NVMEM_DEVID_NONE: +- dev_set_name(&nvmem->dev, "%s", config->name); ++ rval = dev_set_name(&nvmem->dev, "%s", config->name); + break; + case NVMEM_DEVID_AUTO: +- dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); ++ rval = dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); + break; + default: +- dev_set_name(&nvmem->dev, "%s%d", ++ rval = dev_set_name(&nvmem->dev, "%s%d", + config->name ? : "nvmem", + config->name ? config->id : nvmem->id); + break; + } + ++ if (rval) { ++ ida_free(&nvmem_ida, nvmem->id); ++ kfree(nvmem); ++ return ERR_PTR(rval); ++ } ++ + nvmem->read_only = device_property_present(config->dev, "read-only") || + config->read_only || !nvmem->reg_write; + diff --git a/target/linux/generic/backport-5.15/807-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch b/target/linux/generic/backport-5.15/807-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch new file mode 100644 index 00000000000..48ad63fab5f --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch @@ -0,0 +1,29 @@ +From d3524bb5b9a0c567b853a0024526afe87dde01ed Mon Sep 17 00:00:00 2001 +From: Kenneth Lee +Date: Fri, 16 Sep 2022 13:20:52 +0100 +Subject: [PATCH] nvmem: brcm_nvram: Use kzalloc for allocating only one + element + +Use kzalloc(...) rather than kcalloc(1, ...) because the number of +elements we are specifying in this case is 1, so kzalloc would +accomplish the same thing and we can simplify. + +Signed-off-by: Kenneth Lee +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/brcm_nvram.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/brcm_nvram.c ++++ b/drivers/nvmem/brcm_nvram.c +@@ -96,7 +96,7 @@ static int brcm_nvram_parse(struct brcm_ + + len = le32_to_cpu(header.len); + +- data = kcalloc(1, len, GFP_KERNEL); ++ data = kzalloc(len, GFP_KERNEL); + memcpy_fromio(data, priv->base, len); + data[len - 1] = '\0'; + diff --git a/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch b/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch new file mode 100644 index 00000000000..ae02439bd73 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch @@ -0,0 +1,281 @@ +From 28fc7c986f01fdcfd28af648be2597624cac0e27 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:54 +0100 +Subject: [PATCH] nvmem: prefix all symbols with NVMEM_ +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This unifies all NVMEM symbols. They follow one style now. + +Reviewed-by: Matthias Brugger +Acked-by: Arnd Bergmann +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/configs/multi_v7_defconfig | 6 +++--- + arch/arm/configs/qcom_defconfig | 2 +- + arch/arm64/configs/defconfig | 10 +++++----- + arch/mips/configs/ci20_defconfig | 2 +- + drivers/cpufreq/Kconfig.arm | 2 +- + drivers/nvmem/Kconfig | 24 ++++++++++++------------ + drivers/nvmem/Makefile | 24 ++++++++++++------------ + drivers/soc/mediatek/Kconfig | 2 +- + drivers/thermal/qcom/Kconfig | 2 +- + 9 files changed, 37 insertions(+), 37 deletions(-) + +--- a/arch/arm/configs/multi_v7_defconfig ++++ b/arch/arm/configs/multi_v7_defconfig +@@ -1125,10 +1125,10 @@ CONFIG_TI_PIPE3=y + CONFIG_TWL4030_USB=m + CONFIG_RAS=y + CONFIG_NVMEM_IMX_OCOTP=y +-CONFIG_ROCKCHIP_EFUSE=m ++CONFIG_NVMEM_ROCKCHIP_EFUSE=m + CONFIG_NVMEM_SUNXI_SID=y + CONFIG_NVMEM_VF610_OCOTP=y +-CONFIG_MESON_MX_EFUSE=m ++CONFIG_NVMEM_MESON_MX_EFUSE=m + CONFIG_NVMEM_RMEM=m + CONFIG_FSI=m + CONFIG_FSI_MASTER_GPIO=m +--- a/arch/arm/configs/qcom_defconfig ++++ b/arch/arm/configs/qcom_defconfig +@@ -274,7 +274,7 @@ CONFIG_PHY_QCOM_USB_HS=y + CONFIG_PHY_QCOM_USB_HSIC=y + CONFIG_PHY_QCOM_QMP=y + CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2=y +-CONFIG_QCOM_QFPROM=y ++CONFIG_NVMEM_QCOM_QFPROM=y + CONFIG_INTERCONNECT=y + CONFIG_INTERCONNECT_QCOM=y + CONFIG_INTERCONNECT_QCOM_MSM8974=m +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -1135,11 +1135,11 @@ CONFIG_QCOM_L3_PMU=y + CONFIG_NVMEM_IMX_OCOTP=y + CONFIG_NVMEM_IMX_OCOTP_SCU=y + CONFIG_QCOM_QFPROM=y +-CONFIG_MTK_EFUSE=y +-CONFIG_ROCKCHIP_EFUSE=y ++CONFIG_NVMEM_MTK_EFUSE=y ++CONFIG_NVMEM_ROCKCHIP_EFUSE=y + CONFIG_NVMEM_SUNXI_SID=y +-CONFIG_UNIPHIER_EFUSE=y +-CONFIG_MESON_EFUSE=m ++CONFIG_NVMEM_UNIPHIER_EFUSE=y ++CONFIG_NVMEM_MESON_EFUSE=m + CONFIG_NVMEM_RMEM=m + CONFIG_FPGA=y + CONFIG_FPGA_MGR_STRATIX10_SOC=m +--- a/arch/mips/configs/ci20_defconfig ++++ b/arch/mips/configs/ci20_defconfig +@@ -137,7 +137,7 @@ CONFIG_MEMORY=y + CONFIG_JZ4780_NEMC=y + CONFIG_PWM=y + CONFIG_PWM_JZ4740=m +-CONFIG_JZ4780_EFUSE=y ++CONFIG_NVMEM_JZ4780_EFUSE=y + CONFIG_JZ4770_PHY=y + CONFIG_EXT4_FS=y + # CONFIG_DNOTIFY is not set +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -153,7 +153,7 @@ config ARM_OMAP2PLUS_CPUFREQ + config ARM_QCOM_CPUFREQ_NVMEM + tristate "Qualcomm nvmem based CPUFreq" + depends on ARCH_QCOM +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on QCOM_SMEM + select PM_OPP + help +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -52,7 +52,7 @@ config NVMEM_IMX_OCOTP_SCU + This is a driver for the SCU On-Chip OTP Controller (OCOTP) + available on i.MX8 SoCs. + +-config JZ4780_EFUSE ++config NVMEM_JZ4780_EFUSE + tristate "JZ4780 EFUSE Memory Support" + depends on MACH_INGENIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -96,7 +96,7 @@ config NVMEM_MXS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-mxs-ocotp. + +-config MTK_EFUSE ++config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on HAS_IOMEM +@@ -107,7 +107,7 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config MICROCHIP_OTPC ++config NVMEM_MICROCHIP_OTPC + tristate "Microchip OTPC support" + depends on ARCH_AT91 || COMPILE_TEST + help +@@ -126,7 +126,7 @@ config NVMEM_NINTENDO_OTP + This driver can also be built as a module. If so, the module + will be called nvmem-nintendo-otp. + +-config QCOM_QFPROM ++config NVMEM_QCOM_QFPROM + tristate "QCOM QFPROM Support" + depends on ARCH_QCOM || COMPILE_TEST + depends on HAS_IOMEM +@@ -145,7 +145,7 @@ config NVMEM_SPMI_SDAM + Qualcomm Technologies, Inc. PMICs. It provides the clients + an interface to read/write to the SDAM module's shared memory. + +-config ROCKCHIP_EFUSE ++config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -156,7 +156,7 @@ config ROCKCHIP_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_efuse. + +-config ROCKCHIP_OTP ++config NVMEM_ROCKCHIP_OTP + tristate "Rockchip OTP controller support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -199,7 +199,7 @@ config NVMEM_SUNXI_SID + This driver can also be built as a module. If so, the module + will be called nvmem_sunxi_sid. + +-config UNIPHIER_EFUSE ++config NVMEM_UNIPHIER_EFUSE + tristate "UniPhier SoCs eFuse support" + depends on ARCH_UNIPHIER || COMPILE_TEST + depends on HAS_IOMEM +@@ -221,7 +221,7 @@ config NVMEM_VF610_OCOTP + This driver can also be build as a module. If so, the module will + be called nvmem-vf610-ocotp. + +-config MESON_EFUSE ++config NVMEM_MESON_EFUSE + tristate "Amlogic Meson GX eFuse Support" + depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +@@ -231,7 +231,7 @@ config MESON_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_meson_efuse. + +-config MESON_MX_EFUSE ++config NVMEM_MESON_MX_EFUSE + tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" + depends on ARCH_MESON || COMPILE_TEST + help +@@ -251,13 +251,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config RAVE_SP_EEPROM ++config NVMEM_RAVE_SP_EEPROM + tristate "Rave SP EEPROM Support" + depends on RAVE_SP_CORE + help + Say y here to enable Rave SP EEPROM support. + +-config SC27XX_EFUSE ++config NVMEM_SC27XX_EFUSE + tristate "Spreadtrum SC27XX eFuse Support" + depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -278,7 +278,7 @@ config NVMEM_ZYNQMP + + If sure, say yes. If unsure, say no. + +-config SPRD_EFUSE ++config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" + depends on ARCH_SPRD || COMPILE_TEST + depends on HAS_IOMEM +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -15,7 +15,7 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-i + nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o + nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +@@ -25,37 +25,37 @@ obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-m + nvmem-mxs-ocotp-y := mxs-ocotp.o + obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o + nvmem-nintendo-otp-y := nintendo-otp.o +-obj-$(CONFIG_MTK_EFUSE) += nvmem_mtk-efuse.o ++obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o + nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o + nvmem_qfprom-y := qfprom.o + obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o + nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o +-obj-$(CONFIG_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o + nvmem_rockchip_efuse-y := rockchip-efuse.o +-obj-$(CONFIG_ROCKCHIP_OTP) += nvmem-rockchip-otp.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o + nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o + nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o + nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o + nvmem-uniphier-efuse-y := uniphier-efuse.o + obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o + nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_MESON_EFUSE) += nvmem_meson_efuse.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o + nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o + nvmem_meson_mx_efuse-y := meson-mx-efuse.o + obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o + nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o + nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o +-obj-$(CONFIG_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o + nvmem-sc27xx-efuse-y := sc27xx-efuse.o + obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o + nvmem_sprd_efuse-y := sprd-efuse.o + obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o + nvmem-rmem-y := rmem.o +@@ -67,7 +67,7 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o + nvmem_u-boot-env-y := u-boot-env.o +--- a/drivers/thermal/qcom/Kconfig ++++ b/drivers/thermal/qcom/Kconfig +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config QCOM_TSENS + tristate "Qualcomm TSENS Temperature Alarm" +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on ARCH_QCOM || COMPILE_TEST + help + This enables the thermal sysfs driver for the TSENS device. It shows diff --git a/target/linux/generic/backport-5.15/807-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch b/target/linux/generic/backport-5.15/807-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch new file mode 100644 index 00000000000..4e45524bffc --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch @@ -0,0 +1,535 @@ +From a06d9e5a63b7c2f622c908cd9600ce735e70f7c6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:55 +0100 +Subject: [PATCH] nvmem: sort config symbols alphabetically +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Match what most subsystems do +2. Simplify maintenance a bit +3. Reduce amount of conflicts for new drivers patches + +While at it unify indent level in Makefile. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 300 +++++++++++++++++++++-------------------- + drivers/nvmem/Makefile | 114 ++++++++-------- + 2 files changed, 208 insertions(+), 206 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -21,6 +21,40 @@ config NVMEM_SYSFS + This interface is mostly used by userspace applications to + read/write directly into nvmem. + ++# Devices ++ ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ ++config NVMEM_BCM_OCOTP ++ tristate "Broadcom On-Chip OTP Controller support" ++ depends on ARCH_BCM_IPROC || COMPILE_TEST ++ depends on HAS_IOMEM ++ default ARCH_BCM_IPROC ++ help ++ Say y here to enable read/write access to the Broadcom OTP ++ controller. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-bcm-ocotp. ++ ++config NVMEM_BRCM_NVRAM ++ tristate "Broadcom's NVRAM support" ++ depends on ARCH_BCM_5301X || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support for Broadcom's NVRAM that can be accessed ++ using I/O mapping. ++ + config NVMEM_IMX_IIM + tristate "i.MX IC Identification Module support" + depends on ARCH_MXC || COMPILE_TEST +@@ -64,6 +98,19 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ select REGMAP_MMIO ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + config NVMEM_LPC18XX_EEPROM + tristate "NXP LPC18XX EEPROM Memory Support" + depends on ARCH_LPC18XX || COMPILE_TEST +@@ -84,17 +131,32 @@ config NVMEM_LPC18XX_OTP + To compile this driver as a module, choose M here: the module + will be called nvmem_lpc18xx_otp. + +-config NVMEM_MXS_OCOTP +- tristate "Freescale MXS On-Chip OTP Memory Support" +- depends on ARCH_MXS || COMPILE_TEST +- depends on HAS_IOMEM ++config NVMEM_MESON_EFUSE ++ tristate "Amlogic Meson GX eFuse Support" ++ depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +- If you say Y here, you will get readonly access to the +- One Time Programmable memory pages that are stored +- on the Freescale i.MX23/i.MX28 processor. ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson GX SoCs. + + This driver can also be built as a module. If so, the module +- will be called nvmem-mxs-ocotp. ++ will be called nvmem_meson_efuse. ++ ++config NVMEM_MESON_MX_EFUSE ++ tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" ++ depends on ARCH_MESON || COMPILE_TEST ++ help ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_meson_mx_efuse. ++ ++config NVMEM_MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" +@@ -107,12 +169,17 @@ config NVMEM_MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config NVMEM_MICROCHIP_OTPC +- tristate "Microchip OTPC support" +- depends on ARCH_AT91 || COMPILE_TEST ++config NVMEM_MXS_OCOTP ++ tristate "Freescale MXS On-Chip OTP Memory Support" ++ depends on ARCH_MXS || COMPILE_TEST ++ depends on HAS_IOMEM + help +- This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ If you say Y here, you will get readonly access to the ++ One Time Programmable memory pages that are stored ++ on the Freescale i.MX23/i.MX28 processor. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-mxs-ocotp. + + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" +@@ -137,13 +204,21 @@ config NVMEM_QCOM_QFPROM + This driver can also be built as a module. If so, the module + will be called nvmem_qfprom. + +-config NVMEM_SPMI_SDAM +- tristate "SPMI SDAM Support" +- depends on SPMI ++config NVMEM_RAVE_SP_EEPROM ++ tristate "Rave SP EEPROM Support" ++ depends on RAVE_SP_CORE + help +- This driver supports the Shared Direct Access Memory Module on +- Qualcomm Technologies, Inc. PMICs. It provides the clients +- an interface to read/write to the SDAM module's shared memory. ++ Say y here to enable Rave SP EEPROM support. ++ ++config NVMEM_RMEM ++ tristate "Reserved Memory Based Driver Support" ++ depends on HAS_IOMEM ++ help ++ This driver maps reserved memory into an nvmem device. It might be ++ useful to expose information left by firmware in memory. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-rmem. + + config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" +@@ -167,79 +242,16 @@ config NVMEM_ROCKCHIP_OTP + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_otp. + +-config NVMEM_BCM_OCOTP +- tristate "Broadcom On-Chip OTP Controller support" +- depends on ARCH_BCM_IPROC || COMPILE_TEST +- depends on HAS_IOMEM +- default ARCH_BCM_IPROC +- help +- Say y here to enable read/write access to the Broadcom OTP +- controller. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-bcm-ocotp. +- +-config NVMEM_STM32_ROMEM +- tristate "STMicroelectronics STM32 factory-programmed memory support" +- depends on ARCH_STM32 || COMPILE_TEST +- help +- Say y here to enable read-only access for STMicroelectronics STM32 +- factory-programmed memory area. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-stm32-romem. +- +-config NVMEM_SUNXI_SID +- tristate "Allwinner SoCs SID support" +- depends on ARCH_SUNXI +- help +- This is a driver for the 'security ID' available on various Allwinner +- devices. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_sunxi_sid. +- +-config NVMEM_UNIPHIER_EFUSE +- tristate "UniPhier SoCs eFuse support" +- depends on ARCH_UNIPHIER || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of UniPhier SoC +- from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-uniphier-efuse. +- +-config NVMEM_VF610_OCOTP +- tristate "VF610 SoC OCOTP support" +- depends on SOC_VF610 || COMPILE_TEST ++config NVMEM_SC27XX_EFUSE ++ tristate "Spreadtrum SC27XX eFuse Support" ++ depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM + help +- This is a driver for the 'OCOTP' peripheral available on Vybrid +- devices like VF5xx and VF6xx. +- +- This driver can also be build as a module. If so, the module will +- be called nvmem-vf610-ocotp. +- +-config NVMEM_MESON_EFUSE +- tristate "Amlogic Meson GX eFuse Support" +- depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson GX SoCs. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_meson_efuse. +- +-config NVMEM_MESON_MX_EFUSE +- tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" +- depends on ARCH_MESON || COMPILE_TEST +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ This is a simple driver to dump specified values of Spreadtrum ++ SC27XX PMICs from eFuse. + + This driver can also be built as a module. If so, the module +- will be called nvmem_meson_mx_efuse. ++ will be called nvmem-sc27xx-efuse. + + config NVMEM_SNVS_LPGPR + tristate "Support for Low Power General Purpose Register" +@@ -251,32 +263,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config NVMEM_RAVE_SP_EEPROM +- tristate "Rave SP EEPROM Support" +- depends on RAVE_SP_CORE +- help +- Say y here to enable Rave SP EEPROM support. +- +-config NVMEM_SC27XX_EFUSE +- tristate "Spreadtrum SC27XX eFuse Support" +- depends on MFD_SC27XX_PMIC || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of Spreadtrum +- SC27XX PMICs from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-sc27xx-efuse. +- +-config NVMEM_ZYNQMP +- bool "Xilinx ZYNQMP SoC nvmem firmware support" +- depends on ARCH_ZYNQMP ++config NVMEM_SPMI_SDAM ++ tristate "SPMI SDAM Support" ++ depends on SPMI + help +- This is a driver to access hardware related data like +- soc revision, IDCODE... etc by using the firmware +- interface. +- +- If sure, say yes. If unsure, say no. ++ This driver supports the Shared Direct Access Memory Module on ++ Qualcomm Technologies, Inc. PMICs. It provides the clients ++ an interface to read/write to the SDAM module's shared memory. + + config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" +@@ -289,36 +282,15 @@ config NVMEM_SPRD_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem-sprd-efuse. + +-config NVMEM_RMEM +- tristate "Reserved Memory Based Driver Support" +- depends on HAS_IOMEM +- help +- This driver maps reserved memory into an nvmem device. It might be +- useful to expose information left by firmware in memory. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-rmem. +- +-config NVMEM_BRCM_NVRAM +- tristate "Broadcom's NVRAM support" +- depends on ARCH_BCM_5301X || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This driver provides support for Broadcom's NVRAM that can be accessed +- using I/O mapping. +- +-config NVMEM_LAYERSCAPE_SFP +- tristate "Layerscape SFP (Security Fuse Processor) support" +- depends on ARCH_LAYERSCAPE || COMPILE_TEST +- depends on HAS_IOMEM +- select REGMAP_MMIO ++config NVMEM_STM32_ROMEM ++ tristate "STMicroelectronics STM32 factory-programmed memory support" ++ depends on ARCH_STM32 || COMPILE_TEST + help +- This driver provides support to read the eFuses on Freescale +- Layerscape SoC's. For example, the vendor provides a per part +- unique ID there. ++ Say y here to enable read-only access for STMicroelectronics STM32 ++ factory-programmed memory area. + + This driver can also be built as a module. If so, the module +- will be called layerscape-sfp. ++ will be called nvmem-stm32-romem. + + config NVMEM_SUNPLUS_OCOTP + tristate "Sunplus SoC OTP support" +@@ -332,17 +304,15 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + +-config NVMEM_APPLE_EFUSES +- tristate "Apple eFuse support" +- depends on ARCH_APPLE || COMPILE_TEST +- default ARCH_APPLE ++config NVMEM_SUNXI_SID ++ tristate "Allwinner SoCs SID support" ++ depends on ARCH_SUNXI + help +- Say y here to enable support for reading eFuses on Apple SoCs +- such as the M1. These are e.g. used to store factory programmed +- calibration data required for the PCIe or the USB-C PHY. ++ This is a driver for the 'security ID' available on various Allwinner ++ devices. + +- This driver can also be built as a module. If so, the module will +- be called nvmem-apple-efuses. ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_sunxi_sid. + + config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" +@@ -357,4 +327,36 @@ config NVMEM_U_BOOT_ENV + + If compiled as module it will be called nvmem_u-boot-env. + ++config NVMEM_UNIPHIER_EFUSE ++ tristate "UniPhier SoCs eFuse support" ++ depends on ARCH_UNIPHIER || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a simple driver to dump specified values of UniPhier SoC ++ from eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-uniphier-efuse. ++ ++config NVMEM_VF610_OCOTP ++ tristate "VF610 SoC OCOTP support" ++ depends on SOC_VF610 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the 'OCOTP' peripheral available on Vybrid ++ devices like VF5xx and VF6xx. ++ ++ This driver can also be build as a module. If so, the module will ++ be called nvmem-vf610-ocotp. ++ ++config NVMEM_ZYNQMP ++ bool "Xilinx ZYNQMP SoC nvmem firmware support" ++ depends on ARCH_ZYNQMP ++ help ++ This is a driver to access hardware related data like ++ soc revision, IDCODE... etc by using the firmware ++ interface. ++ ++ If sure, say yes. If unsure, say no. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -7,67 +7,67 @@ obj-$(CONFIG_NVMEM) += nvmem_core.o + nvmem_core-y := core.o + + # Devices +-obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o +-nvmem-bcm-ocotp-y := bcm-ocotp.o +-obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o +-nvmem-imx-iim-y := imx-iim.o +-obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o +-nvmem-imx-ocotp-y := imx-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o ++nvmem-bcm-ocotp-y := bcm-ocotp.o ++obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o ++nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o ++nvmem-imx-iim-y := imx-iim.o ++obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o ++nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o +-nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o +-nvmem_jz4780_efuse-y := jz4780-efuse.o ++nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +-nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +-obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o +-nvmem_lpc18xx_otp-y := lpc18xx_otp.o +-obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o +-nvmem-mxs-ocotp-y := mxs-ocotp.o +-obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o +-nvmem-nintendo-otp-y := nintendo-otp.o ++nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o ++obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o ++nvmem_lpc18xx_otp-y := lpc18xx_otp.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o ++nvmem_meson_efuse-y := meson-efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++nvmem_meson_mx_efuse-y := meson-mx-efuse.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o +-nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o +-nvmem_qfprom-y := qfprom.o +-obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o +-nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++nvmem_mtk-efuse-y := mtk-efuse.o ++obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o ++nvmem-mxs-ocotp-y := mxs-ocotp.o ++obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o ++nvmem-nintendo-otp-y := nintendo-otp.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o ++nvmem_qfprom-y := qfprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o ++nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o +-nvmem_rockchip_efuse-y := rockchip-efuse.o ++nvmem_rockchip_efuse-y := rockchip-efuse.o + obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o +-nvmem-rockchip-otp-y := rockchip-otp.o +-obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o +-nvmem_stm32_romem-y := stm32-romem.o +-obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o +-nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o +-nvmem-uniphier-efuse-y := uniphier-efuse.o +-obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o +-nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o +-nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o +-nvmem_meson_mx_efuse-y := meson-mx-efuse.o +-obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o +-nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o +-nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o +-nvmem-sc27xx-efuse-y := sc27xx-efuse.o +-obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o +-nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o +-nvmem_sprd_efuse-y := sprd-efuse.o +-obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o +-nvmem-rmem-y := rmem.o +-obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o +-nvmem_brcm_nvram-y := brcm_nvram.o +-obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o +-nvmem-layerscape-sfp-y := layerscape-sfp.o ++nvmem-sc27xx-efuse-y := sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o ++nvmem_snvs_lpgpr-y := snvs_lpgpr.o ++obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o ++nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o ++nvmem_sprd_efuse-y := sprd-efuse.o ++obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o ++nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o +-nvmem_sunplus_ocotp-y := sunplus-ocotp.o +-obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o +-nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o +-nvmem-microchip-otpc-y := microchip-otpc.o +-obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +-nvmem_u-boot-env-y := u-boot-env.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o ++nvmem_sunxi_sid-y := sunxi_sid.o ++obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o ++nvmem_u-boot-env-y := u-boot-env.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++nvmem-uniphier-efuse-y := uniphier-efuse.o ++obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o ++nvmem-vf610-ocotp-y := vf610-ocotp.o ++obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o ++nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o diff --git a/target/linux/generic/backport-5.10/801-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.15/807-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 79% rename from target/linux/generic/backport-5.10/801-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.15/807-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch index 3a6b76a221e..e0a082adc45 100644 --- a/target/linux/generic/backport-5.10/801-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch @@ -1,6 +1,6 @@ -From d69efcf951df4dcc74a0e1554969c533aec8aa9b Mon Sep 17 00:00:00 2001 +From d4d432670f7dee0a5432fcffcfc8699b25181ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 15 Sep 2022 22:06:29 +0200 +Date: Fri, 16 Sep 2022 13:20:57 +0100 Subject: [PATCH] nvmem: u-boot-env: find Device Tree nodes for NVMEM cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -13,6 +13,8 @@ This allows NVMEM consumers to use U-Boot environment variables. Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-11-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/backport-5.15/807-v6.1-0008-nvmem-lan9662-otp-add-support.patch b/target/linux/generic/backport-5.15/807-v6.1-0008-nvmem-lan9662-otp-add-support.patch new file mode 100644 index 00000000000..945c6128ff4 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0008-nvmem-lan9662-otp-add-support.patch @@ -0,0 +1,274 @@ +From 9e8f208ad5229ddda97cd4a83ecf89c735d99592 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 16 Sep 2022 13:20:59 +0100 +Subject: [PATCH] nvmem: lan9662-otp: add support + +Add support for OTP controller available on LAN9662. The OTPC controls +the access to a non-volatile memory. The size of the memory is 8KB. +The OTPC can access the memory based on an offset. +Implement both the read and the write functionality. + +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-13-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 8 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/lan9662-otpc.c | 222 +++++++++++++++++++++++++++++++++++ + 3 files changed, 232 insertions(+) + create mode 100644 drivers/nvmem/lan9662-otpc.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -98,6 +98,14 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAN9662_OTPC ++ tristate "Microchip LAN9662 OTP controller support" ++ depends on SOC_LAN966 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver enables the OTP controller available on Microchip LAN9662 ++ SoCs. It controls the access to the OTP memory connected to it. ++ + config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -21,6 +21,8 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvm + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o + obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAN9662_OTPC) += nvmem-lan9662-otpc.o ++nvmem-lan9662-otpc-y := lan9662-otpc.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +--- /dev/null ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -0,0 +1,222 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define OTP_OTP_PWR_DN(t) (t + 0x00) ++#define OTP_OTP_PWR_DN_OTP_PWRDN_N BIT(0) ++#define OTP_OTP_ADDR_HI(t) (t + 0x04) ++#define OTP_OTP_ADDR_LO(t) (t + 0x08) ++#define OTP_OTP_PRGM_DATA(t) (t + 0x10) ++#define OTP_OTP_PRGM_MODE(t) (t + 0x14) ++#define OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE BIT(0) ++#define OTP_OTP_RD_DATA(t) (t + 0x18) ++#define OTP_OTP_FUNC_CMD(t) (t + 0x20) ++#define OTP_OTP_FUNC_CMD_OTP_PROGRAM BIT(1) ++#define OTP_OTP_FUNC_CMD_OTP_READ BIT(0) ++#define OTP_OTP_CMD_GO(t) (t + 0x28) ++#define OTP_OTP_CMD_GO_OTP_GO BIT(0) ++#define OTP_OTP_PASS_FAIL(t) (t + 0x2c) ++#define OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED BIT(3) ++#define OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED BIT(2) ++#define OTP_OTP_PASS_FAIL_OTP_FAIL BIT(0) ++#define OTP_OTP_STATUS(t) (t + 0x30) ++#define OTP_OTP_STATUS_OTP_CPUMPEN BIT(1) ++#define OTP_OTP_STATUS_OTP_BUSY BIT(0) ++ ++#define OTP_MEM_SIZE 8192 ++#define OTP_SLEEP_US 10 ++#define OTP_TIMEOUT_US 500000 ++ ++struct lan9662_otp { ++ struct device *dev; ++ void __iomem *base; ++}; ++ ++static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++{ ++ u32 val; ++ ++ return readl_poll_timeout(reg, val, !(val & flag), ++ OTP_SLEEP_US, OTP_TIMEOUT_US); ++} ++ ++static int lan9662_otp_power(struct lan9662_otp *otp, bool up) ++{ ++ void __iomem *pwrdn = OTP_OTP_PWR_DN(otp->base); ++ ++ if (up) { ++ writel(readl(pwrdn) & ~OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_CPUMPEN)) ++ return -ETIMEDOUT; ++ } else { ++ writel(readl(pwrdn) | OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ } ++ ++ return 0; ++} ++ ++static int lan9662_otp_execute(struct lan9662_otp *otp) ++{ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_CMD_GO(otp->base), ++ OTP_OTP_CMD_GO_OTP_GO)) ++ return -ETIMEDOUT; ++ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_BUSY)) ++ return -ETIMEDOUT; ++ ++ return 0; ++} ++ ++static void lan9662_otp_set_address(struct lan9662_otp *otp, u32 offset) ++{ ++ writel(0xff & (offset >> 8), OTP_OTP_ADDR_HI(otp->base)); ++ writel(0xff & offset, OTP_OTP_ADDR_LO(otp->base)); ++} ++ ++static int lan9662_otp_read_byte(struct lan9662_otp *otp, u32 offset, u8 *dst) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_FUNC_CMD_OTP_READ, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED) ++ return -EACCES; ++ *dst = (u8) readl(OTP_OTP_RD_DATA(otp->base)); ++ } ++ return rc; ++} ++ ++static int lan9662_otp_write_byte(struct lan9662_otp *otp, u32 offset, u8 data) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE, OTP_OTP_PRGM_MODE(otp->base)); ++ writel(data, OTP_OTP_PRGM_DATA(otp->base)); ++ writel(OTP_OTP_FUNC_CMD_OTP_PROGRAM, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED) ++ return -EACCES; ++ if (pass & OTP_OTP_PASS_FAIL_OTP_FAIL) ++ return -EIO; ++ } ++ return rc; ++} ++ ++static int lan9662_otp_read(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ uint8_t data; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ *val++ = data; ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static int lan9662_otp_write(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ u8 data, newdata; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ /* Skip zero bytes */ ++ if (val[i]) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ ++ newdata = data | val[i]; ++ if (newdata == data) ++ continue; ++ ++ rc = lan9662_otp_write_byte(otp, offset + i, ++ newdata); ++ if (rc < 0) ++ break; ++ } ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static struct nvmem_config otp_config = { ++ .name = "lan9662-otp", ++ .stride = 1, ++ .word_size = 1, ++ .reg_read = lan9662_otp_read, ++ .reg_write = lan9662_otp_write, ++ .size = OTP_MEM_SIZE, ++}; ++ ++static int lan9662_otp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct lan9662_otp *otp; ++ ++ otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ otp->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otp->base)) ++ return PTR_ERR(otp->base); ++ ++ otp_config.priv = otp; ++ otp_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &otp_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id lan9662_otp_match[] = { ++ { .compatible = "microchip,lan9662-otp", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, lan9662_otp_match); ++ ++static struct platform_driver lan9662_otp_driver = { ++ .probe = lan9662_otp_probe, ++ .driver = { ++ .name = "lan9662-otp", ++ .of_match_table = lan9662_otp_match, ++ }, ++}; ++module_platform_driver(lan9662_otp_driver); ++ ++MODULE_AUTHOR("Horatiu Vultur "); ++MODULE_DESCRIPTION("lan9662 OTP driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/801-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch b/target/linux/generic/backport-5.15/807-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch similarity index 74% rename from target/linux/generic/backport-5.10/801-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch rename to target/linux/generic/backport-5.15/807-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch index 6b405571160..633a668a962 100644 --- a/target/linux/generic/backport-5.10/801-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch @@ -1,6 +1,6 @@ -From 60bbaad38109684b156e21112322e0a922f92cde Mon Sep 17 00:00:00 2001 +From 3717ca3e0cc8683f93b41d3f06ca79631eb58715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 18 Aug 2022 06:38:37 +0200 +Date: Fri, 16 Sep 2022 13:21:00 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32 casting type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,10 +9,12 @@ Content-Transfer-Encoding: 8bit This fixes: drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32 +Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Reported-by: kernel test robot -Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-14-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.15/807-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch b/target/linux/generic/backport-5.15/807-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch new file mode 100644 index 00000000000..b663a1328df --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch @@ -0,0 +1,34 @@ +From 1aeb122d214b92474c86fde00a03d6e2d69381b5 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Wed, 28 Sep 2022 21:51:12 +0200 +Subject: [PATCH] nvmem: lan9662-otp: Fix compatible string + +The device tree bindings for lan9662-otp expects the compatible string +to be one of following compatible strings: +microchip,lan9662-otpc +microchip,lan9668-otpc + +The problem is that the lan9662-otp driver contains the +microchip,lan9662-otp compatible string instead of +microchip,lan9662-otpc. +Fix this by updating the compatible string in the driver. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Signed-off-by: Horatiu Vultur +Link: https://lore.kernel.org/r/20220928195112.630351-1-horatiu.vultur@microchip.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -203,7 +203,7 @@ static int lan9662_otp_probe(struct plat + } + + static const struct of_device_id lan9662_otp_match[] = { +- { .compatible = "microchip,lan9662-otp", }, ++ { .compatible = "microchip,lan9662-otpc", }, + { }, + }; + MODULE_DEVICE_TABLE(of, lan9662_otp_match); diff --git a/target/linux/generic/backport-5.10/803-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch b/target/linux/generic/backport-5.15/807-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch similarity index 89% rename from target/linux/generic/backport-5.10/803-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch rename to target/linux/generic/backport-5.15/807-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch index 69d5a1b8459..967e891dbd9 100644 --- a/target/linux/generic/backport-5.10/803-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch @@ -1,4 +1,4 @@ -From 7a69ff9c9bde03a690ea783970f664782fc303d8 Mon Sep 17 00:00:00 2001 +From ee424f7d3960152f5f862bbb6943e59828dc7917 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 4 Nov 2022 17:52:03 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32_data_offset on redundant @@ -37,8 +37,11 @@ crc32 sum... which is unfortunate :( | [0] https://github.com/sbabic/libubootenv/blob/master/src/uboot_env.c#L951 + Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Christian Lamparter +Link: https://lore.kernel.org/r/70a16eae113e08db2390b76e174f4837caa135c3.1667580636.git.chunkeey@gmail.com +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.15/807-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch b/target/linux/generic/backport-5.15/807-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch new file mode 100644 index 00000000000..0c842f07932 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch @@ -0,0 +1,35 @@ +From 022b68f271de0e53024e6d5e96fee8e76d25eb95 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 18 Nov 2022 06:38:40 +0000 +Subject: [PATCH] nvmem: lan9662-otp: Change return type of + lan9662_otp_wait_flag_clear() + +The blamed commit introduced the following smatch warning in the +function lan9662_otp_wait_flag_clear: +drivers/nvmem/lan9662-otpc.c:43 lan9662_otp_wait_flag_clear() warn: signedness bug returning '(-110)' + +Fix this by changing the return type of the function +lan9662_otp_wait_flag_clear() to be int instead of bool. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063840.6357-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -36,7 +36,7 @@ struct lan9662_otp { + void __iomem *base; + }; + +-static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++static int lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) + { + u32 val; + diff --git a/target/linux/generic/backport-5.15/808-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch b/target/linux/generic/backport-5.15/808-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch new file mode 100644 index 00000000000..33759632ebe --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch @@ -0,0 +1,82 @@ +From fbfc4ca465a1f8d81bf2d67d95bf7fc67c3cf0c2 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:20 +0000 +Subject: [PATCH] nvmem: stm32: move STM32MP15_BSEC_NUM_LOWER in config + +Support STM32MP15_BSEC_NUM_LOWER in stm32 romem config to prepare +the next SoC in STM32MP family. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -22,16 +22,15 @@ + /* shadow registers offest */ + #define STM32MP15_BSEC_DATA0 0x200 + +-/* 32 (x 32-bits) lower shadow registers */ +-#define STM32MP15_BSEC_NUM_LOWER 32 +- + struct stm32_romem_cfg { + int size; ++ u8 lower; + }; + + struct stm32_romem_priv { + void __iomem *base; + struct nvmem_config cfg; ++ u8 lower; + }; + + static int stm32_romem_read(void *context, unsigned int offset, void *buf, +@@ -85,7 +84,7 @@ static int stm32_bsec_read(void *context + for (i = roffset; (i < roffset + rbytes); i += 4) { + u32 otp = i >> 2; + +- if (otp < STM32MP15_BSEC_NUM_LOWER) { ++ if (otp < priv->lower) { + /* read lower data from shadow registers */ + val = readl_relaxed( + priv->base + STM32MP15_BSEC_DATA0 + i); +@@ -159,6 +158,8 @@ static int stm32_romem_probe(struct plat + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; + ++ priv->lower = 0; ++ + cfg = (const struct stm32_romem_cfg *) + of_match_device(dev->driver->of_match_table, dev)->data; + if (!cfg) { +@@ -167,6 +168,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.reg_read = stm32_romem_read; + } else { + priv->cfg.size = cfg->size; ++ priv->lower = cfg->lower; + priv->cfg.reg_read = stm32_bsec_read; + priv->cfg.reg_write = stm32_bsec_write; + } +@@ -174,8 +176,17 @@ static int stm32_romem_probe(struct plat + return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &priv->cfg)); + } + ++/* ++ * STM32MP15 BSEC OTP regions: 4096 OTP bits (with 3072 effective bits) ++ * => 96 x 32-bits data words ++ * - Lower: 1K bits, 2:1 redundancy, incremental bit programming ++ * => 32 (x 32-bits) lower shadow registers = words 0 to 31 ++ * - Upper: 2K bits, ECC protection, word programming only ++ * => 64 (x 32-bits) = words 32 to 95 ++ */ + static const struct stm32_romem_cfg stm32mp15_bsec_cfg = { +- .size = 384, /* 96 x 32-bits data words */ ++ .size = 384, ++ .lower = 32, + }; + + static const struct of_device_id stm32_romem_of_match[] = { diff --git a/target/linux/generic/backport-5.15/808-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch b/target/linux/generic/backport-5.15/808-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch new file mode 100644 index 00000000000..5791df2606f --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch @@ -0,0 +1,34 @@ +From d61784e6410f3df2028e6eb91b06ffed37a660e0 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:21 +0000 +Subject: [PATCH] nvmem: stm32: add warning when upper OTPs are updated + +As the upper OTPs are ECC protected, they support only one 32 bits word +programming. +For a second modification of this word, these ECC become invalid and +this OTP will be no more accessible, the shadowed value is invalid. + +This patch adds a warning to indicate an upper OTP update, because this +operation is dangerous as OTP is not locked by the driver after the first +update to avoid a second update. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -132,6 +132,9 @@ static int stm32_bsec_write(void *contex + } + } + ++ if (offset + bytes >= priv->lower * 4) ++ dev_warn(dev, "Update of upper OTPs with ECC protection (word programming, only once)\n"); ++ + return 0; + } + diff --git a/target/linux/generic/backport-5.15/808-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch b/target/linux/generic/backport-5.15/808-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch new file mode 100644 index 00000000000..b83ad69c6b4 --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch @@ -0,0 +1,26 @@ +From a3816a7d7c097c1da46aad5f5d1e229b607dce04 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:22 +0000 +Subject: [PATCH] nvmem: stm32: add nvmem type attribute + +Inform NVMEM framework of type attribute for stm32-romem as NVMEM_TYPE_OTP +so userspace is able to know how the data is stored in BSEC. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -160,6 +160,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.dev = dev; + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; ++ priv->cfg.type = NVMEM_TYPE_OTP; + + priv->lower = 0; + diff --git a/target/linux/generic/backport-5.15/808-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch b/target/linux/generic/backport-5.15/808-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch new file mode 100644 index 00000000000..52ba1e65b56 --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch @@ -0,0 +1,27 @@ +From 06aac0e11960a7ddccc1888326b5906d017e0f24 Mon Sep 17 00:00:00 2001 +From: Jiangshan Yi +Date: Fri, 18 Nov 2022 06:39:24 +0000 +Subject: [PATCH] nvmem: stm32: fix spelling typo in comment + +Fix spelling typo in comment. + +Reported-by: k2ci +Signed-off-by: Jiangshan Yi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -19,7 +19,7 @@ + #define STM32_SMC_WRITE_SHADOW 0x03 + #define STM32_SMC_READ_OTP 0x04 + +-/* shadow registers offest */ ++/* shadow registers offset */ + #define STM32MP15_BSEC_DATA0 0x200 + + struct stm32_romem_cfg { diff --git a/target/linux/generic/backport-5.15/808-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch b/target/linux/generic/backport-5.15/808-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch new file mode 100644 index 00000000000..8f024f4c1ac --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch @@ -0,0 +1,27 @@ +From fb817c4ef63e8cfb6e77ae4a2875ae854c80708f Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 18 Nov 2022 06:39:26 +0000 +Subject: [PATCH] nvmem: Kconfig: Fix spelling mistake "controlls" -> + "controls" + +There is a spelling mistake in a Kconfig description. Fix it. + +Signed-off-by: Colin Ian King +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -164,7 +164,7 @@ config NVMEM_MICROCHIP_OTPC + depends on ARCH_AT91 || COMPILE_TEST + help + This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ SoCs. It controls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" diff --git a/target/linux/generic/backport-5.15/804-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch b/target/linux/generic/backport-5.15/808-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch similarity index 90% rename from target/linux/generic/backport-5.15/804-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch rename to target/linux/generic/backport-5.15/808-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch index 429b24f0f3a..861386ad310 100644 --- a/target/linux/generic/backport-5.15/804-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch +++ b/target/linux/generic/backport-5.15/808-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch @@ -1,6 +1,6 @@ -From 5b4eaafbeac472fc19049152f18e88aecb2b2829 Mon Sep 17 00:00:00 2001 +From ada84d07af6097b2addd18262668ce6cb9e15206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 17 Oct 2022 09:17:22 +0200 +Date: Fri, 18 Nov 2022 06:39:27 +0000 Subject: [PATCH] nvmem: u-boot-env: add Broadcom format support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -15,6 +15,8 @@ Add support for Broadcom's specific binding and their custom format. Ref: 6b0584c19d87 ("dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/linux/generic/backport-5.15/804-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/backport-5.15/809-nvmem-u-boot-env-align-endianness-of-crc32-values.patch similarity index 96% rename from target/linux/generic/backport-5.15/804-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch rename to target/linux/generic/backport-5.15/809-nvmem-u-boot-env-align-endianness-of-crc32-values.patch index 7d6723bb8e9..4010232300c 100644 --- a/target/linux/generic/backport-5.15/804-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch +++ b/target/linux/generic/backport-5.15/809-nvmem-u-boot-env-align-endianness-of-crc32-values.patch @@ -36,7 +36,7 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c -@@ -143,7 +143,7 @@ static int u_boot_env_parse(struct u_boo +@@ -156,7 +156,7 @@ static int u_boot_env_parse(struct u_boo crc32_data_len = priv->mtd->size - crc32_data_offset; data_len = priv->mtd->size - data_offset; diff --git a/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch b/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch new file mode 100644 index 00000000000..b00cf574199 --- /dev/null +++ b/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch @@ -0,0 +1,359 @@ +From 66a8f7f04979f4ad739085f01d99c8caf620b4f5 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 18 Jan 2022 18:35:02 +0100 +Subject: [PATCH] of: base: make small of_parse_phandle() variants static + inline + +Make all the smaller variants of the of_parse_phandle() static inline. +This also let us remove the empty function stubs if CONFIG_OF is not +defined. + +Suggested-by: Rob Herring +Signed-off-by: Michael Walle +[robh: move index < 0 check into __of_parse_phandle_with_args] +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc +--- + drivers/of/base.c | 131 +++------------------------------------ + include/linux/of.h | 148 ++++++++++++++++++++++++++++++++++++--------- + 2 files changed, 129 insertions(+), 150 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -1371,15 +1371,18 @@ int of_phandle_iterator_args(struct of_p + return count; + } + +-static int __of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int cell_count, int index, +- struct of_phandle_args *out_args) ++int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, int index, ++ struct of_phandle_args *out_args) + { + struct of_phandle_iterator it; + int rc, cur_index = 0; + ++ if (index < 0) ++ return -EINVAL; ++ + /* Loop over the phandles until all the requested entry is found */ + of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { + /* +@@ -1422,82 +1425,7 @@ static int __of_parse_phandle_with_args( + of_node_put(it.node); + return rc; + } +- +-/** +- * of_parse_phandle - Resolve a phandle property to a device_node pointer +- * @np: Pointer to device node holding phandle property +- * @phandle_name: Name of property holding a phandle value +- * @index: For properties holding a table of phandles, this is the index into +- * the table +- * +- * Return: The device_node pointer with refcount incremented. Use +- * of_node_put() on it when done. +- */ +-struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, int index) +-{ +- struct of_phandle_args args; +- +- if (index < 0) +- return NULL; +- +- if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, +- index, &args)) +- return NULL; +- +- return args.np; +-} +-EXPORT_SYMBOL(of_parse_phandle); +- +-/** +- * of_parse_phandle_with_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cells_name: property name that specifies phandles' arguments count +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * #list-cells = <2>; +- * }; +- * +- * phandle2: node2 { +- * #list-cells = <1>; +- * }; +- * +- * node3 { +- * list = <&phandle1 1 2 &phandle2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); +- */ +-int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, +- const char *cells_name, int index, +- struct of_phandle_args *out_args) +-{ +- int cell_count = -1; +- +- if (index < 0) +- return -EINVAL; +- +- /* If cells_name is NULL we assume a cell count of 0 */ +- if (!cells_name) +- cell_count = 0; +- +- return __of_parse_phandle_with_args(np, list_name, cells_name, +- cell_count, index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_args); ++EXPORT_SYMBOL(__of_parse_phandle_with_args); + + /** + * of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it +@@ -1684,47 +1612,6 @@ free: + EXPORT_SYMBOL(of_parse_phandle_with_args_map); + + /** +- * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cell_count: number of argument cells following the phandle +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * }; +- * +- * phandle2: node2 { +- * }; +- * +- * node3 { +- * list = <&phandle1 0 2 &phandle2 2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); +- */ +-int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cell_count, +- int index, struct of_phandle_args *out_args) +-{ +- if (index < 0) +- return -EINVAL; +- return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, +- index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_fixed_args); +- +-/** + * of_count_phandle_with_args() - Find the number of phandles references in a property + * @np: pointer to a device tree node containing a list + * @list_name: property name that contains a list +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -363,18 +363,12 @@ extern const struct of_device_id *of_mat + const struct of_device_id *matches, const struct device_node *node); + extern int of_modalias_node(struct device_node *node, char *modalias, int len); + extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args); +-extern struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index); +-extern int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, const char *cells_name, int index, +- struct of_phandle_args *out_args); ++extern int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, const char *cells_name, int cell_count, ++ int index, struct of_phandle_args *out_args); + extern int of_parse_phandle_with_args_map(const struct device_node *np, + const char *list_name, const char *stem_name, int index, + struct of_phandle_args *out_args); +-extern int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args); + extern int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, const char *cells_name); + +@@ -864,18 +858,12 @@ static inline int of_property_read_strin + return -ENOSYS; + } + +-static inline struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index) +-{ +- return NULL; +-} +- +-static inline int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int index, +- struct of_phandle_args *out_args) ++static inline int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) + { + return -ENOSYS; + } +@@ -889,13 +877,6 @@ static inline int of_parse_phandle_with_ + return -ENOSYS; + } + +-static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args) +-{ +- return -ENOSYS; +-} +- + static inline int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, + const char *cells_name) +@@ -1077,6 +1058,117 @@ static inline bool of_node_is_type(const + } + + /** ++ * of_parse_phandle - Resolve a phandle property to a device_node pointer ++ * @np: Pointer to device node holding phandle property ++ * @phandle_name: Name of property holding a phandle value ++ * @index: For properties holding a table of phandles, this is the index into ++ * the table ++ * ++ * Return: The device_node pointer with refcount incremented. Use ++ * of_node_put() on it when done. ++ */ ++static inline struct device_node *of_parse_phandle(const struct device_node *np, ++ const char *phandle_name, ++ int index) ++{ ++ struct of_phandle_args args; ++ ++ if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, ++ index, &args)) ++ return NULL; ++ ++ return args.np; ++} ++ ++/** ++ * of_parse_phandle_with_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * #list-cells = <2>; ++ * }; ++ * ++ * phandle2: node2 { ++ * #list-cells = <1>; ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 1 2 &phandle2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); ++ */ ++static inline int of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ int cell_count = -1; ++ ++ /* If cells_name is NULL we assume a cell count of 0 */ ++ if (!cells_name) ++ cell_count = 0; ++ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ cell_count, index, out_args); ++} ++ ++/** ++ * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cell_count: number of argument cells following the phandle ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * }; ++ * ++ * phandle2: node2 { ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 0 2 &phandle2 2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); ++ */ ++static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, ++ const char *list_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, ++ index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch b/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch new file mode 100644 index 00000000000..b829f21cfac --- /dev/null +++ b/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch @@ -0,0 +1,56 @@ +From 8eddceb280f5deb8046fcb660de9f9f683b408b9 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:21 +0100 +Subject: [PATCH] of: base: add of_parse_phandle_with_optional_args() + +Add a new variant of the of_parse_phandle_with_args() which treats the +cells name as optional. If it's missing, it is assumed that the phandle +has no arguments. + +Up until now, a nvmem node didn't have any arguments, so all the device +trees haven't any '#*-cells' property. But there is a need for an +additional argument for the phandle, for which we need a '#*-cells' +property. Therefore, we need to support nvmem nodes with and without +this property. + +Signed-off-by: Michael Walle +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + include/linux/of.h | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -1169,6 +1169,31 @@ static inline int of_parse_phandle_with_ + } + + /** ++ * of_parse_phandle_with_optional_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * Same as of_parse_phandle_with_args() except that if the cells_name property ++ * is not found, cell_count of 0 is assumed. ++ * ++ * This is used to useful, if you have a phandle which didn't have arguments ++ * before and thus doesn't have a '#*-cells' property but is now migrated to ++ * having arguments while retaining backwards compatibility. ++ */ ++static inline int of_parse_phandle_with_optional_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ 0, index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.15/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch b/target/linux/generic/backport-5.15/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch new file mode 100644 index 00000000000..4cf11ca34bb --- /dev/null +++ b/target/linux/generic/backport-5.15/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch @@ -0,0 +1,32 @@ +From 4f4145c9fee8c7a445dbbbadceccce5391e6b287 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:22 +0100 +Subject: [PATCH] of: property: make #.*-cells optional for simple props + +Sometimes, future bindings for phandles will get additional arguments. +Thus the target node of the phandle will need a new #.*-cells property. +To be backwards compatible, this needs to be optional. + +Prepare the DEFINE_SIMPLE_PROPS() to handle the cells name as optional. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1227,8 +1227,8 @@ static struct device_node *parse_suffix_ + if (strcmp_suffix(prop_name, suffix)) + return NULL; + +- if (of_parse_phandle_with_args(np, prop_name, cells_name, index, +- &sup_args)) ++ if (__of_parse_phandle_with_args(np, prop_name, cells_name, 0, index, ++ &sup_args)) + return NULL; + + return sup_args.np; diff --git a/target/linux/generic/backport-5.15/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch b/target/linux/generic/backport-5.15/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch new file mode 100644 index 00000000000..8c047e685d3 --- /dev/null +++ b/target/linux/generic/backport-5.15/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch @@ -0,0 +1,28 @@ +From 9cf9486a6a7e8a3d76154d0c506051ba3740e8b6 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:23 +0100 +Subject: [PATCH] of: property: add #nvmem-cell-cells property + +Bindings describe the new '#nvmem-cell-cells' property. Now that the +arguments count property is optional, we just add this property to the +nvmem-cells. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1276,7 +1276,7 @@ DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-c + DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells") + DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells") + DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) +-DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", NULL) ++DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", "#nvmem-cell-cells") + DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells") + DEFINE_SIMPLE_PROP(wakeup_parent, "wakeup-parent", NULL) + DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index a2dc9b90b1f..01bebbbab42 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -4244,6 +4244,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_NVMEM_BCM_OCOTP is not set # CONFIG_NVMEM_IMX_OCOTP is not set # CONFIG_NVMEM_REBOOT_MODE is not set +# CONFIG_NVMEM_RMEM is not set # CONFIG_NVMEM_SYSFS is not set # CONFIG_NVMEM_U_BOOT_ENV is not set # CONFIG_NVME_FC is not set diff --git a/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch index 5dd70f5f718..cf2a26c9d6a 100644 --- a/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch +++ b/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch @@ -75,36 +75,35 @@ Submitted-by: Yousong Zhou /** * Obtain the MAC address from an nvmem cell named 'mac-address' associated * with given device. -@@ -552,19 +609,23 @@ int nvmem_get_mac_address(struct device +@@ -550,21 +607,28 @@ EXPORT_SYMBOL(eth_platform_get_mac_addre + */ + int nvmem_get_mac_address(struct device *dev, void *addrbuf) { ++ struct nvmem_cell_mac_address_property *property; struct nvmem_cell *cell; const void *mac; - size_t len; -+ struct nvmem_cell_mac_address_property *property; + int i; - -- cell = nvmem_cell_get(dev, "mac-address"); -- if (IS_ERR(cell)) -- return PTR_ERR(cell); -- -- mac = nvmem_cell_read(cell, &len); -- nvmem_cell_put(cell); -- -- if (IS_ERR(mac)) -- return PTR_ERR(mac); ++ + for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) { + property = &nvmem_cell_mac_address_properties[i]; + cell = nvmem_cell_get(dev, property->name); -+ if (IS_ERR(cell)) { -+ if (i == ARRAY_SIZE(nvmem_cell_mac_address_properties) - 1) -+ return PTR_ERR(cell); -+ continue; -+ } -+ mac = property->read(cell); -+ nvmem_cell_put(cell); -+ break; ++ /* For -EPROBE_DEFER don't try other properties. We'll get back to this one. */ ++ if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER) ++ break; + } +- cell = nvmem_cell_get(dev, "mac-address"); + if (IS_ERR(cell)) + return PTR_ERR(cell); + +- mac = nvmem_cell_read(cell, &len); ++ mac = property->read(cell); + nvmem_cell_put(cell); +- + if (IS_ERR(mac)) + return PTR_ERR(mac); + - if (len != ETH_ALEN || !is_valid_ether_addr(mac)) { + if (!is_valid_ether_addr(mac)) { kfree(mac); diff --git a/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch b/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch index 17d3f2ffd59..dbba45b41c3 100644 --- a/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch +++ b/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch @@ -16,7 +16,7 @@ SVN-Revision: 36780 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1055,6 +1055,9 @@ int __init early_init_dt_scan_chosen(uns +@@ -1054,6 +1054,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)); diff --git a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch index 65772cc195d..b10b8d99796 100644 --- a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch +++ b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch @@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle #include "mtdcore.h" -@@ -1079,6 +1080,8 @@ int mtd_device_parse_register(struct mtd +@@ -1081,6 +1082,8 @@ int mtd_device_parse_register(struct mtd ret = mtd_otp_nvmem_add(mtd); diff --git a/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch b/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch index 15531df49ed..947b2c262f3 100644 --- a/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch +++ b/target/linux/generic/hack-5.15/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -759,7 +759,8 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -761,7 +761,8 @@ int add_mtd_device(struct mtd_info *mtd) mutex_unlock(&mtd_table_mutex); diff --git a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch index 4ab05b4ea6f..eb390961d78 100644 --- a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch +++ b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch @@ -75,36 +75,35 @@ Submitted-by: Yousong Zhou /** * nvmem_get_mac_address - Obtain the MAC address from an nvmem cell named * 'mac-address' associated with given device. -@@ -551,19 +608,23 @@ int nvmem_get_mac_address(struct device +@@ -549,21 +606,28 @@ EXPORT_SYMBOL(eth_platform_get_mac_addre + */ + int nvmem_get_mac_address(struct device *dev, void *addrbuf) { ++ struct nvmem_cell_mac_address_property *property; struct nvmem_cell *cell; const void *mac; - size_t len; -+ struct nvmem_cell_mac_address_property *property; + int i; - -- cell = nvmem_cell_get(dev, "mac-address"); -- if (IS_ERR(cell)) -- return PTR_ERR(cell); -- -- mac = nvmem_cell_read(cell, &len); -- nvmem_cell_put(cell); -- -- if (IS_ERR(mac)) -- return PTR_ERR(mac); ++ + for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) { + property = &nvmem_cell_mac_address_properties[i]; + cell = nvmem_cell_get(dev, property->name); -+ if (IS_ERR(cell)) { -+ if (i == ARRAY_SIZE(nvmem_cell_mac_address_properties) - 1) -+ return PTR_ERR(cell); -+ continue; -+ } -+ mac = property->read(cell); -+ nvmem_cell_put(cell); -+ break; ++ /* For -EPROBE_DEFER don't try other properties. We'll get back to this one. */ ++ if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER) ++ break; + } +- cell = nvmem_cell_get(dev, "mac-address"); + if (IS_ERR(cell)) + return PTR_ERR(cell); + +- mac = nvmem_cell_read(cell, &len); ++ mac = property->read(cell); + nvmem_cell_put(cell); +- + if (IS_ERR(mac)) + return PTR_ERR(mac); + - if (len != ETH_ALEN || !is_valid_ether_addr(mac)) { + if (!is_valid_ether_addr(mac)) { kfree(mac); diff --git a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch index 81993e35691..595318fa52a 100644 --- a/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.15/721-net-add-packet-mangeling.patch @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -1669,6 +1669,10 @@ enum netdev_priv_flags { +@@ -1676,6 +1676,10 @@ enum netdev_priv_flags { IFF_TX_SKB_NO_LINEAR = BIT_ULL(31), }; @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN #define IFF_EBRIDGE IFF_EBRIDGE #define IFF_BONDING IFF_BONDING -@@ -1701,6 +1705,7 @@ enum netdev_priv_flags { +@@ -1708,6 +1712,7 @@ enum netdev_priv_flags { #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER #define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK #define IFF_TX_SKB_NO_LINEAR IFF_TX_SKB_NO_LINEAR @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau /* Specifies the type of the struct net_device::ml_priv pointer */ enum netdev_ml_priv_type { -@@ -2002,6 +2007,7 @@ struct net_device { +@@ -2009,6 +2014,7 @@ struct net_device { /* Read-mostly cache-line for fast-path access */ unsigned int flags; unsigned int priv_flags; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau const struct net_device_ops *netdev_ops; int ifindex; unsigned short gflags; -@@ -2062,6 +2068,11 @@ struct net_device { +@@ -2069,6 +2075,11 @@ struct net_device { const struct tlsdev_ops *tlsdev_ops; #endif @@ -58,7 +58,7 @@ Signed-off-by: Felix Fietkau const struct header_ops *header_ops; unsigned char operstate; -@@ -2136,6 +2147,10 @@ struct net_device { +@@ -2143,6 +2154,10 @@ struct net_device { struct mctp_dev __rcu *mctp_ptr; #endif diff --git a/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch b/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch index 9fde1eaabb0..0a2c82cacbc 100644 --- a/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch +++ b/target/linux/generic/hack-5.15/800-GPIO-add-named-gpio-exports.patch @@ -105,7 +105,7 @@ Signed-off-by: John Crispin { --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h -@@ -715,6 +715,7 @@ static inline void devm_acpi_dev_remove_ +@@ -712,6 +712,7 @@ static inline void devm_acpi_dev_remove_ #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) @@ -113,7 +113,7 @@ Signed-off-by: John Crispin 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); -@@ -722,6 +723,13 @@ void gpiod_unexport(struct gpio_desc *de +@@ -719,6 +720,13 @@ void gpiod_unexport(struct gpio_desc *de #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ diff --git a/target/linux/generic/pending-5.10/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch b/target/linux/generic/pending-5.10/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch new file mode 100644 index 00000000000..cdb165e19df --- /dev/null +++ b/target/linux/generic/pending-5.10/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch @@ -0,0 +1,21 @@ +From f7982c726e02001afc19052fe48f642dfcbc00b2 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Mon, 26 Dec 2022 21:10:37 -0500 +Subject: [PATCH 1/2] spidev: Add Silicon Labs EM3581 device compatible + +Add compatible string for Silicon Labs EM3581 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -682,6 +682,7 @@ static const struct of_device_id spidev_ + { .compatible = "lwn,bk4" }, + { .compatible = "dh,dhcom-board" }, + { .compatible = "menlo,m53cpld" }, ++ { .compatible = "silabs,em3581" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.10/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch b/target/linux/generic/pending-5.10/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch new file mode 100644 index 00000000000..069e29255d2 --- /dev/null +++ b/target/linux/generic/pending-5.10/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch @@ -0,0 +1,22 @@ +From 536581825219e97fa2ae0c4de35605d2f6311416 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Tue, 27 Dec 2022 09:00:58 -0500 +Subject: [PATCH 2/2] spidev: Add Silicon Labs SI3210 device compatible + +Add compatible string for Silicon Labs SI3210 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay +--- + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -683,6 +683,7 @@ static const struct of_device_id spidev_ + { .compatible = "dh,dhcom-board" }, + { .compatible = "menlo,m53cpld" }, + { .compatible = "silabs,em3581" }, ++ { .compatible = "silabs,si3210" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch b/target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch deleted file mode 100644 index 355e900a3b3..00000000000 --- a/target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Giuseppe Lippolis -Subject: Add the linux,spidev compatible in spidev Several device in ramips have this binding in the dts - -Signed-off-by: Giuseppe Lippolis ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -682,6 +682,7 @@ static const struct of_device_id spidev_ - { .compatible = "lwn,bk4" }, - { .compatible = "dh,dhcom-board" }, - { .compatible = "menlo,m53cpld" }, -+ { .compatible = "siliconlabs,si3210" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch index 325fca62f3e..9383e48856d 100644 --- a/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch +++ b/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch @@ -8,7 +8,7 @@ Signed-off-by: Piotr Dymacz --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -15,6 +15,7 @@ static const struct flash_info eon_parts +@@ -25,6 +25,7 @@ static const struct flash_info eon_parts { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch b/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch index adddf82ac8f..3c579e55e34 100644 --- a/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch +++ b/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch @@ -11,7 +11,7 @@ Signed-off-by: Christian Marangi --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -16,6 +16,7 @@ static const struct flash_info eon_parts +@@ -26,6 +26,7 @@ static const struct flash_info eon_parts { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, diff --git a/target/linux/generic/pending-5.15/101-Use-stddefs.h-instead-of-compiler.h.patch b/target/linux/generic/pending-5.15/101-Use-stddefs.h-instead-of-compiler.h.patch deleted file mode 100644 index 55388fb58ae..00000000000 --- a/target/linux/generic/pending-5.15/101-Use-stddefs.h-instead-of-compiler.h.patch +++ /dev/null @@ -1,22 +0,0 @@ -From d3c5b26768dbe990c4e1bd79e420c11ce7491d51 Mon Sep 17 00:00:00 2001 -From: OpenWrt community -Date: Wed, 13 Jul 2022 11:36:00 +0200 -Subject: [PATCH] swab: use stddefs.h instead of compiler.h - -Fix an issue with kernel headers that broke perf. - ---- - include/uapi/linux/swab.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/include/uapi/linux/swab.h -+++ b/include/uapi/linux/swab.h -@@ -3,7 +3,7 @@ - #define _UAPI_LINUX_SWAB_H - - #include --#include -+#include - #include - #include - diff --git a/target/linux/generic/pending-5.15/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch b/target/linux/generic/pending-5.15/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch new file mode 100644 index 00000000000..f5e0c858b25 --- /dev/null +++ b/target/linux/generic/pending-5.15/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch @@ -0,0 +1,32 @@ +From f7982c726e02001afc19052fe48f642dfcbc00b2 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Mon, 26 Dec 2022 21:10:37 -0500 +Subject: [PATCH 1/2] spidev: Add Silicon Labs EM3581 device compatible + +Add compatible string for Silicon Labs EM3581 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay +--- + drivers/spi/spidev.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -693,6 +693,7 @@ static const struct spi_device_id spidev + { .name = "m53cpld" }, + { .name = "spi-petra" }, + { .name = "spi-authenta" }, ++ { .name = "em3581" }, + {}, + }; + MODULE_DEVICE_TABLE(spi, spidev_spi_ids); +@@ -707,6 +708,7 @@ static const struct of_device_id spidev_ + { .compatible = "menlo,m53cpld" }, + { .compatible = "cisco,spi-petra" }, + { .compatible = "micron,spi-authenta" }, ++ { .compatible = "silabs,em3581" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.15/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch b/target/linux/generic/pending-5.15/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch new file mode 100644 index 00000000000..575c893d508 --- /dev/null +++ b/target/linux/generic/pending-5.15/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch @@ -0,0 +1,32 @@ +From 536581825219e97fa2ae0c4de35605d2f6311416 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Tue, 27 Dec 2022 09:00:58 -0500 +Subject: [PATCH 2/2] spidev: Add Silicon Labs SI3210 device compatible + +Add compatible string for Silicon Labs SI3210 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay +--- + drivers/spi/spidev.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -694,6 +694,7 @@ static const struct spi_device_id spidev + { .name = "spi-petra" }, + { .name = "spi-authenta" }, + { .name = "em3581" }, ++ { .name = "si3210" }, + {}, + }; + MODULE_DEVICE_TABLE(spi, spidev_spi_ids); +@@ -709,6 +710,7 @@ static const struct of_device_id spidev_ + { .compatible = "cisco,spi-petra" }, + { .compatible = "micron,spi-authenta" }, + { .compatible = "silabs,em3581" }, ++ { .compatible = "silabs,si3210" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.15/130-add-linux-spidev-compatible-si3210.patch b/target/linux/generic/pending-5.15/130-add-linux-spidev-compatible-si3210.patch deleted file mode 100644 index d260cf1f9ab..00000000000 --- a/target/linux/generic/pending-5.15/130-add-linux-spidev-compatible-si3210.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Giuseppe Lippolis -Subject: Add the linux,spidev compatible in spidev Several device in ramips have this binding in the dts - -Signed-off-by: Giuseppe Lippolis ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -696,6 +696,7 @@ static const struct of_device_id spidev_ - { .compatible = "menlo,m53cpld" }, - { .compatible = "cisco,spi-petra" }, - { .compatible = "micron,spi-authenta" }, -+ { .compatible = "siliconlabs,si3210" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch b/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch index b4fa08f0ea9..60605ec05e7 100644 --- a/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch +++ b/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch @@ -202,7 +202,7 @@ Reported-by: Dan Carpenter return !!nor->params->erase_map.uniform_erase_type; } -@@ -2388,6 +2390,7 @@ static int spi_nor_select_erase(struct s +@@ -2389,6 +2391,7 @@ static int spi_nor_select_erase(struct s { struct spi_nor_erase_map *map = &nor->params->erase_map; const struct spi_nor_erase_type *erase = NULL; @@ -210,7 +210,7 @@ Reported-by: Dan Carpenter struct mtd_info *mtd = &nor->mtd; u32 wanted_size = nor->info->sector_size; int i; -@@ -2420,8 +2423,9 @@ static int spi_nor_select_erase(struct s +@@ -2421,8 +2424,9 @@ static int spi_nor_select_erase(struct s */ for (i = SNOR_ERASE_TYPE_MAX - 1; i >= 0; i--) { if (map->erase_type[i].size) { @@ -222,7 +222,7 @@ Reported-by: Dan Carpenter } } -@@ -2429,6 +2433,9 @@ static int spi_nor_select_erase(struct s +@@ -2430,6 +2434,9 @@ static int spi_nor_select_erase(struct s return -EINVAL; mtd->erasesize = erase->size; diff --git a/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch index 325fca62f3e..9383e48856d 100644 --- a/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch +++ b/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch @@ -8,7 +8,7 @@ Signed-off-by: Piotr Dymacz --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -15,6 +15,7 @@ static const struct flash_info eon_parts +@@ -25,6 +25,7 @@ static const struct flash_info eon_parts { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch b/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch index adddf82ac8f..3c579e55e34 100644 --- a/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch +++ b/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch @@ -11,7 +11,7 @@ Signed-off-by: Christian Marangi --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -16,6 +16,7 @@ static const struct flash_info eon_parts +@@ -26,6 +26,7 @@ static const struct flash_info eon_parts { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, diff --git a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 72938abd376..2b291813861 100644 --- a/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.15/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -2089,6 +2089,8 @@ struct net_device { +@@ -2096,6 +2096,8 @@ struct net_device { struct netdev_hw_addr_list mc; struct netdev_hw_addr_list dev_addrs; diff --git a/target/linux/generic/pending-5.15/834-ledtrig-libata.patch b/target/linux/generic/pending-5.15/834-ledtrig-libata.patch index 58b837c084f..9c85862a4bd 100644 --- a/target/linux/generic/pending-5.15/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-5.15/834-ledtrig-libata.patch @@ -134,7 +134,7 @@ Signed-off-by: Daniel Golle /* * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -888,6 +891,12 @@ struct ata_port { +@@ -894,6 +897,12 @@ struct ata_port { #ifdef CONFIG_ATA_ACPI struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ #endif 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 bceb434bffd..7a4cac868cb 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -59,6 +59,9 @@ ipq40xx_setup_interfaces() compex,wpj428) ucidef_set_interface_lan "lan1 lan2" ;; + linksys,whw01) + ucidef_set_interface_lan "eth1 eth2" + ;; glinet,gl-a1300|\ glinet,gl-b1300|\ mobipromo,cm520-79f) diff --git a/target/linux/ipq40xx/base-files/etc/init.d/bootcount b/target/linux/ipq40xx/base-files/etc/init.d/bootcount index 367ccfcd0ca..6acebcef6ec 100755 --- a/target/linux/ipq40xx/base-files/etc/init.d/bootcount +++ b/target/linux/ipq40xx/base-files/etc/init.d/bootcount @@ -11,7 +11,7 @@ boot() { linksys,ea6350v3|\ linksys,ea8300|\ linksys,mr8300|\ - linksys,whw01-v1) + linksys,whw01) mtd resetbc s_env || true ;; netgear,wac510) diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version index 44873b9df43..c0119208971 100644 --- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version @@ -1,6 +1,9 @@ . /lib/functions.sh case "$(board_name)" in +linksys,ea6350v3|\ +linksys,ea8300|\ +linksys,mr8300|\ ezviz,cs-w3-wd1200g-eup) uci set system.@system[0].compat_version="2.0" uci commit system diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/linksys.sh b/target/linux/ipq40xx/base-files/lib/upgrade/linksys.sh old mode 100755 new mode 100644 index f1dc81f7c9d..5d25c20ad71 --- a/target/linux/ipq40xx/base-files/lib/upgrade/linksys.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/linksys.sh @@ -47,6 +47,14 @@ linksys_get_target_firmware() { esac } +linksys_is_factory_image() { + local board=$(board_name) + board=${board##*,} + + # check matching footer signature + tail -c 256 $1 | grep -q -i "\.LINKSYS\.........${board}" +} + platform_do_upgrade_linksys() { local magic_long="$(get_magic_long "$1")" @@ -99,4 +107,14 @@ platform_do_upgrade_linksys() { echo "writing \"$1\" image to \"$part_label\"" get_image "$1" | mtd write - "$part_label" } + + [ "$magic_long" = "d00dfeed" ] && { + if ! linksys_is_factory_image "$1"; then + echo "factory image doesn't match device" + return 1 + fi + + echo "writing \"$1\" factory image to \"$part_label\"" + get_image "$1" | mtd -e "$part_label" write - "$part_label" + } } diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 12fa9699c57..73feefb3ead 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -164,7 +164,7 @@ platform_do_upgrade() { linksys,ea6350v3 |\ linksys,ea8300 |\ linksys,mr8300 |\ - linksys,whw01-v1) + linksys,whw01) platform_do_upgrade_linksys "$1" ;; meraki,mr33 |\ diff --git a/target/linux/ipq40xx/config-5.10 b/target/linux/ipq40xx/config-5.10 deleted file mode 100644 index 7a0d966aa00..00000000000 --- a/target/linux/ipq40xx/config-5.10 +++ /dev/null @@ -1,500 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_APQ_GCC_8084 is not set -# CONFIG_APQ_MMCC_8084 is not set -CONFIG_ARCH_32BIT_OFF_T=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_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=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_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_QCOM_CPUFREQ_NVMEM is not set -# CONFIG_ARM_QCOM_SPM_CPUIDLE 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_CMDLINE_PARSER=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_AES_ARM=y -CONFIG_CRYPTO_AES_ARM_BS=y -CONFIG_CRYPTO_BLAKE2S=y -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CRYPTD=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_INFO=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_LIB_DES=y -CONFIG_CRYPTO_LIB_SHA256=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_SEQIV=y -CONFIG_CRYPTO_SHA1=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_OPS=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_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_GETTIMEOFDAY=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_GENERIC_VDSO_32=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_74X164=y -CONFIG_GPIO_WATCHDOG=y -CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y -CONFIG_GRO_CELLS=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=y -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_QCOM_CCI is not set -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_APSS_PLL is not set -CONFIG_IPQ_GCC_4019=y -# CONFIG_IPQ_GCC_6018 is not set -# 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_FASTEOI_HIERARCHY_HANDLERS=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_LED_TRIGGER_PHY=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_DEVRES=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_HI6421_SPMI is not set -# 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_CQHCI=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_8939 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_GPUCC_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_MSM_MMCC_8998 is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_NAND_CORE=y -CONFIG_MTD_NAND_ECC=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_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_QCA8K_IPQ4019=y -CONFIG_NET_DSA_TAG_IPQ4019=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_PTP_CLASSIFY=y -CONFIG_NET_SWITCHDEV=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_SPMI_SDAM is not set -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_PHYLINK=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_IPQ806X_USB 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_USB_HS_28NM is not set -# CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2 is not set -# CONFIG_PHY_QCOM_USB_SS is not set -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_APQ8064 is not set -# CONFIG_PINCTRL_APQ8084 is not set -CONFIG_PINCTRL_IPQ4019=y -# CONFIG_PINCTRL_IPQ6018 is not set -# CONFIG_PINCTRL_IPQ8064 is not set -# CONFIG_PINCTRL_IPQ8074 is not set -# CONFIG_PINCTRL_MDM9615 is not set -CONFIG_PINCTRL_MSM=y -# CONFIG_PINCTRL_MSM8226 is not set -# CONFIG_PINCTRL_MSM8660 is not set -# CONFIG_PINCTRL_MSM8916 is not set -# CONFIG_PINCTRL_MSM8960 is not set -# CONFIG_PINCTRL_MSM8976 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_PINCTRL_SM8250 is not set -CONFIG_PM_OPP=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_MSM=y -CONFIG_POWER_RESET_GPIO_RESTART=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_CPR 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_IPQ4019_ESS_EDMA=y -# CONFIG_QCOM_LLCC is not set -# CONFIG_QCOM_OCMEM is not set -# CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y -# CONFIG_QCOM_RMTFS_MEM is not set -# CONFIG_QCOM_RPMH is not set -CONFIG_QCOM_SCM=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_Q6SSTOP_404 is not set -# CONFIG_QCS_TURING_404 is not set -CONFIG_RAS=y -CONFIG_RATIONAL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_QCOM_LABIBB is not set -# CONFIG_REGULATOR_QCOM_SPMI is not set -# CONFIG_REGULATOR_QCOM_USB_VBUS 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_SC_DISPCC_7180 is not set -# CONFIG_SC_GCC_7180 is not set -# CONFIG_SC_GPUCC_7180 is not set -# CONFIG_SC_LPASS_CORECC_7180 is not set -# CONFIG_SC_MSS_7180 is not set -# CONFIG_SC_VIDEOCC_7180 is not set -# 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_SM_GCC_8250 is not set -# CONFIG_SM_GPUCC_8150 is not set -# CONFIG_SM_GPUCC_8250 is not set -# CONFIG_SM_VIDEOCC_8150 is not set -# CONFIG_SM_VIDEOCC_8250 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_HISI3670 is not set -CONFIG_SPMI_MSM_PMIC_ARB=y -# CONFIG_SPMI_PMIC_CLKDIV is not set -CONFIG_SRCU=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/config-5.15 b/target/linux/ipq40xx/config-5.15 index 22b2d03d806..32260fa08c9 100644 --- a/target/linux/ipq40xx/config-5.15 +++ b/target/linux/ipq40xx/config-5.15 @@ -309,6 +309,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_QCOM_QFPROM=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y @@ -398,7 +399,6 @@ CONFIG_QCOM_IPQ4019_ESS_EDMA=y # CONFIG_QCOM_LLCC is not set # CONFIG_QCOM_OCMEM is not set # CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y # CONFIG_QCOM_RMTFS_MEM is not set # CONFIG_QCOM_RPMH is not set CONFIG_QCOM_SCM=y diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ea6350v3.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ea6350v3.dts index 75b556a7f92..cd5b4c6ccc3 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ea6350v3.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ea6350v3.dts @@ -269,17 +269,17 @@ label = "kernel"; reg = <0x00000000 0x02800000>; }; - rootfs@300000 { + rootfs@500000 { label = "rootfs"; - reg = <0x00300000 0x02500000>; + reg = <0x00500000 0x02300000>; }; alt_kernel@2800000 { label = "alt_kernel"; reg = <0x02800000 0x02800000>; }; - alt_rootfs@2b00000 { + alt_rootfs@2d00000 { label = "alt_rootfs"; - reg = <0x02b00000 0x02500000>; + reg = <0x02d00000 0x02300000>; }; sysdiag@5000000 { label = "sysdiag"; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01-v1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01.dts similarity index 95% rename from target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01-v1.dts rename to target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01.dts index 8ca57a0e852..5859548254f 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01-v1.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-whw01.dts @@ -6,8 +6,8 @@ #include / { - model = "Linksys WHW01 v1"; - compatible = "linksys,whw01-v1"; + model = "Linksys WHW01"; + compatible = "linksys,whw01"; aliases { serial0 = &blsp1_uart1; @@ -316,3 +316,21 @@ nvmem-cell-names = "pre-calibration"; nvmem-cells = <&precal_art_5000>; }; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + label = "eth1"; +}; + +&swport5 { + status = "okay"; + label = "eth2"; +}; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts index e17609ff6fb..96ab73962e9 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts @@ -211,7 +211,7 @@ status = "okay"; spidev1: spi@0 { - compatible = "siliconlabs,si3210"; + compatible = "silabs,si3210"; reg = <0>; spi-max-frequency = <24000000>; }; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi index 4f2cf1f516b..51a37290a03 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi @@ -195,9 +195,9 @@ reg = <0x780000 0x5800000>; }; - partition@a80000 { + partition@c80000 { label = "rootfs"; - reg = <0xa80000 0x5500000>; + reg = <0xc80000 0x5300000>; }; partition@5f80000 { @@ -205,9 +205,9 @@ reg = <0x5f80000 0x5800000>; }; - partition@6280000 { + partition@6480000 { label = "alt_rootfs"; - reg = <0x6280000 0x5500000>; + reg = <0x6480000 0x5300000>; }; partition@b780000 { diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts index fba6209d993..86f4514317a 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts @@ -359,6 +359,10 @@ macaddr_mfginfo_1d: macaddr@1d { reg = <0x1d 0x6>; }; + + macaddr_mfginfo_45: macaddr@45 { + reg = <0x45 0x6>; + }; }; partition@3a0000 { @@ -454,17 +458,15 @@ &wifi0 { status = "okay"; - qcom,ath10k-calibration-variant = "Aruba-AP-303"; nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_1000>, <&macaddr_mfginfo_1d>; + nvmem-cells = <&precal_art_1000>, <&macaddr_mfginfo_45>; qcom,ath10k-calibration-variant = "Aruba-AP-303"; }; &wifi1 { status = "okay"; - qcom,ath10k-calibration-variant = "Aruba-AP-303"; nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_5000>, <&macaddr_mfginfo_1d>; + nvmem-cells = <&precal_art_5000>, <&macaddr_mfginfo_45>; mac-address-increment = <1>; qcom,ath10k-calibration-variant = "Aruba-AP-303"; }; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts index 8ae8658a7ed..0e7f4c970f4 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts @@ -221,7 +221,7 @@ status = "okay"; spidev1: spi@0 { - compatible = "siliconlabs,si3210"; + compatible = "silabs,si3210"; reg = <0>; spi-max-frequency = <24000000>; }; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 5dae52ff0ea..f92e11c7971 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -637,96 +637,104 @@ endef # Missing DSA Setup #TARGET_DEVICES += glinet_gl-s1300 +define Device/kernel-size-6350-8300 + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Kernel partition size must be increased for \ + this OpenWrt version. Before continuing, you MUST issue either the \ + command "fw_setenv kernsize 500000" from the OpenWrt command line, \ + or "setenv kernsize 500000 ; saveenv" from the U-Boot serial console. \ + Instead of the sysupgrade image, you must then install the OpenWrt \ + factory image, setting the force flag and wiping the configuration. \ + (e.g. "sysupgrade -n -F openwrt-squashfs-factory.bin" on command line) +endef + define Device/linksys_ea6350v3 # The Linksys EA6350v3 has a uboot bootloader that does not # support either booting lzma kernel images nor booting UBI # partitions. This uboot, however, supports raw kernel images and # gzipped images. # - # As for the time of writing this, the device will boot the kernel - # from a fixed address with a fixed length of 3MiB. Also, the - # device has a hard-coded kernel command line that requieres the + # As configured by the OEM factory, the device will boot the kernel + # from a fixed address with a fixed length of 3 MiB. Also, the + # device has a hard-coded kernel command line that requires the # rootfs and alt_rootfs to be in mtd11 and mtd13 respectively. # Oh... and the kernel partition overlaps with the rootfs # partition (the same for alt_kernel and alt_rootfs). # # If you are planing re-partitioning the device, you may want to - # keep those details in mind: - # 1. The kernel adresses you should honor are 0x00000000 and + # keep these details in mind: + # 1. The kernel addresses you should honor are 0x00000000 and # 0x02800000 respectively. - # 2. The kernel size (plus the dtb) cannot exceed 3.00MiB in size. + # 2. The kernel size (plus the dtb) cannot exceed 3 MiB in size + # unless the uboot environment variable "kernsize" is increased. # 3. You can use 'zImage', but not a raw 'Image' packed with lzma. # 4. The kernel command line from uboot is harcoded to boot with # rootfs either in mtd11 or mtd13. $(call Device/FitzImage) + $(call Device/kernel-size-6350-8300) DEVICE_VENDOR := Linksys DEVICE_MODEL := EA6350 DEVICE_VARIANT := v3 SOC := qcom-ipq4018 BLOCKSIZE := 128k PAGESIZE := 2048 - KERNEL_SIZE := 3072k - IMAGE_SIZE := 37888k + KERNEL_SIZE := 5120k + IMAGE_SIZE := 35840k UBINIZE_OPTS := -E 5 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=EA6350v3 - DEFAULT := n endef TARGET_DEVICES += linksys_ea6350v3 define Device/linksys_ea8300 $(call Device/FitzImage) + $(call Device/kernel-size-6350-8300) DEVICE_VENDOR := Linksys DEVICE_MODEL := EA8300 SOC := qcom-ipq4019 - KERNEL_SIZE := 3072k - IMAGE_SIZE := 87040k + KERNEL_SIZE := 5120k + IMAGE_SIZE := 84992k BLOCKSIZE := 128k PAGESIZE := 2048 UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=EA8300 DEVICE_PACKAGES := ath10k-firmware-qca9888-ct ipq-wifi-linksys_ea8300 kmod-usb-ledtrig-usbport - DEFAULT := n endef TARGET_DEVICES += linksys_ea8300 define Device/linksys_mr8300 $(call Device/FitzImage) + $(call Device/kernel-size-6350-8300) DEVICE_VENDOR := Linksys DEVICE_MODEL := MR8300 SOC := qcom-ipq4019 - KERNEL_SIZE := 3072k - IMAGE_SIZE := 87040k + KERNEL_SIZE := 5120k + IMAGE_SIZE := 84992k BLOCKSIZE := 128k PAGESIZE := 2048 UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=MR8300 DEVICE_PACKAGES := ath10k-firmware-qca9888-ct kmod-usb-ledtrig-usbport - DEFAULT := n endef TARGET_DEVICES += linksys_mr8300 -define Device/linksys_whw01-v1 +define Device/linksys_whw01 $(call Device/FitzImage) DEVICE_VENDOR := Linksys DEVICE_MODEL := WHW01 - DEVICE_VARIANT := v1 KERNEL_SIZE := 6144k - IMAGE_SIZE := 28704512 # 28032k minus linksys signature (256-bytes). + IMAGE_SIZE := 75776K SOC := qcom-ipq4018 BLOCKSIZE := 128k PAGESIZE := 2048 UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF IMAGES += factory.bin - IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ - append-ubi | linksys-image type=WHW01 | pad-to $$$$(PAGESIZE) | \ - check-size + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=WHW01 DEVICE_PACKAGES := uboot-envtools kmod-leds-pca963x endef -# Missing DSA Setup -#TARGET_DEVICES += linksys_whw01-v1 +TARGET_DEVICES += linksys_whw01 define Device/luma_wrtq-329acn $(call Device/FitImage) diff --git a/target/linux/ipq40xx/patches-5.10/0001-v5.12-ARM-dts-qcom-ipq4019-add-USB-devicetree-nodes.patch b/target/linux/ipq40xx/patches-5.10/0001-v5.12-ARM-dts-qcom-ipq4019-add-USB-devicetree-nodes.patch deleted file mode 100644 index 5ebed88bb36..00000000000 --- a/target/linux/ipq40xx/patches-5.10/0001-v5.12-ARM-dts-qcom-ipq4019-add-USB-devicetree-nodes.patch +++ /dev/null @@ -1,99 +0,0 @@ -From b8afc254b40167fd37b4d4263e750dab1f9ef157 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Wed, 9 Sep 2020 18:38:31 +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 -Link: https://lore.kernel.org/r/20200909163831.1894142-1-robert.marko@sartura.hr -Signed-off-by: Bjorn Andersson ---- - 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 -@@ -606,5 +606,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.10/0002-v5.12-ARM-dts-qcom-ipq4019-add-more-labels.patch b/target/linux/ipq40xx/patches-5.10/0002-v5.12-ARM-dts-qcom-ipq4019-add-more-labels.patch deleted file mode 100644 index d7af2bb7b1f..00000000000 --- a/target/linux/ipq40xx/patches-5.10/0002-v5.12-ARM-dts-qcom-ipq4019-add-more-labels.patch +++ /dev/null @@ -1,44 +0,0 @@ -From d1ae4c808e7802008225078d93fbadd4aeea1e2d Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 9 Sep 2020 21:56:37 +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 -Link: https://lore.kernel.org/r/20200909195640.3127341-2-robert.marko@sartura.hr -Signed-off-by: Bjorn Andersson ---- - 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 -@@ -191,7 +191,7 @@ - reg = <0x1800000 0x60000>; - }; - -- rng@22000 { -+ prng: rng@22000 { - compatible = "qcom,prng"; - reg = <0x22000 0x140>; - clocks = <&gcc GCC_PRNG_AHB_CLK>; -@@ -301,7 +301,7 @@ - status = "disabled"; - }; - -- crypto@8e3a000 { -+ crypto: crypto@8e3a000 { - compatible = "qcom,crypto-v5.1"; - reg = <0x08e3a000 0x6000>; - clocks = <&gcc GCC_CRYPTO_AHB_CLK>, -@@ -387,7 +387,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.10/0003-v5.12-ARM-dts-qcom-ipq4019-add-SDHCI-VQMMC-LDO-node.patch b/target/linux/ipq40xx/patches-5.10/0003-v5.12-ARM-dts-qcom-ipq4019-add-SDHCI-VQMMC-LDO-node.patch deleted file mode 100644 index ff3fdc54078..00000000000 --- a/target/linux/ipq40xx/patches-5.10/0003-v5.12-ARM-dts-qcom-ipq4019-add-SDHCI-VQMMC-LDO-node.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e14775aa2feac18e7378cb8009b55c13d4236b50 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 7 Sep 2020 12:19:37 +0200 -Subject: [PATCH] ARM: dts: qcom: 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 -Cc: Luka Perkov -Link: https://lore.kernel.org/r/20200907101937.10155-1-robert.marko@sartura.hr -Signed-off-by: Bjorn Andersson ---- - 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 -@@ -210,6 +210,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.10/104-clk-fix-apss-cpu-overclocking.patch b/target/linux/ipq40xx/patches-5.10/104-clk-fix-apss-cpu-overclocking.patch deleted file mode 100644 index 25a2020bd26..00000000000 --- a/target/linux/ipq40xx/patches-5.10/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.10/300-clk-qcom-ipq4019-add-ess-reset.patch b/target/linux/ipq40xx/patches-5.10/300-clk-qcom-ipq4019-add-ess-reset.patch deleted file mode 100644 index 4297f32e051..00000000000 --- a/target/linux/ipq40xx/patches-5.10/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.10/301-arm-compressed-add-appended-DTB-section.patch b/target/linux/ipq40xx/patches-5.10/301-arm-compressed-add-appended-DTB-section.patch deleted file mode 100644 index 99e33632c4c..00000000000 --- a/target/linux/ipq40xx/patches-5.10/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 -@@ -101,6 +101,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 -@@ -138,4 +145,4 @@ SECTIONS - - ARM_ASSERTS - } --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.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 deleted file mode 100644 index 1aa5a9f3861..00000000000 --- a/target/linux/ipq40xx/patches-5.10/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 -@@ -602,6 +602,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.10/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch b/target/linux/ipq40xx/patches-5.10/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch deleted file mode 100644 index 07d274f0dd2..00000000000 --- a/target/linux/ipq40xx/patches-5.10/400-mmc-sdhci-sdhci-msm-use-sdhci_set_clock-instead-of-s.patch +++ /dev/null @@ -1,24 +0,0 @@ -From f63ea127643a605da97090ce585fdd7c2d17fa42 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 14 Dec 2020 13:35:35 +0100 -Subject: [PATCH] mmc: sdhci-msm: use sdhci_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 -@@ -2193,7 +2193,7 @@ MODULE_DEVICE_TABLE(of, sdhci_msm_dt_mat - - static const struct sdhci_ops sdhci_msm_ops = { - .reset = sdhci_msm_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.10/420-firmware-qcom-scm-disable-SDI.patch b/target/linux/ipq40xx/patches-5.10/420-firmware-qcom-scm-disable-SDI.patch deleted file mode 100644 index 27e3f427703..00000000000 --- a/target/linux/ipq40xx/patches-5.10/420-firmware-qcom-scm-disable-SDI.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/drivers/firmware/qcom_scm.c -+++ b/drivers/firmware/qcom_scm.c -@@ -404,6 +404,20 @@ static int __qcom_scm_set_dload_mode(str - return qcom_scm_call_atomic(__scm->dev, &desc, NULL); - } - -+static int __qcom_scm_disable_sdi(struct device *dev) -+{ -+ struct qcom_scm_desc desc = { -+ .svc = QCOM_SCM_SVC_BOOT, -+ .cmd = QCOM_SCM_BOOT_CONFIG_SDI, -+ .arginfo = QCOM_SCM_ARGS(2), -+ .args[0] = 1 /* 1: disable watchdog debug */, -+ .args[1] = 0 /* 0: disable SDI */, -+ .owner = ARM_SMCCC_OWNER_SIP, -+ }; -+ -+ return qcom_scm_call(__scm->dev, &desc, NULL); -+} -+ - static void qcom_scm_set_download_mode(bool enable) - { - bool avail; -@@ -1250,6 +1264,13 @@ static int qcom_scm_probe(struct platfor - if (download_mode) - qcom_scm_set_download_mode(true); - -+ /* -+ * Factory firmware leaves SDI (a debug interface), which prevents -+ * clean reboot. -+ */ -+ if (of_machine_is_compatible("google,wifi")) -+ __qcom_scm_disable_sdi(__scm->dev); -+ - return 0; - } - ---- a/drivers/firmware/qcom_scm.h -+++ b/drivers/firmware/qcom_scm.h -@@ -77,6 +77,7 @@ extern int scm_legacy_call(struct device - #define QCOM_SCM_SVC_BOOT 0x01 - #define QCOM_SCM_BOOT_SET_ADDR 0x01 - #define QCOM_SCM_BOOT_TERMINATE_PC 0x02 -+#define QCOM_SCM_BOOT_CONFIG_SDI 0x09 - #define QCOM_SCM_BOOT_SET_DLOAD_MODE 0x10 - #define QCOM_SCM_BOOT_SET_REMOTE_STATE 0x0a - #define QCOM_SCM_FLUSH_FLAG_MASK 0x3 diff --git a/target/linux/ipq40xx/patches-5.10/421-firmware-qcom-scm-cold-boot-address.patch b/target/linux/ipq40xx/patches-5.10/421-firmware-qcom-scm-cold-boot-address.patch deleted file mode 100644 index accf3e96860..00000000000 --- a/target/linux/ipq40xx/patches-5.10/421-firmware-qcom-scm-cold-boot-address.patch +++ /dev/null @@ -1,121 +0,0 @@ ---- a/drivers/firmware/qcom_scm-legacy.c -+++ b/drivers/firmware/qcom_scm-legacy.c -@@ -13,6 +13,9 @@ - #include - #include - -+#include -+#include -+ - #include "qcom_scm.h" - - static DEFINE_MUTEX(qcom_scm_lock); -@@ -117,6 +120,25 @@ static void __scm_legacy_do(const struct - } while (res->a0 == QCOM_SCM_INTERRUPTED); - } - -+static void qcom_scm_inv_range(unsigned long start, unsigned long end) -+{ -+ u32 cacheline_size, ctr; -+ -+ asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr)); -+ cacheline_size = 4 << ((ctr >> 16) & 0xf); -+ -+ start = round_down(start, cacheline_size); -+ end = round_up(end, cacheline_size); -+ outer_inv_range(start, end); -+ while (start < end) { -+ asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start) -+ : "memory"); -+ start += cacheline_size; -+ } -+ dsb(); -+ isb(); -+} -+ - /** - * qcom_scm_call() - Sends a command to the SCM and waits for the command to - * finish processing. -@@ -160,10 +182,16 @@ int scm_legacy_call(struct device *dev, - - rsp = scm_legacy_command_to_response(cmd); - -- cmd_phys = dma_map_single(dev, cmd, alloc_len, DMA_TO_DEVICE); -- if (dma_mapping_error(dev, cmd_phys)) { -- kfree(cmd); -- return -ENOMEM; -+ if (dev) { -+ cmd_phys = dma_map_single(dev, cmd, alloc_len, DMA_TO_DEVICE); -+ if (dma_mapping_error(dev, cmd_phys)) { -+ kfree(cmd); -+ return -ENOMEM; -+ } -+ } else { -+ cmd_phys = virt_to_phys(cmd); -+ __cpuc_flush_dcache_area(cmd, alloc_len); -+ outer_flush_range(cmd_phys, cmd_phys + alloc_len); - } - - smc.args[0] = 1; -@@ -179,13 +207,26 @@ int scm_legacy_call(struct device *dev, - goto out; - - do { -- dma_sync_single_for_cpu(dev, cmd_phys + sizeof(*cmd) + cmd_len, -- sizeof(*rsp), DMA_FROM_DEVICE); -+ if (dev) { -+ dma_sync_single_for_cpu(dev, cmd_phys + sizeof(*cmd) + -+ cmd_len, sizeof(*rsp), -+ DMA_FROM_DEVICE); -+ } else { -+ unsigned long start = (uintptr_t)cmd + sizeof(*cmd) + -+ cmd_len; -+ qcom_scm_inv_range(start, start + sizeof(*rsp)); -+ } - } while (!rsp->is_complete); - -- dma_sync_single_for_cpu(dev, cmd_phys + sizeof(*cmd) + cmd_len + -- le32_to_cpu(rsp->buf_offset), -- resp_len, DMA_FROM_DEVICE); -+ if (dev) { -+ dma_sync_single_for_cpu(dev, cmd_phys + sizeof(*cmd) + cmd_len + -+ le32_to_cpu(rsp->buf_offset), -+ resp_len, DMA_FROM_DEVICE); -+ } else { -+ unsigned long start = (uintptr_t)cmd + sizeof(*cmd) + cmd_len + -+ le32_to_cpu(rsp->buf_offset); -+ qcom_scm_inv_range(start, start + resp_len); -+ } - - if (res) { - res_buf = scm_legacy_get_response_buffer(rsp); -@@ -193,7 +234,8 @@ int scm_legacy_call(struct device *dev, - res->result[i] = le32_to_cpu(res_buf[i]); - } - out: -- dma_unmap_single(dev, cmd_phys, alloc_len, DMA_TO_DEVICE); -+ if (dev) -+ dma_unmap_single(dev, cmd_phys, alloc_len, DMA_TO_DEVICE); - kfree(cmd); - return ret; - } ---- a/drivers/firmware/qcom_scm.c -+++ b/drivers/firmware/qcom_scm.c -@@ -344,6 +344,17 @@ int qcom_scm_set_cold_boot_addr(void *en - desc.args[0] = flags; - desc.args[1] = virt_to_phys(entry); - -+ /* -+ * Factory firmware doesn't support the atomic variant. Non-atomic SCMs -+ * require ugly DMA invalidation support that was dropped upstream a -+ * while ago. For more info, see: -+ * -+ * [RFC] qcom_scm: IPQ4019 firmware does not support atomic API? -+ * https://lore.kernel.org/linux-arm-msm/20200913201608.GA3162100@bDebian/ -+ */ -+ if (of_machine_is_compatible("google,wifi")) -+ return qcom_scm_call(__scm ? __scm->dev : NULL, &desc, NULL); -+ - return qcom_scm_call_atomic(__scm ? __scm->dev : NULL, &desc, NULL); - } - EXPORT_SYMBOL(qcom_scm_set_cold_boot_addr); diff --git a/target/linux/ipq40xx/patches-5.10/444-mtd-nand-rawnand-add-support-for-Toshiba-TC58NVG0S3H.patch b/target/linux/ipq40xx/patches-5.10/444-mtd-nand-rawnand-add-support-for-Toshiba-TC58NVG0S3H.patch deleted file mode 100644 index 91919b28948..00000000000 --- a/target/linux/ipq40xx/patches-5.10/444-mtd-nand-rawnand-add-support-for-Toshiba-TC58NVG0S3H.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 35ca7e3e6ccd120d694a3425f37fc6374ad2e11e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andreas=20B=C3=B6hler?= -Date: Wed, 20 Apr 2022 12:08:38 +0200 -Subject: [PATCH] mtd: rawnand: add support for Toshiba TC58NVG0S3HTA00 - NAND flash -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Toshiba TC58NVG0S3HTA00 is detected with 64 byte OOB while the flash -has 128 bytes OOB. This adds a static NAND ID entry to correct this. - -Tested on FRITZ!Box 7530 flashed with OpenWrt. - -Signed-off-by: Andreas Böhler -(changed id_len to 8, added comment about possible counterfeits) ---- ---- a/drivers/mtd/nand/raw/nand_ids.c -+++ b/drivers/mtd/nand/raw/nand_ids.c -@@ -29,6 +29,9 @@ struct nand_flash_dev nand_flash_ids[] = - {"TC58NVG0S3E 1G 3.3V 8-bit", - { .id = {0x98, 0xd1, 0x90, 0x15, 0x76, 0x14, 0x01, 0x00} }, - SZ_2K, SZ_128, SZ_128K, 0, 8, 64, NAND_ECC_INFO(1, SZ_512), }, -+ {"TC58NVG0S3HTA00 1G 3.3V 8-bit", /* possibly counterfeit chip - see commit */ -+ { .id = {0x98, 0xf1, 0x80, 0x15} }, /* should be more bytes */ -+ SZ_2K, SZ_128, SZ_128K, 0, 8, 128, NAND_ECC_INFO(8, SZ_512), }, - {"TC58NVG2S0F 4G 3.3V 8-bit", - { .id = {0x98, 0xdc, 0x90, 0x26, 0x76, 0x15, 0x01, 0x08} }, - SZ_4K, SZ_512, SZ_256K, 0, 8, 224, NAND_ECC_INFO(4, SZ_512) }, diff --git a/target/linux/ipq40xx/patches-5.10/700-skbuff-add-DSA-specific-data-to-struct-skb_shared_in.patch b/target/linux/ipq40xx/patches-5.10/700-skbuff-add-DSA-specific-data-to-struct-skb_shared_in.patch deleted file mode 100644 index 7cad65aa0aa..00000000000 --- a/target/linux/ipq40xx/patches-5.10/700-skbuff-add-DSA-specific-data-to-struct-skb_shared_in.patch +++ /dev/null @@ -1,43 +0,0 @@ -From da75807ac41175e9db8c95f7a172b4133763b744 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 11 Jan 2021 17:49:36 +0100 -Subject: [PATCH] skbuff: add DSA specific data to struct skb_shared_info - -All of the already existing DSA tagging protocol drivers -are storing the tagging data directly into the skb. In most -cases that is the only way to send the required information -to the underlying ethernet switch. - -However on certain platforms (like the Qualcomm IPQ40xx -SoCs) the built-in ethernet switch is connected directly -to an ethernet MAC, and the tagging information must be -sent out-of-band which is done directly via the hardware -TX descriptors of the ethernet MAC. - -In such cases, putting the information into the skb causes -unneccesary overhead, because the ethernet driver must -remove that before sending the ethernet frame towards to -the hardware. - -This change adds two new DSA specific fields to struct -skb_shared_info which makes it possible to send the -tagging information via skb->shinfo. With this approach, -the twofold modifications of the skb data can be avoided. - -Signed-off-by: Gabor Juhos ---- - include/linux/skbuff.h | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -522,6 +522,9 @@ struct skb_shared_info { - unsigned int gso_type; - u32 tskey; - -+ unsigned int dsa_tag_proto; -+ unsigned char dsa_tag_data[8]; -+ - /* - * Warning : all fields before dataref are cleared in __alloc_skb() - */ diff --git a/target/linux/ipq40xx/patches-5.10/701-net-dsa-tag_ipq4019-add-shinfo-based-tagging-driver-.patch b/target/linux/ipq40xx/patches-5.10/701-net-dsa-tag_ipq4019-add-shinfo-based-tagging-driver-.patch deleted file mode 100644 index 133f1b8a96b..00000000000 --- a/target/linux/ipq40xx/patches-5.10/701-net-dsa-tag_ipq4019-add-shinfo-based-tagging-driver-.patch +++ /dev/null @@ -1,188 +0,0 @@ -From 29a0c2fae991cab142575c92276c0afdeb260ebe Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 28 Oct 2021 21:44:52 +0200 -Subject: [PATCH] net: dsa: tag_ipq4019: add shinfo based tagging driver for - IPQ40xx - -This change adds a tagging protocol driver for the built-in -ethernet switch of the Qualcomm Atheros IPQ4019 SoCs. - -In comparison to the existing tagging protocols this hardware -requires a slightly different approach because the switch does -not use in-band tags. - -On the receive path, the source port information is embedded -into the RX descriptors of the ethernet MAC hardware. Similarly, -the destination port mask must be sent via the TX descriptors -of the ethernet MAC when a packet is sent towards the switch. - -In order to support this special requirements, this patch -adds a new tagging protocol driver. - -The driver extracts the source port information directly -from the 'receive return descriptor' of the ethernet MAC. -It is possible because that descriptor is part of the skb -received from the ethernet driver. - -Unfortunatley, it is not possible to put the destination -port information directly to the TX descriptors, because -those are handled internally by the driver of the ethernet -hardware. - -To overcome this limitation, this tagging driver uses the -DSA specific fields in skb->shinfo to send the destination -port information to the ethernet driver. - -A similar tagging driver is exist but that uses skb -extensions which causes unnecessary overhead. - -Signed-off-by: Gabor Juhos ---- - include/linux/dsa/ipq4019.h | 11 ++++++ - include/net/dsa.h | 2 + - net/dsa/Kconfig | 6 +++ - net/dsa/Makefile | 1 + - net/dsa/tag_ipq4019.c | 79 +++++++++++++++++++++++++++++++++++++ - 5 files changed, 99 insertions(+) - create mode 100644 include/linux/dsa/ipq4019.h - create mode 100644 net/dsa/tag_ipq4019.c - ---- /dev/null -+++ b/include/linux/dsa/ipq4019.h -@@ -0,0 +1,11 @@ -+/* SPDX-License-Identifier: GPL-2.0-only */ -+ -+#ifndef DSA_IPQ40XX_H -+#define DSA_IPQ40XX_H -+ -+struct ipq40xx_dsa_tag_data { -+ u8 from_cpu; -+ u8 dp; -+}; -+ -+#endif /* DSA_IPQ40XX_H */ ---- a/include/net/dsa.h -+++ b/include/net/dsa.h -@@ -46,6 +46,7 @@ struct phylink_link_state; - #define DSA_TAG_PROTO_AR9331_VALUE 16 - #define DSA_TAG_PROTO_RTL4_A_VALUE 17 - #define DSA_TAG_PROTO_BRCM_LEGACY_VALUE 22 -+#define DSA_TAG_PROTO_IPQ4019_VALUE 24 - - enum dsa_tag_protocol { - DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE, -@@ -67,6 +68,7 @@ enum dsa_tag_protocol { - DSA_TAG_PROTO_OCELOT = DSA_TAG_PROTO_OCELOT_VALUE, - DSA_TAG_PROTO_AR9331 = DSA_TAG_PROTO_AR9331_VALUE, - DSA_TAG_PROTO_RTL4_A = DSA_TAG_PROTO_RTL4_A_VALUE, -+ DSA_TAG_PROTO_IPQ4019 = DSA_TAG_PROTO_IPQ4019_VALUE, - }; - - struct packet_type; ---- a/net/dsa/Kconfig -+++ b/net/dsa/Kconfig -@@ -63,6 +63,12 @@ config NET_DSA_TAG_BRCM_PREPEND - Broadcom switches which places the tag before the Ethernet header - (prepended). - -+config NET_DSA_TAG_IPQ4019 -+ tristate "Tag driver for Qualcomm Atheros IPQ4019 SoC built-in switch" -+ help -+ Say Y or M if you want to enable support for tagging frames for -+ the built-in switch of the Qualcomm Atheros IPQ4019 SoC-s. -+ - config NET_DSA_TAG_GSWIP - tristate "Tag driver for Lantiq / Intel GSWIP switches" - help ---- a/net/dsa/Makefile -+++ b/net/dsa/Makefile -@@ -10,6 +10,7 @@ obj-$(CONFIG_NET_DSA_TAG_BRCM_COMMON) += - obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o - obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o - obj-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o -+obj-$(CONFIG_NET_DSA_TAG_IPQ4019) += tag_ipq4019.o - obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o - obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o - obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o ---- /dev/null -+++ b/net/dsa/tag_ipq4019.c -@@ -0,0 +1,79 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+ -+/* Copyright (c) 2021, Gabor Juhos */ -+ -+#include -+#include -+ -+#include "dsa_priv.h" -+ -+/* Receive Return Descriptor */ -+struct edma_rrd { -+ u16 rrd0; -+ u16 rrd1; -+ u16 rrd2; -+ u16 rrd3; -+ u16 rrd4; -+ u16 rrd5; -+ u16 rrd6; -+ u16 rrd7; -+} __packed; -+ -+#define EDMA_RRD_SIZE sizeof(struct edma_rrd) -+ -+#define EDMA_RRD1_PORT_ID_MASK GENMASK(14, 12) -+ -+static struct sk_buff *ipq4019_sh_tag_xmit(struct sk_buff *skb, -+ struct net_device *dev) -+{ -+ struct dsa_port *dp = dsa_slave_to_port(dev); -+ struct ipq40xx_dsa_tag_data *tag_data; -+ -+ BUILD_BUG_ON(sizeof_field(struct skb_shared_info, dsa_tag_data) < -+ sizeof(struct ipq40xx_dsa_tag_data)); -+ -+ skb_shinfo(skb)->dsa_tag_proto = DSA_TAG_PROTO_IPQ4019; -+ tag_data = (struct ipq40xx_dsa_tag_data *)skb_shinfo(skb)->dsa_tag_data; -+ -+ tag_data->from_cpu = 1; -+ /* set the destination port information */ -+ tag_data->dp = BIT(dp->index); -+ -+ return skb; -+} -+ -+static struct sk_buff *ipq4019_sh_tag_rcv(struct sk_buff *skb, -+ struct net_device *dev, -+ struct packet_type *pt) -+{ -+ struct edma_rrd *rrd; -+ int offset; -+ int port; -+ -+ offset = EDMA_RRD_SIZE + ETH_HLEN; -+ if (unlikely(skb_headroom(skb) < offset)) -+ return NULL; -+ -+ rrd = (struct edma_rrd *)(skb->data - offset); -+ port = FIELD_GET(EDMA_RRD1_PORT_ID_MASK, rrd->rrd1); -+ -+ skb->dev = dsa_master_find_slave(dev, 0, port); -+ if (!skb->dev) -+ return NULL; -+ -+ return skb; -+} -+ -+const struct dsa_device_ops ipq4019_sh_tag_dsa_ops = { -+ .name = "ipq4019-sh", -+ .proto = DSA_TAG_PROTO_IPQ4019, -+ .xmit = ipq4019_sh_tag_xmit, -+ .rcv = ipq4019_sh_tag_rcv, -+}; -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("DSA tag driver for the IPQ4019 SoC built-in ethernet switch"); -+MODULE_AUTHOR("Gabor Juhos "); -+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_IPQ4019); -+ -+module_dsa_tag_driver(ipq4019_sh_tag_dsa_ops); diff --git a/target/linux/ipq40xx/patches-5.10/702-net-ethernet-qualcomm-add-IPQESS-support.patch b/target/linux/ipq40xx/patches-5.10/702-net-ethernet-qualcomm-add-IPQESS-support.patch deleted file mode 100644 index 72e9345118e..00000000000 --- a/target/linux/ipq40xx/patches-5.10/702-net-ethernet-qualcomm-add-IPQESS-support.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 4f488235f498db43f2412116dea6e02c7fb20216 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 1 Nov 2021 12:36:51 +0100 -Subject: [PATCH] net: ethernet: qualcomm: add IPQESS support - -Allow compiling the IPQESS driver that supports the -Qualcomm IPQ40xx SoC built-in ethernet controller. - -Signed-off-by: Robert Marko ---- - drivers/net/ethernet/qualcomm/Kconfig | 11 +++++++++++ - drivers/net/ethernet/qualcomm/Makefile | 1 + - 2 files changed, 12 insertions(+) - ---- a/drivers/net/ethernet/qualcomm/Kconfig -+++ b/drivers/net/ethernet/qualcomm/Kconfig -@@ -60,6 +60,17 @@ config QCOM_EMAC - low power, Receive-Side Scaling (RSS), and IEEE 1588-2008 - Precision Clock Synchronization Protocol. - -+config QCOM_IPQ4019_ESS_EDMA -+ tristate "Qualcomm Atheros IPQ4019 ESS EDMA support" -+ depends on OF -+ select PHYLINK -+ help -+ This driver supports the Qualcomm Atheros IPQ40xx built-in -+ ESS EDMA ethernet controller. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called ipqess. -+ - source "drivers/net/ethernet/qualcomm/rmnet/Kconfig" - - 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-y += ipqess/ - - obj-$(CONFIG_RMNET) += rmnet/ diff --git a/target/linux/ipq40xx/patches-5.10/703-arm-dts-ipq4019-add-ethernet-controller-DT-node.patch b/target/linux/ipq40xx/patches-5.10/703-arm-dts-ipq4019-add-ethernet-controller-DT-node.patch deleted file mode 100644 index 68fb4eb4cee..00000000000 --- a/target/linux/ipq40xx/patches-5.10/703-arm-dts-ipq4019-add-ethernet-controller-DT-node.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 44327d7098d4f32c24ec8c528e5aff6e030956bc Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 20 Oct 2021 13:21:45 +0200 -Subject: [PATCH] arm: dts: ipq4019: add ethernet controller DT node - -Since IPQ40xx SoC built-in ethernet controller now has a driver, -add its DT node so it can be used. - -Signed-off-by: Robert Marko ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 48 +++++++++++++++++++++++++++++ - 1 file changed, 48 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -38,6 +38,7 @@ - spi1 = &blsp1_spi2; - i2c0 = &blsp1_i2c3; - i2c1 = &blsp1_i2c4; -+ ethernet0 = &gmac; - }; - - cpus { -@@ -589,6 +590,57 @@ - status = "disabled"; - }; - -+ gmac: ethernet@c080000 { -+ compatible = "qcom,ipq4019-ess-edma"; -+ reg = <0xc080000 0x8000>; -+ resets = <&gcc ESS_RESET>; -+ reset-names = "ess_rst"; -+ clocks = <&gcc GCC_ESS_CLK>; -+ clock-names = "ess_clk"; -+ interrupts = , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ , -+ ; -+ -+ status = "disabled"; -+ -+ phy-mode = "internal"; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ pause; -+ asym-pause; -+ }; -+ }; -+ - mdio: mdio@90000 { - #address-cells = <1>; - #size-cells = <0>; diff --git a/target/linux/ipq40xx/patches-5.10/704-net-phy-define-PSGMII-PHY-interface-mode.patch b/target/linux/ipq40xx/patches-5.10/704-net-phy-define-PSGMII-PHY-interface-mode.patch deleted file mode 100644 index b98201e0d0e..00000000000 --- a/target/linux/ipq40xx/patches-5.10/704-net-phy-define-PSGMII-PHY-interface-mode.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 3e1825e00dafb68eec25df389b63f3ab3d905b59 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Fri, 25 Dec 2020 08:02:47 +0100 -Subject: [PATCH] net: phy: define PSGMII PHY interface mode - -The PSGMII interface is similar to QSGMII. The main difference -is that the PSGMII interface combines five SGMII lines into a -single link while in QSGMII only four lines are combined. - -Similarly to the QSGMII, this interface mode might also needs -special handling within the MAC driver. - -Add definitions for the PHY layer to allow to express this type -of connection between the MAC and PHY. - -Signed-off-by: Gabor Juhos ---- - Documentation/devicetree/bindings/net/ethernet-controller.yaml | 1 + - drivers/net/phy/phylink.c | 1 + - include/linux/phy.h | 3 +++ - 3 files changed, 5 insertions(+) - ---- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml -+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml -@@ -64,6 +64,7 @@ properties: - - mii - - gmii - - sgmii -+ - psgmii - - qsgmii - - tbi - - rev-mii ---- a/drivers/net/phy/phylink.c -+++ b/drivers/net/phy/phylink.c -@@ -289,6 +289,7 @@ static int phylink_parse_mode(struct phy - - switch (pl->link_config.interface) { - case PHY_INTERFACE_MODE_SGMII: -+ case PHY_INTERFACE_MODE_PSGMII: - case PHY_INTERFACE_MODE_QSGMII: - phylink_set(pl->supported, 10baseT_Half); - phylink_set(pl->supported, 10baseT_Full); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -134,6 +134,7 @@ typedef enum { - PHY_INTERFACE_MODE_XGMII, - PHY_INTERFACE_MODE_XLGMII, - PHY_INTERFACE_MODE_MOCA, -+ PHY_INTERFACE_MODE_PSGMII, - PHY_INTERFACE_MODE_QSGMII, - PHY_INTERFACE_MODE_TRGMII, - PHY_INTERFACE_MODE_100BASEX, -@@ -201,6 +202,8 @@ static inline const char *phy_modes(phy_ - return "xlgmii"; - case PHY_INTERFACE_MODE_MOCA: - return "moca"; -+ case PHY_INTERFACE_MODE_PSGMII: -+ return "psgmii"; - case PHY_INTERFACE_MODE_QSGMII: - return "qsgmii"; - case PHY_INTERFACE_MODE_TRGMII: diff --git a/target/linux/ipq40xx/patches-5.10/705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch b/target/linux/ipq40xx/patches-5.10/705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch deleted file mode 100644 index ed201b7c588..00000000000 --- a/target/linux/ipq40xx/patches-5.10/705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch +++ /dev/null @@ -1,53 +0,0 @@ -From b5f71652b85a85ea53162e9e2b760b84fd0d254f Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 1 Nov 2021 18:10:28 +0100 -Subject: [PATCH] net: dsa: add Qualcomm IPQ4019 built-in switch support - -Qualcomm IPQ40xx SoC-s have a variant of QCA8337N switch built-in. - -It shares most of the stuff with its external counterpart, however it is -modified for the SoC. -Namely, it doesn't have second CPU port (Port 6), so it has 6 ports -instead of 7. -It also has no built-in PHY-s but rather requires external PSGMII based -companion PHY-s (QCA8072 and QCA8075) for which it first needs to carry -out calibration before using them. -PSGMII has a SoC built-in PHY that is used to connect to the PHY-s which -unfortunately requires some magic values as the datasheet doesnt document -the bits that are being set or the register at all. - -Since its built-in it is MMIO like other peripherals and doesn't have its -own MDIO bus but depends on the SoC provided one. - -CPU connection is at Port 0 and it uses some kind of a internal connection -and no traditional RGMII/SGMII. -It also doesn't use in-band tagging like other qca8k switches so a shinfo -based tagger is used. - -Signed-off-by: Robert Marko ---- - drivers/net/dsa/qca/Kconfig | 9 +++++++++ - drivers/net/dsa/qca/Makefile | 1 + - 2 files changed, 10 insertions(+) - ---- a/drivers/net/dsa/qca/Kconfig -+++ b/drivers/net/dsa/qca/Kconfig -@@ -7,3 +7,12 @@ config NET_DSA_AR9331 - help - This enables support for the Qualcomm Atheros AR9331 built-in Ethernet - switch. -+ -+config NET_DSA_QCA8K_IPQ4019 -+ tristate "Qualcomm Atheros IPQ4019 built-in Ethernet switch support" -+ depends on HAS_IOMEM && NET_DSA -+ select NET_DSA_TAG_IPQ4019 -+ select REGMAP -+ help -+ This enables support for the Qualcomm Atheros IPQ4019 SoC built-in -+ Ethernet switch. ---- a/drivers/net/dsa/qca/Makefile -+++ b/drivers/net/dsa/qca/Makefile -@@ -1,2 +1,3 @@ - # SPDX-License-Identifier: GPL-2.0-only - obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o -+obj-$(CONFIG_NET_DSA_QCA8K_IPQ4019) += qca8k-ipq4019.o diff --git a/target/linux/ipq40xx/patches-5.10/706-arm-dts-ipq4019-add-switch-node.patch b/target/linux/ipq40xx/patches-5.10/706-arm-dts-ipq4019-add-switch-node.patch deleted file mode 100644 index a231c7331bf..00000000000 --- a/target/linux/ipq40xx/patches-5.10/706-arm-dts-ipq4019-add-switch-node.patch +++ /dev/null @@ -1,98 +0,0 @@ -From ebb62523990a27b3a25e422fa575619f7f725a20 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 1 Nov 2021 18:15:04 +0100 -Subject: [PATCH] arm: dts: ipq4019: add switch node - -Since the built-in IPQ40xx switch now has a driver, add the required node -for it to work. - -Signed-off-by: Robert Marko ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 78 +++++++++++++++++++++++++++++ - 1 file changed, 78 insertions(+) - ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -590,6 +590,82 @@ - status = "disabled"; - }; - -+ switch: switch@c000000 { -+ compatible = "qca,ipq4019-qca8337n"; -+ reg = <0xc000000 0x80000>, <0x98000 0x800>; -+ reg-names = "base", "psgmii_phy"; -+ resets = <&gcc ESS_PSGMII_ARES>; -+ reset-names = "psgmii_rst"; -+ mdio = <&mdio>; -+ psgmii-ethphy = <&psgmiiphy>; -+ -+ status = "disabled"; -+ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ port@0 { /* MAC0 */ -+ reg = <0>; -+ label = "cpu"; -+ ethernet = <&gmac>; -+ phy-mode = "internal"; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ pause; -+ asym-pause; -+ }; -+ }; -+ -+ swport1: port@1 { /* MAC1 */ -+ reg = <1>; -+ label = "lan1"; -+ phy-handle = <ðphy0>; -+ phy-mode = "psgmii"; -+ -+ status = "disabled"; -+ }; -+ -+ swport2: port@2 { /* MAC2 */ -+ reg = <2>; -+ label = "lan2"; -+ phy-handle = <ðphy1>; -+ phy-mode = "psgmii"; -+ -+ status = "disabled"; -+ }; -+ -+ swport3: port@3 { /* MAC3 */ -+ reg = <3>; -+ label = "lan3"; -+ phy-handle = <ðphy2>; -+ phy-mode = "psgmii"; -+ -+ status = "disabled"; -+ }; -+ -+ swport4: port@4 { /* MAC4 */ -+ reg = <4>; -+ label = "lan4"; -+ phy-handle = <ðphy3>; -+ phy-mode = "psgmii"; -+ -+ status = "disabled"; -+ }; -+ -+ swport5: port@5 { /* MAC5 */ -+ reg = <5>; -+ label = "wan"; -+ phy-handle = <ðphy4>; -+ phy-mode = "psgmii"; -+ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ - gmac: ethernet@c080000 { - compatible = "qcom,ipq4019-ess-edma"; - reg = <0xc080000 0x8000>; diff --git a/target/linux/ipq40xx/patches-5.10/707-dt-bindings-net-add-QCA807x-PHY.patch b/target/linux/ipq40xx/patches-5.10/707-dt-bindings-net-add-QCA807x-PHY.patch deleted file mode 100644 index dfb8d692abe..00000000000 --- a/target/linux/ipq40xx/patches-5.10/707-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.10/708-net-phy-Add-Qualcom-QCA807x-driver.patch b/target/linux/ipq40xx/patches-5.10/708-net-phy-Add-Qualcom-QCA807x-driver.patch deleted file mode 100644 index 12b21a803ce..00000000000 --- a/target/linux/ipq40xx/patches-5.10/708-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 -@@ -320,6 +320,12 @@ config AT803X_PHY - Currently supports the AR8030, AR8031, AR8033, AR8035 and internal - QCA8337(Internal qca8k PHY) model - -+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 -@@ -88,6 +88,7 @@ obj-$(CONFIG_MICROSEMI_PHY) += mscc/ - 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.10/709-arm-dts-ipq4019-QCA807x-properties.patch b/target/linux/ipq40xx/patches-5.10/709-arm-dts-ipq4019-QCA807x-properties.patch deleted file mode 100644 index cc4b44b393a..00000000000 --- a/target/linux/ipq40xx/patches-5.10/709-arm-dts-ipq4019-QCA807x-properties.patch +++ /dev/null @@ -1,61 +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>; -@@ -726,22 +727,38 @@ - - 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 = ; - }; - }; - diff --git a/target/linux/ipq40xx/patches-5.10/850-soc-add-qualcomm-syscon.patch b/target/linux/ipq40xx/patches-5.10/850-soc-add-qualcomm-syscon.patch deleted file mode 100644 index b39237b1ddd..00000000000 --- a/target/linux/ipq40xx/patches-5.10/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 -@@ -21,6 +21,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-qcom.o - obj-$(CONFIG_QCOM_RPMHPD) += rpmhpd.o ---- a/drivers/soc/qcom/Kconfig -+++ b/drivers/soc/qcom/Kconfig -@@ -190,6 +190,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.10/900-dts-ipq4019-ap-dk01.1.patch b/target/linux/ipq40xx/patches-5.10/900-dts-ipq4019-ap-dk01.1.patch deleted file mode 100644 index 5a245eb4313..00000000000 --- a/target/linux/ipq40xx/patches-5.10/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.10/902-dts-ipq4019-ap-dk04.1.patch b/target/linux/ipq40xx/patches-5.10/902-dts-ipq4019-ap-dk04.1.patch deleted file mode 100644 index ca321448466..00000000000 --- a/target/linux/ipq40xx/patches-5.10/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/ipq806x/config-5.10 b/target/linux/ipq806x/config-5.10 index f4d7ba75607..826dd734551 100644 --- a/target/linux/ipq806x/config-5.10 +++ b/target/linux/ipq806x/config-5.10 @@ -288,6 +288,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_QCOM_QFPROM=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -378,7 +379,6 @@ CONFIG_QCOM_HFPLL=y # CONFIG_QCOM_LLCC is not set # CONFIG_QCOM_OCMEM is not set # CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y # CONFIG_QCOM_RMTFS_MEM is not set CONFIG_QCOM_RPMCC=y # CONFIG_QCOM_RPMH is not set diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 7ea97ff89ec..72017e7528f 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -298,6 +298,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_QCOM_QFPROM=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -389,7 +390,6 @@ CONFIG_QCOM_HFPLL=y # CONFIG_QCOM_LLCC is not set # CONFIG_QCOM_OCMEM is not set # CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y # CONFIG_QCOM_RMTFS_MEM is not set CONFIG_QCOM_RPMCC=y # CONFIG_QCOM_RPMH is not set 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 ddc3b7cb527..3f433289617 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,7 +17,7 @@ default "" --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1059,6 +1059,17 @@ int __init early_init_dt_scan_chosen(uns +@@ -1058,6 +1058,17 @@ int __init early_init_dt_scan_chosen(uns if (p != NULL && l > 0) strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); diff --git a/target/linux/ipq806x/patches-5.15/122-01-clk-qcom-clk-krait-fix-wrong-div2-functions.patch b/target/linux/ipq806x/patches-5.15/122-01-clk-qcom-clk-krait-fix-wrong-div2-functions.patch deleted file mode 100644 index c729ea1b1f4..00000000000 --- a/target/linux/ipq806x/patches-5.15/122-01-clk-qcom-clk-krait-fix-wrong-div2-functions.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2acc3260050cf17d72ec5fb7a00cd91cf53ef5b6 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Fri, 23 Sep 2022 18:42:29 +0200 -Subject: [PATCH 1/4] clk: qcom: clk-krait: fix wrong div2 functions - -Currently div2 value is applied to the wrong bits. This is caused by a -bug in the code where the shift is done only for lpl, for anything -else the mask is not shifted to the correct bits. - -Fix this by correctly shift if lpl is not supported. - -Fixes: 4d7dc77babfe ("clk: qcom: Add support for Krait clocks") -Signed-off-by: Christian Marangi ---- - drivers/clk/qcom/clk-krait.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/clk/qcom/clk-krait.c -+++ b/drivers/clk/qcom/clk-krait.c -@@ -114,6 +114,8 @@ static int krait_div2_set_rate(struct cl - - if (d->lpl) - mask = mask << (d->shift + LPL_SHIFT) | mask << d->shift; -+ else -+ mask <<= d->shift; - - spin_lock_irqsave(&krait_clock_reg_lock, flags); - val = krait_get_l2_indirect_reg(d->offset); diff --git a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch index 34fe761d1e6..49861945484 100644 --- a/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch +++ b/target/linux/lantiq/patches-5.15/0152-lantiq-VPE.patch @@ -39,7 +39,7 @@ /* check we are the Master VPE */ local_irq_save(flags); -@@ -417,6 +418,8 @@ int __init vpe_module_init(void) +@@ -416,6 +417,8 @@ int __init vpe_module_init(void) } v->ntcs = hw_tcs - aprp_cpu_index(); diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds index bac3ed2b531..8f59538b831 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds @@ -28,7 +28,10 @@ arcadyan,arv7519rw22) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0.1" ;; arcadyan,vgv7510kw22-nor|\ -arcadyan,vgv7510kw22-brn|\ +arcadyan,vgv7510kw22-brn) + ucidef_set_led_netdev "internet" "internet" "$led_internet" "wan" + ucidef_set_led_wlan "wifi" "wifi" "green:wlan" "phy0radio" + ;; zyxel,p-2812hnu-f1|\ zyxel,p-2812hnu-f3) ucidef_set_led_wlan "wifi" "wifi" "green:wlan" "phy0radio" diff --git a/target/linux/layerscape/armv8_64b/config-5.10 b/target/linux/layerscape/armv8_64b/config-5.10 index 36ca870618e..4b8a819edff 100644 --- a/target/linux/layerscape/armv8_64b/config-5.10 +++ b/target/linux/layerscape/armv8_64b/config-5.10 @@ -541,6 +541,7 @@ CONFIG_NUMA=y CONFIG_NUMA_BALANCING=y CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y CONFIG_NVMEM=y +# CONFIG_NVMEM_LAYERSCAPE_SFP is not set # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk index e8b2e84abb4..4a69f1c19e1 100644 --- a/target/linux/layerscape/image/armv8_64b.mk +++ b/target/linux/layerscape/image/armv8_64b.mk @@ -29,7 +29,7 @@ define Device/fsl_ls1012a-frdm DEVICE_MODEL := FRDM-LS1012A DEVICE_PACKAGES += \ layerscape-ppfe \ - tfa-ls1012a-frdm \ + trusted-firmware-a-ls1012a-frdm \ kmod-ppfe BLOCKSIZE := 256KiB IMAGE/firmware.bin := \ @@ -55,7 +55,7 @@ define Device/fsl_ls1012a-rdb DEVICE_MODEL := LS1012A-RDB DEVICE_PACKAGES += \ layerscape-ppfe \ - tfa-ls1012a-rdb \ + trusted-firmware-a-ls1012a-rdb \ kmod-hwmon-ina2xx \ kmod-iio-fxas21002c-i2c \ kmod-iio-fxos8700-i2c \ @@ -79,7 +79,7 @@ define Device/fsl_ls1012a-frwy-sdboot DEVICE_MODEL := FRWY-LS1012A DEVICE_PACKAGES += \ layerscape-ppfe \ - tfa-ls1012a-frwy-sdboot \ + trusted-firmware-a-ls1012a-frwy-sdboot \ kmod-ppfe DEVICE_DTS := freescale/fsl-ls1012a-frwy IMAGES += firmware.bin @@ -105,7 +105,7 @@ define Device/fsl_ls1043a-rdb DEVICE_VARIANT := Default DEVICE_PACKAGES += \ layerscape-fman \ - tfa-ls1043a-rdb \ + trusted-firmware-a-ls1043a-rdb \ fmc fmc-eth-config \ kmod-ahci-qoriq \ kmod-hwmon-ina2xx \ @@ -131,7 +131,7 @@ define Device/fsl_ls1043a-rdb-sdboot DEVICE_VARIANT := SD Card Boot DEVICE_PACKAGES += \ layerscape-fman \ - tfa-ls1043a-rdb-sdboot \ + trusted-firmware-a-ls1043a-rdb-sdboot \ fmc fmc-eth-config \ kmod-ahci-qoriq \ kmod-hwmon-ina2xx \ @@ -155,7 +155,7 @@ define Device/fsl_ls1046a-frwy DEVICE_VARIANT := Default DEVICE_PACKAGES += \ layerscape-fman \ - tfa-ls1046a-frwy + trusted-firmware-a-ls1046a-frwy DEVICE_DTS := freescale/fsl-ls1046a-frwy IMAGE/firmware.bin := \ ls-clean | \ @@ -176,7 +176,7 @@ define Device/fsl_ls1046a-frwy-sdboot DEVICE_VARIANT := SD Card Boot DEVICE_PACKAGES += \ layerscape-fman \ - tfa-ls1046a-frwy-sdboot + trusted-firmware-a-ls1046a-frwy-sdboot DEVICE_DTS := freescale/fsl-ls1046a-frwy IMAGE/sdcard.img.gz := \ ls-clean | \ @@ -197,7 +197,7 @@ define Device/fsl_ls1046a-rdb DEVICE_VARIANT := Default DEVICE_PACKAGES += \ layerscape-fman \ - tfa-ls1046a-rdb \ + trusted-firmware-a-ls1046a-rdb \ fmc fmc-eth-config \ kmod-ahci-qoriq \ kmod-hwmon-ina2xx \ @@ -223,7 +223,7 @@ define Device/fsl_ls1046a-rdb-sdboot DEVICE_VARIANT := SD Card Boot DEVICE_PACKAGES += \ layerscape-fman \ - tfa-ls1046a-rdb-sdboot \ + trusted-firmware-a-ls1046a-rdb-sdboot \ fmc fmc-eth-config \ kmod-ahci-qoriq \ kmod-hwmon-ina2xx \ @@ -249,7 +249,7 @@ define Device/fsl_ls1088a-rdb DEVICE_PACKAGES += \ layerscape-mc \ layerscape-dpl \ - tfa-ls1088a-rdb \ + trusted-firmware-a-ls1088a-rdb \ restool \ kmod-ahci-qoriq \ kmod-hwmon-ina2xx \ @@ -277,7 +277,7 @@ define Device/fsl_ls1088a-rdb-sdboot DEVICE_PACKAGES += \ layerscape-mc \ layerscape-dpl \ - tfa-ls1088a-rdb-sdboot \ + trusted-firmware-a-ls1088a-rdb-sdboot \ restool \ kmod-ahci-qoriq \ kmod-hwmon-ina2xx \ @@ -304,7 +304,7 @@ define Device/fsl_ls2088a-rdb DEVICE_PACKAGES += \ layerscape-mc \ layerscape-dpl \ - tfa-ls2088a-rdb \ + trusted-firmware-a-ls2088a-rdb \ restool \ kmod-ahci-qoriq IMAGE/firmware.bin := \ @@ -329,7 +329,7 @@ define Device/fsl_lx2160a-rdb layerscape-mc \ layerscape-dpl \ layerscape-ddr-phy \ - tfa-lx2160a-rdb \ + trusted-firmware-a-lx2160a-rdb \ restool IMAGE/firmware.bin := \ ls-clean | \ @@ -355,7 +355,7 @@ define Device/fsl_lx2160a-rdb-sdboot layerscape-mc \ layerscape-dpl \ layerscape-ddr-phy \ - tfa-lx2160a-rdb-sdboot \ + trusted-firmware-a-lx2160a-rdb-sdboot \ restool DEVICE_DTS := freescale/fsl-lx2160a-rdb IMAGE/sdcard.img.gz := \ diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index ad3111a6e33..6a989310df9 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -233,7 +233,6 @@ CONFIG_MTD_UBI_FASTMAP=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set # CONFIG_MTK_CQDMA is not set -CONFIG_MTK_EFUSE=y CONFIG_MTK_HSDMA=y CONFIG_MTK_INFRACFG=y CONFIG_MTK_PMIC_WRAP=y @@ -260,6 +259,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_MTK_EFUSE=y CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 9760097ee4a..097ddd6bfd2 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -129,7 +129,7 @@ define Device/buffalo_wsr-2533dhp2 IMAGE/sysupgrade.bin := append-kernel | \ buffalo-kernel-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata - DEVICE_PACKAGES := swconfig + DEVICE_PACKAGES := kmod-mt7615-firmware swconfig endef TARGET_DEVICES += buffalo_wsr-2533dhp2 @@ -138,7 +138,7 @@ define Device/elecom_wrc-2533gent DEVICE_MODEL := WRC-2533GENT DEVICE_DTS := mt7622-elecom-wrc-2533gent DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-btmtkuart kmod-usb3 swconfig + DEVICE_PACKAGES := kmod-btmtkuart kmod-mt7615-firmware kmod-usb3 swconfig endef TARGET_DEVICES += elecom_wrc-2533gent @@ -158,7 +158,7 @@ define Device/elecom_wrc-x3200gst3 elecom-wrc-gs-factory WRC-X3200GST3 0.00 -N | \ append-string MT7622_ELECOM_WRC-X3200GST3 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += elecom_wrc-x3200gst3 @@ -169,7 +169,7 @@ define Device/linksys_e8450 DEVICE_ALT0_MODEL := RT3200 DEVICE_DTS := mt7622-linksys-e8450 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 endef TARGET_DEVICES += linksys_e8450 @@ -182,7 +182,7 @@ define Device/linksys_e8450-ubi DEVICE_ALT0_VARIANT := UBI DEVICE_DTS := mt7622-linksys-e8450-ubi DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 @@ -233,7 +233,7 @@ define Device/ruijie_rg-ew3200gx-pro DEVICE_MODEL := RG-EW3200GX PRO DEVICE_DTS := mt7622-ruijie-rg-ew3200gx-pro DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += ruijie_rg-ew3200gx-pro @@ -242,7 +242,7 @@ define Device/reyee_ax3200-e5 DEVICE_MODEL := AX3200 E5 DEVICE_DTS := mt7622-reyee-ax3200-e5 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += reyee_ax3200-e5 @@ -251,7 +251,7 @@ define Device/totolink_a8000ru DEVICE_MODEL := A8000RU DEVICE_DTS := mt7622-totolink-a8000ru DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := swconfig + DEVICE_PACKAGES := kmod-mt7615-firmware swconfig IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += totolink_a8000ru @@ -263,7 +263,7 @@ define Device/ubnt_unifi-6-lr-v1 DEVICE_DTS_CONFIG := config@1 DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v1 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-leds-ubnt-ledbar + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-leds-ubnt-ledbar SUPPORTED_DEVICES += ubnt,unifi-6-lr endef TARGET_DEVICES += ubnt_unifi-6-lr-v1 @@ -274,7 +274,7 @@ define Device/ubnt_unifi-6-lr-v1-ubootmod DEVICE_VARIANT := v1 U-Boot mod DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v1-ubootmod DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-leds-ubnt-ledbar + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-leds-ubnt-ledbar KERNEL := kernel-bin | lzma KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k @@ -294,7 +294,7 @@ define Device/ubnt_unifi-6-lr-v2 DEVICE_DTS_CONFIG := config@1 DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v2 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += ubnt_unifi-6-lr-v2 @@ -304,7 +304,7 @@ define Device/ubnt_unifi-6-lr-v2-ubootmod DEVICE_VARIANT := v2 U-Boot mod DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v2-ubootmod DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware KERNEL := kernel-bin | lzma KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k @@ -324,7 +324,7 @@ define Device/xiaomi_redmi-router-ax6s DEVICE_DTS := mt7622-xiaomi-redmi-router-ax6s DEVICE_DTS_DIR := ../dts BOARD_NAME := xiaomi,redmi-router-ax6s - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware UBINIZE_OPTS := -E 5 IMAGES += factory.bin BLOCKSIZE := 128k diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index f17876fb055..3f99221c212 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -262,7 +262,6 @@ CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set # CONFIG_MTK_CQDMA is not set -CONFIG_MTK_EFUSE=y CONFIG_MTK_HSDMA=y CONFIG_MTK_INFRACFG=y CONFIG_MTK_PMIC_WRAP=y @@ -289,6 +288,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_MTK_EFUSE=y CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/mediatek/mt7622/target.mk b/target/linux/mediatek/mt7622/target.mk index 92c3f47370e..7c9d57b6a13 100644 --- a/target/linux/mediatek/mt7622/target.mk +++ b/target/linux/mediatek/mt7622/target.mk @@ -2,7 +2,7 @@ ARCH:=aarch64 SUBTARGET:=mt7622 BOARDNAME:=MT7622 CPU_TYPE:=cortex-a53 -DEFAULT_PACKAGES += kmod-mt7615e kmod-mt7615-firmware wpad-basic-wolfssl uboot-envtools +DEFAULT_PACKAGES += kmod-mt7622-firmware wpad-basic-wolfssl uboot-envtools KERNELNAME:=Image dtbs define Target/Description diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index 898e721df44..984e85aba0b 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -350,7 +350,6 @@ CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTK_CMDQ=y CONFIG_MTK_CMDQ_MBOX=y CONFIG_MTK_CQDMA=y -CONFIG_MTK_EFUSE=y # CONFIG_MTK_HSDMA is not set CONFIG_MTK_INFRACFG=y CONFIG_MTK_IOMMU=y @@ -386,6 +385,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_MTK_EFUSE=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/mediatek/mt7629/config-5.15 b/target/linux/mediatek/mt7629/config-5.15 index 39596717ae2..fc53bec882e 100644 --- a/target/linux/mediatek/mt7629/config-5.15 +++ b/target/linux/mediatek/mt7629/config-5.15 @@ -187,7 +187,6 @@ CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set -# CONFIG_MTK_EFUSE is not set CONFIG_MTK_INFRACFG=y # CONFIG_MTK_PMIC_WRAP is not set CONFIG_MTK_SCPSYS=y @@ -212,6 +211,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +# CONFIG_NVMEM_MTK_EFUSE is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y 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 9242fce4e21..95ce5f2bb91 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,7 +17,7 @@ help --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1059,6 +1059,17 @@ int __init early_init_dt_scan_chosen(uns +@@ -1058,6 +1058,17 @@ int __init early_init_dt_scan_chosen(uns if (p != NULL && l > 0) strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts index acf15e8ca96..72d7267ccd0 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts @@ -96,7 +96,7 @@ partition@f0000 { label = "u-boot-env"; - reg = <0Xf0000 0x8000>; + reg = <0xf0000 0x8000>; read-only; }; @@ -105,6 +105,24 @@ reg = <0xf8000 0x8000>; read-only; }; + + partition@100000 { + label = "gl-firmware-dtb"; + reg = <0x100000 0x10000>; + read-only; + }; + + partition@110000 { + label = "gl-firmware"; + reg = <0x110000 0xef0000>; + read-only; + }; + + partition@ef0000 { + label = "gl-firmware-jffs2"; + reg = <0xef0000 0x110000>; + read-only; + }; }; }; }; diff --git a/target/linux/mvebu/patches-5.15/100-ARM-dts-turris-omnia-configure-LED-0-pin-function-to.patch b/target/linux/mvebu/patches-5.15/100-ARM-dts-turris-omnia-configure-LED-0-pin-function-to.patch index 27937375568..67beb065416 100644 --- a/target/linux/mvebu/patches-5.15/100-ARM-dts-turris-omnia-configure-LED-0-pin-function-to.patch +++ b/target/linux/mvebu/patches-5.15/100-ARM-dts-turris-omnia-configure-LED-0-pin-function-to.patch @@ -26,7 +26,7 @@ Signed-off-by: Marek Behún --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts -@@ -390,7 +390,8 @@ +@@ -396,7 +396,8 @@ phy1: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; diff --git a/target/linux/mvebu/patches-5.15/101-ARM-dts-turris-omnia-enable-LED-controller-node.patch b/target/linux/mvebu/patches-5.15/101-ARM-dts-turris-omnia-enable-LED-controller-node.patch index 5b8ce56f5d6..ecfb43553f5 100644 --- a/target/linux/mvebu/patches-5.15/101-ARM-dts-turris-omnia-enable-LED-controller-node.patch +++ b/target/linux/mvebu/patches-5.15/101-ARM-dts-turris-omnia-enable-LED-controller-node.patch @@ -20,7 +20,7 @@ Signed-off-by: Marek Behún --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts -@@ -188,15 +188,13 @@ +@@ -194,15 +194,13 @@ reg = <0x2b>; #address-cells = <1>; #size-cells = <0>; @@ -38,7 +38,7 @@ Signed-off-by: Marek Behún * - there are 3 LEDs connected via MCU to PCIe * ports. One of these ports supports mSATA. * There is no mSATA nor PCIe function. -@@ -207,7 +205,6 @@ +@@ -213,7 +211,6 @@ * B. Again there is no such function defined. * For now we use LED_FUNCTION_INDICATOR */ diff --git a/target/linux/mvebu/patches-5.15/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch b/target/linux/mvebu/patches-5.15/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch index 84d995b902a..c043a99c8b7 100644 --- a/target/linux/mvebu/patches-5.15/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch +++ b/target/linux/mvebu/patches-5.15/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch @@ -26,7 +26,7 @@ Cc: Robert Marko --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig -@@ -2187,6 +2187,15 @@ config SGI_MFD_IOC3 +@@ -2188,6 +2188,15 @@ config SGI_MFD_IOC3 If you have an SGI Origin, Octane, or a PCI IOC3 card, then say Y. Otherwise say N. diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile index 68a8259b76e..50c5cd6d217 100644 --- a/target/linux/octeontx/Makefile +++ b/target/linux/octeontx/Makefile @@ -7,10 +7,11 @@ include $(TOPDIR)/rules.mk ARCH:=aarch64 BOARD:=octeontx BOARDNAME:=Octeon-TX -FEATURES:=targz pcie gpio rtc usb fpu +FEATURES:=squashfs ramdisk targz pcie gpio rtc usb fpu SUBTARGETS:=generic KERNEL_PATCHVER:=5.10 +KERNEL_TESTING_PATCHVER:=5.15 define Target/Description Build images for Octeon-TX CN80XX/CN81XX based boards diff --git a/target/linux/octeontx/config-5.15 b/target/linux/octeontx/config-5.15 new file mode 100644 index 00000000000..36402b70ebf --- /dev/null +++ b/target/linux/octeontx/config-5.15 @@ -0,0 +1,421 @@ +CONFIG_64BIT=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_HIBERNATION_HEADER=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=33 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_STACKWALK=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_THUNDER=y +CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_ARM64=y +CONFIG_ARM64_4K_PAGES=y +CONFIG_ARM64_CNP=y +CONFIG_ARM64_CRYPTO=y +CONFIG_ARM64_EPAN=y +CONFIG_ARM64_ERRATUM_819472=y +CONFIG_ARM64_ERRATUM_824069=y +CONFIG_ARM64_ERRATUM_826319=y +CONFIG_ARM64_ERRATUM_827319=y +CONFIG_ARM64_ERRATUM_843419=y +CONFIG_ARM64_HW_AFDBM=y +CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y +CONFIG_ARM64_MODULE_PLTS=y +CONFIG_ARM64_PAGE_SHIFT=12 +CONFIG_ARM64_PAN=y +CONFIG_ARM64_PA_BITS=48 +CONFIG_ARM64_PA_BITS_48=y +CONFIG_ARM64_PTR_AUTH=y +CONFIG_ARM64_PTR_AUTH_KERNEL=y +CONFIG_ARM64_SVE=y +CONFIG_ARM64_TAGGED_ADDR_ABI=y +CONFIG_ARM64_VA_BITS=48 +# CONFIG_ARM64_VA_BITS_39 is not set +CONFIG_ARM64_VA_BITS_48=y +CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_CPUIDLE=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_V2M=y +CONFIG_ARM_GIC_V3=y +CONFIG_ARM_GIC_V3_ITS=y +CONFIG_ARM_GIC_V3_ITS_PCI=y +# CONFIG_ARM_MHU_V2 is not set +CONFIG_ARM_PSCI_FW=y +CONFIG_ARM_SBSA_WATCHDOG=y +CONFIG_ATA=y +# CONFIG_ATA_SFF is not set +CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +CONFIG_BALLOON_COMPACTION=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +CONFIG_BLK_DEV_BSG_COMMON=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_MQ_VIRTIO=y +CONFIG_BLK_PM=y +CONFIG_CAVIUM_ERRATUM_22375=y +CONFIG_CAVIUM_ERRATUM_23144=y +CONFIG_CAVIUM_ERRATUM_23154=y +CONFIG_CAVIUM_ERRATUM_27456=y +CONFIG_CAVIUM_ERRATUM_30115=y +CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMA=y +CONFIG_CMA_ALIGNMENT=8 +CONFIG_CMA_AREAS=7 +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_SIZE_MBYTES=16 +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SYSFS is not set +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_CS2000_CP=y +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_CONFIGFS_FS=y +CONFIG_CONTIG_ALLOC=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_PM=y +CONFIG_CPU_RMAP=y +CONFIG_CRASH_CORE=y +CONFIG_CRASH_DUMP=y +CONFIG_CRC16=y +CONFIG_CRC7=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC_T10DIF=y +CONFIG_CRYPTO_AES_ARM64=y +CONFIG_CRYPTO_AES_ARM64_CE=y +CONFIG_CRYPTO_AES_ARM64_CE_BLK=y +CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_CRCT10DIF_ARM64_CE=y +CONFIG_CRYPTO_CRYPTD=y +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_DRBG_HMAC=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_ECHAINIV=y +CONFIG_CRYPTO_GHASH_ARM64_CE=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_SHA256=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA1_ARM64_CE=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA256_ARM64=y +CONFIG_CRYPTO_SHA2_ARM64_CE=y +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_SIMD=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DMADEVICES=y +CONFIG_DMA_CMA=y +CONFIG_DMA_DIRECT_REMAP=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_PERNUMA_CMA=y +CONFIG_DMA_REMAP=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DTC=y +CONFIG_DT_IDLE_STATES=y +CONFIG_EDAC=y +# CONFIG_EDAC_DEBUG is not set +# CONFIG_EDAC_DMC520 is not set +CONFIG_EDAC_LEGACY_SYSFS=y +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_FWNODE_MDIO=y +CONFIG_FW_CACHE=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_NUMA=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PHY=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_GLOB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_PCA953X=y +CONFIG_GPIO_PCA953X_IRQ=y +CONFIG_GPIO_THUNDERX=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_HIBERNATE_CALLBACKS=y +CONFIG_HIBERNATION=y +CONFIG_HIBERNATION_SNAPSHOT_DEV=y +CONFIG_HOTPLUG_CPU=y +CONFIG_HUGETLBFS=y +CONFIG_HUGETLB_PAGE=y +CONFIG_HWSPINLOCK=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_CAVIUM=y +CONFIG_HW_RANDOM_OPTEE=y +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y +CONFIG_I2C_SMBUS=y +CONFIG_I2C_THUNDERX=y +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_TIME_ACCOUNTING=y +CONFIG_IRQ_WORK=y +# CONFIG_ISDN is not set +CONFIG_JUMP_LABEL=y +CONFIG_KEXEC=y +CONFIG_KEXEC_CORE=y +CONFIG_KSM=y +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAILBOX=y +# CONFIG_MAILBOX_TEST is not set +CONFIG_MDIO_BUS=y +CONFIG_MDIO_CAVIUM=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MDIO_THUNDER=y +CONFIG_MEMFD_CREATE=y +CONFIG_MEMORY_BALLOON=y +CONFIG_MEMORY_ISOLATION=y +CONFIG_MEMTEST=y +CONFIG_MFD_SYSCON=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_CAVIUM_THUNDERX=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MSDOS_FS=y +# CONFIG_MTD is not set +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_SELFTESTS=y +CONFIG_NLS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NODES_SHIFT=2 +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NR_CPUS=64 +CONFIG_NUMA=y +CONFIG_NUMA_BALANCING=y +CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y +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_NUMA=y +CONFIG_OPTEE=y +CONFIG_OPTEE_SHM_NUM_PRIV_PAGES=1 +CONFIG_PADATA=y +CONFIG_PAGE_REPORTING=y +CONFIG_PARAVIRT=y +CONFIG_PARTITION_PERCPU=y +CONFIG_PCI=y +CONFIG_PCIEAER=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIE_PME=y +CONFIG_PCI_ATS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_ECAM=y +CONFIG_PCI_HOST_COMMON=y +CONFIG_PCI_HOST_GENERIC=y +CONFIG_PCI_HOST_THUNDER_ECAM=y +CONFIG_PCI_HOST_THUNDER_PEM=y +CONFIG_PCI_IOV=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PGTABLE_LEVELS=4 +CONFIG_PHYLIB=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PM=y +CONFIG_PM_CLK=y +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +CONFIG_PM_STD_PARTITION="" +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_POWER_RESET_XGENE=y +CONFIG_POWER_SUPPLY=y +CONFIG_PROC_VMCORE=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_RAS=y +CONFIG_RATIONAL=y +# CONFIG_RAVE_SP_CORE is not set +CONFIG_REBOOT_MODE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_RESET_CONTROLLER=y +CONFIG_RFS_ACCEL=y +CONFIG_RODATA_FULL_DEFAULT_ENABLED=y +CONFIG_RPS=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_DS1672=y +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SATA_AHCI=y +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_SATA_HOST=y +CONFIG_SCHED_INFO=y +CONFIG_SCHED_MC=y +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +# CONFIG_SCSI_LOWLEVEL is not set +# CONFIG_SCSI_PROC_FS is not set +CONFIG_SCSI_SAS_ATA=y +CONFIG_SCSI_SAS_ATTRS=y +CONFIG_SCSI_SAS_HOST_SMP=y +CONFIG_SCSI_SAS_LIBSAS=y +CONFIG_SECCOMP=y +CONFIG_SECCOMP_FILTER=y +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_8250_DWLIB=y +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_SERIAL_DEV_BUS=y +CONFIG_SERIAL_DEV_CTRL_TTYPORT=y +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_XILINX_PS_UART=y +CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y +CONFIG_SG_POOL=y +CONFIG_SMP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SPARSEMEM=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_THUNDERX=y +CONFIG_SRAM=y +CONFIG_SRCU=y +CONFIG_SWIOTLB=y +CONFIG_SWPHY=y +CONFIG_SYNC_FILE=y +CONFIG_SYSCON_REBOOT_MODE=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_TASKSTATS=y +CONFIG_TASK_DELAY_ACCT=y +CONFIG_TASK_IO_ACCOUNTING=y +CONFIG_TASK_XACCT=y +CONFIG_TEE=y +CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_THUNDER_NIC_BGX=y +CONFIG_THUNDER_NIC_PF=y +CONFIG_THUNDER_NIC_RGX=y +CONFIG_THUNDER_NIC_VF=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y +CONFIG_TRANSPARENT_HUGEPAGE=y +CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y +# CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set +CONFIG_TRANS_TABLE=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB=y +CONFIG_USB_COMMON=y +CONFIG_USB_PCI=y +CONFIG_USB_SUPPORT=y +# CONFIG_USB_UHCI_HCD is not set +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_USE_PERCPU_NUMA_NODE_ID=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_BALLOON=y +# CONFIG_VIRTIO_BLK is not set +CONFIG_VIRTIO_MMIO=y +# CONFIG_VIRTIO_NET is not set +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_PCI_LEGACY=y +CONFIG_VIRTIO_PCI_LIB=y +CONFIG_VMAP_STACK=y +CONFIG_WATCHDOG_CORE=y +CONFIG_XARRAY_MULTI=y +CONFIG_XPS=y +CONFIG_XXHASH=y +CONFIG_ZONE_DMA32=y diff --git a/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch new file mode 100644 index 00000000000..e3a008f4a65 --- /dev/null +++ b/target/linux/octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch @@ -0,0 +1,59 @@ +From d0ff7a1bcfe886cab1a237895b08ac51ecfe10e7 Mon Sep 17 00:00:00 2001 +From: Tim Harvey +Date: Wed, 10 Apr 2019 08:00:47 -0700 +Subject: [PATCH 04/12] PCI: add quirk for Gateworks PLX PEX860x switch with + GPIO PERST# + +Gateworks boards use PLX PEX860x switches where downstream ports +have their PERST# driven from the PEX GPIO. + +Signed-off-by: Tim Harvey +--- + drivers/pci/quirks.c | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -5831,3 +5832,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); ++ ++#ifdef CONFIG_PCI_HOST_THUNDER_PEM ++/* ++ * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High ++ * as they are used for slots1-7 PERST# ++ */ ++static void newport_pciesw_early_fixup(struct pci_dev *dev) ++{ ++ u32 dw; ++ ++ if (!of_machine_is_compatible("gw,newport")) ++ return; ++ ++ if (dev->devfn != 0) ++ return; ++ ++ dev_info(&dev->dev, "de-asserting PERST#\n"); ++ pci_read_config_dword(dev, 0x62c, &dw); ++ dw |= 0xaaa8; /* GPIO1-7 outputs */ ++ pci_write_config_dword(dev, 0x62c, dw); ++ ++ pci_read_config_dword(dev, 0x644, &dw); ++ dw |= 0xfe; /* GPIO1-7 output high */ ++ pci_write_config_dword(dev, 0x644, dw); ++ ++ msleep(100); ++} ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, newport_pciesw_early_fixup); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, newport_pciesw_early_fixup); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, newport_pciesw_early_fixup); ++#endif /* CONFIG_PCI_HOST_THUNDER_PEM */ diff --git a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c index 217c2585650..bd39ce7b1b8 100644 --- a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c +++ b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c @@ -2039,7 +2039,7 @@ static int sata_oxnas_softreset(struct ata_link *link, unsigned int *class, /* if link is occupied, -ENODEV too is an error */ if (rc && (rc != -ENODEV || sata_scr_valid(link))) { - ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc); + ata_link_err(link, "SRST failed (errno=%d)\n", rc); return rc; } diff --git a/target/linux/oxnas/patches-5.15/999-libata-hacks.patch b/target/linux/oxnas/patches-5.15/999-libata-hacks.patch index 3f0d5bb2611..f44f6b55ffe 100644 --- a/target/linux/oxnas/patches-5.15/999-libata-hacks.patch +++ b/target/linux/oxnas/patches-5.15/999-libata-hacks.patch @@ -36,7 +36,7 @@ --- a/include/linux/libata.h +++ b/include/linux/libata.h -@@ -917,6 +917,8 @@ struct ata_port_operations { +@@ -923,6 +923,8 @@ struct ata_port_operations { enum ata_completion_errors (*qc_prep)(struct ata_queued_cmd *qc); unsigned int (*qc_issue)(struct ata_queued_cmd *qc); bool (*qc_fill_rtf)(struct ata_queued_cmd *qc); @@ -45,7 +45,7 @@ /* * Configuration and exception handling -@@ -1007,6 +1009,9 @@ struct ata_port_operations { +@@ -1013,6 +1015,9 @@ struct ata_port_operations { void (*phy_reset)(struct ata_port *ap); void (*eng_timeout)(struct ata_port *ap); diff --git a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts index 119acd977c0..8d33f542dc1 100644 --- a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts +++ b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts @@ -90,18 +90,30 @@ }; &pcie0 { - mt76@0,0 { + wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; }; }; &pcie1 { - mt76@0,0 { + wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0000>; ieee80211-freq-limit = <2400000 2500000>; + + led { + led-sources = <0>; + led-active-low; + }; }; }; diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts b/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts index 6a5cb0d7193..cbd6a3ce07b 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts +++ b/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts @@ -26,11 +26,21 @@ leds { compatible = "gpio-leds"; - led_power: led-0 { + led_power: power { + label = "blue:power"; color = ; - function = LED_FUNCTION_POWER; + function = LED_FUNCTION_POWER; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; + + led_usb { + label = "blue:usb"; + color = ; + function = LED_FUNCTION_USB; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + trigger-sources = <&ehci_port2>; + linux,default-trigger = "usbport"; + }; }; keys { diff --git a/target/linux/ramips/dts/mt7621_cudy_m1800.dts b/target/linux/ramips/dts/mt7621_cudy_m1800.dts new file mode 100644 index 00000000000..314fdb206ca --- /dev/null +++ b/target/linux/ramips/dts/mt7621_cudy_m1800.dts @@ -0,0 +1,177 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "cudy,m1800", "mediatek,mt7621-soc"; + model = "Cudy M1800"; + + aliases { + led-boot = &led_internet_white; + led-failsafe = &led_internet_white; + led-running = &led_internet_white; + led-upgrade = &led_internet_white; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_internet_white: internet-white { + label = "white:internet"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + internet-red { + label = "red:internet"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_bdinfo_de00>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&gmac1 { + status = "okay"; + label = "lan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_bdinfo_de00>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,disable-radar-background; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + broken-flash-reset; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + + partition@1000000 { + label = "app"; + reg = <0x1000000 0xfd0000>; + read-only; + }; + + partition@1fd0000 { + label = "debug"; + reg = <0x1fd0000 0x10000>; + read-only; + }; + + partition@1fe0000 { + label = "backup"; + reg = <0x1fe0000 0x10000>; + read-only; + }; + + partition@1ff0000 { + label = "bdinfo"; + reg = <0x1ff0000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_de00: macaddr@de00 { + reg = <0xde00 0x6>; + }; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart3"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@3 { + status = "okay"; + label = "wan"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts new file mode 100644 index 00000000000..edc1c6544c0 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "dlink,dap-x1860-a1", "mediatek,mt7621-soc"; + model = "D-Link DAP-X1860 A1"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_power_orange; + led-failsafe = &led_power_red; + led-running = &led_power_orange; + led-upgrade = &led_power_red; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_red: power_red { + label = "red:power"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + led_power_orange: power_orange { + label = "orange:power"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + rssihigh { + label = "green:rssihigh"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + rssimedium { + label = "green:rssimedium"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + + rssilow_orange { + label = "orange:rssilow"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + }; + + rssilow_green { + label = "green:rssilow"; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + mediatek,nmbm; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + 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 = "kernel"; + reg = <0x180000 0x0800000>; + }; + + fwconcat0: partition@980000 { + label = "fwconcat0"; + reg = <0x980000 0x2c00000>; + }; + + partition@3580000 { + label = "manufacture"; + reg = <0x3580000 0x400000>; + read-only; + }; + + partition@3980000 { + label = "storage"; + reg = <0x3980000 0x680000>; + read-only; + }; + + fwconcat1: partition@4000000 { + label = "fwconcat1"; + reg = <0x4000000 0x3800000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + mediatek,disable-radar-background; + }; +}; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + gpio-controller; + #gpio-cells = <2>; + + ports { + port@0 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "uart2"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts new file mode 100644 index 00000000000..3381e598bd8 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + model = "TP-Link ER605 v2"; + compatible = "tplink,er605-v2", "mediatek,mt7621-soc"; + + chosen { + bootargs = "console=ttyS0,115200 noinitrd"; + }; + + aliases { + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + label-mac-device = &gmac0; + }; + + leds { + compatible = "gpio-leds"; + + led_usb: usb { + label = "green:usb"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + + led_power: power { + label = "green:power"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_system: system { + label = "green:system"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset button"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + reg_usb_vbus: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; +}; + +&gmac0 { + label = "dsa"; +}; + +&gmac1 { + status = "okay"; + label = "eth0"; + phy-handle = <ðphy0>; +}; + + +&switch0 { + ports { + port@0 { + status = "disabled"; + }; + + port@1 { + status = "okay"; + label = "eth1"; + }; + + port@2 { + status = "okay"; + label = "eth2"; + }; + + port@3 { + status = "okay"; + label = "eth3"; + }; + + port@4 { + status = "okay"; + label = "eth4"; + }; + }; +}; + +&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 = "u-boot-env"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "firmware"; + reg = <0x140000 0x7cc0000>; + }; + + partition@7e00000 { + label = "panic-ops"; + reg = <0x7e00000 0x200000>; + }; + }; +}; + + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&state_default { + gpio { + groups = "uart2", "uart3", "pcie", "jtag"; + function = "gpio"; + }; +}; + +&spi0 { + status = "disabled"; +}; + +&xhci { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_usb_vbus>; +}; + diff --git a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts index e148242387f..ff328bd858b 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts @@ -164,14 +164,10 @@ }; partition@1a0000 { + /* Combine kernel0 / kernel1 */ compatible = "denx,fit"; label = "firmware"; - reg = <0x1a0000 0x730000>; - }; - - partition@8d0000 { - label = "kernel1"; - reg = <0x8d0000 0x730000>; + reg = <0x1a0000 0xe60000>; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-06-32m.dts b/target/linux/ramips/dts/mt7621_unielec_u7621-06-32m.dts new file mode 100644 index 00000000000..dc9a9773a24 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-06-32m.dts @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Copyright(c) 2017 Kristian Evensen . + * Copyright(c) 2017 Piotr Dymacz . + * Copyright(c) 2018 Nishant Sharma . + * All rights reserved. + */ + +#include "mt7621_unielec_u7621-06.dtsi" + +/ { + compatible = "unielec,u7621-06-32m", "unielec,u7621-06", "mediatek,mt7621-soc"; + model = "UniElec U7621-06 (32M flash)"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts index 6aafe385ae6..4e30dfb6c9c 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts @@ -122,18 +122,30 @@ }; &pcie0 { - wifi0: mt76@0,0 { + wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; }; }; &pcie1 { - wifi1: mt76@0,0 { + wifi1: wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0000>; ieee80211-freq-limit = <2400000 2500000>; + + led { + led-sources = <0>; + led-active-low; + }; }; }; diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts new file mode 100644 index 00000000000..4281682503a --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts @@ -0,0 +1,223 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "keenetic,kn-1613", "mediatek,mt7628an-soc"; + model = "Keenetic KN-1613"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + internet { + label = "green:internet"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + + wifi2 { + label = "green:wifi2"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi5 { + label = "green:wifi5"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + fn { + label = "fn"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1ec0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "i2c", "gpio", "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&usbphy { + status = "disabled"; +}; + +&ehci { + status = "disabled"; +}; + +&ohci { + status = "disabled"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <32000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "rf-eeprom"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware1: partition@50000 { + label = "firmware_1"; + reg = <0x50000 0xf60000>; + }; + + partition@fb0000 { + label = "config_1"; + reg = <0xfb0000 0x40000>; + read-only; + }; + + partition@ff0000 { + label = "dump"; + reg = <0xff0000 0x10000>; + read-only; + }; + + partition@1000000 { + label = "u-state"; + reg = <0x1000000 0x30000>; + read-only; + }; + + partition@1030000 { + label = "u-config_res"; + reg = <0x1030000 0x10000>; + read-only; + }; + + partition@1040000 { + label = "rf-eeprom_res"; + reg = <0x1040000 0x10000>; + read-only; + }; + + firmware2: partition@1050000 { + label = "firmware_2"; + reg = <0x1050000 0xf60000>; + }; + + partition@1fb0000 { + label = "config_2"; + reg = <0x1fb0000 0x40000>; + read-only; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0400>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts b/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts index a7fc4765b76..7bb1d81abf9 100644 --- a/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts +++ b/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts @@ -116,7 +116,7 @@ spidev@0 { #address-cells = <1>; #size-cells = <1>; - compatible = "siliconlabs,si3210"; + compatible = "silabs,si3210"; reg = <0>; spi-max-frequency = <1000000>; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 75022f97083..2269833e480 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -7,7 +7,6 @@ include ./common-tp-link.mk DEFAULT_SOC := mt7621 -KERNEL_DTB += -d21 DEVICE_VARS += ELECOM_HWNAME LINKSYS_HWNAME ifdef CONFIG_LINUX_5_10 @@ -135,7 +134,7 @@ define Device/adslr_g7 IMAGE_SIZE := 16064k DEVICE_VENDOR := ADSLR DEVICE_MODEL := G7 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += adslr_g7 @@ -164,7 +163,7 @@ TARGET_DEVICES += alfa-network_quad-e4g define Device/ampedwireless_ally_common $(Device/dsa-migration) DEVICE_VENDOR := Amped Wireless - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-mt7615-firmware uboot-envtools IMAGE_SIZE := 32768k KERNEL_SIZE := 4096k BLOCKSIZE := 128k @@ -232,7 +231,7 @@ define Device/asus_rp-ac87 IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ check-size | append-metadata - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware rssileds + DEVICE_PACKAGES := kmod-mt7615-firmware rssileds endef TARGET_DEVICES += asus_rp-ac87 @@ -261,7 +260,7 @@ define Device/asus_rt-ac65p IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware uboot-envtools endef TARGET_DEVICES += asus_rt-ac65p @@ -278,7 +277,7 @@ define Device/asus_rt-ac85p IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware uboot-envtools endef TARGET_DEVICES += asus_rt-ac85p @@ -307,7 +306,8 @@ define Device/asus_rt-ax53u IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 uboot-envtools \ + kmod-usb-ledtrig-usbport endef TARGET_DEVICES += asus_rt-ax53u @@ -328,7 +328,7 @@ define Device/beeline_smartbox-flash IMAGES += factory.trx IMAGE/factory.trx := append-kernel | append-ubi | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware \ uboot-envtools uencrypt endef TARGET_DEVICES += beeline_smartbox-flash @@ -354,7 +354,7 @@ define Device/beeline_smartbox-turbo SERCOMM_SWVER := 1004 DEVICE_VENDOR := Beeline DEVICE_MODEL := SmartBox TURBO - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware \ kmod-usb3 uboot-envtools endef TARGET_DEVICES += beeline_smartbox-turbo @@ -367,7 +367,7 @@ define Device/belkin_rt1800 IMAGE_SIZE := 49152k DEVICE_VENDOR := Belkin DEVICE_MODEL := RT1800 - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 uboot-envtools UBINIZE_OPTS := -E 5 KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ @@ -401,7 +401,7 @@ define Device/buffalo_wsr-2533dhpl DEVICE_ALT0_VENDOR := Buffalo DEVICE_ALT0_MODEL := WSR-2533DHP IMAGE/sysupgrade.bin := trx | pad-rootfs | append-metadata - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += buffalo_wsr-2533dhpl @@ -425,6 +425,16 @@ define Device/bolt_arion endef TARGET_DEVICES += bolt_arion +define Device/cudy_m1800 + $(Device/dsa-migration) + DEVICE_VENDOR := Cudy + DEVICE_MODEL := M1800 + IMAGE_SIZE := 16064k + UIMAGE_NAME := R17 + DEVICE_PACKAGES := kmod-mt7915-firmware +endef +TARGET_DEVICES += cudy_m1800 + define Device/cudy_wr1300-v1 $(Device/dsa-migration) IMAGE_SIZE := 15872k @@ -454,7 +464,7 @@ define Device/cudy_wr2100 DEVICE_MODEL := WR2100 IMAGE_SIZE := 15872k UIMAGE_NAME := R11 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += cudy_wr2100 @@ -464,15 +474,36 @@ define Device/cudy_x6 DEVICE_VENDOR := Cudy DEVICE_MODEL := X6 UIMAGE_NAME := R13 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += cudy_x6 +define Device/dlink_dap-x1860-a1 + $(Device/dsa-migration) + IMAGE_SIZE := 53248k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DAP-X1860 + DEVICE_VARIANT := A1 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 8192k + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGES += factory.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size | elx-header 011b0060 8844A2D168B45A2D + DEVICE_PACKAGES := kmod-mt7915-firmware rssileds +endef +TARGET_DEVICES += dlink_dap-x1860-a1 + define Device/dlink_dir-8xx-a1 $(Device/dsa-migration) IMAGE_SIZE := 16000k DEVICE_VENDOR := D-Link - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware KERNEL := $$(KERNEL) | uimage-sgehdr IMAGES += factory.bin IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ @@ -484,7 +515,7 @@ define Device/dlink_dir-8xx-r1 $(Device/dsa-migration) IMAGE_SIZE := 16064k DEVICE_VENDOR := D-Link - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ check-size | append-metadata @@ -498,7 +529,7 @@ define Device/dlink_dir-xx60-a1 IMAGE_SIZE := 40960k UBINIZE_OPTS := -E 5 DEVICE_VENDOR := D-Link - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport KERNEL := $$(KERNEL) | uimage-sgehdr IMAGES += factory.bin @@ -651,7 +682,7 @@ define Device/edimax_ra21s IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 02020040 8844A2D168B45A2D - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += edimax_ra21s @@ -670,7 +701,7 @@ define Device/edimax_re23s IMAGE/factory.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN76 -f 0x70000 -S 0x01100000 | pad-rootfs | \ check-size - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += edimax_re23s @@ -683,7 +714,7 @@ define Device/edimax_rg21s IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 02020038 8844A2D168B45A2D - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += edimax_rg21s @@ -695,7 +726,7 @@ define Device/elecom_wrc-1167ghbk2-s IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elecom-wrc-gs-factory WRC-1167GHBK2-S 0.00 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += elecom_wrc-1167ghbk2-s @@ -707,7 +738,7 @@ define Device/elecom_wrc-gs IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elecom-wrc-gs-factory $$$$(ELECOM_HWNAME) 0.00 -N | \ append-string MT7621_ELECOM_$$$$(ELECOM_HWNAME) - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef define Device/elecom_wrc-1167gs2-b @@ -768,7 +799,7 @@ define Device/elecom_wrc-2533ghbk-i IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 0107002d 8844A2D168B45A2D | \ elecom-product-header WRC-2533GHBK-I - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += elecom_wrc-2533ghbk-i @@ -804,7 +835,7 @@ define Device/etisalat_s3 SERCOMM_SWVER := 4009 DEVICE_VENDOR := Etisalat DEVICE_MODEL := S3 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware \ kmod-usb3 uboot-envtools endef TARGET_DEVICES += etisalat_s3 @@ -834,7 +865,7 @@ define Device/glinet_gl-mt1300 IMAGE_SIZE := 32448k DEVICE_VENDOR := GL.iNet DEVICE_MODEL := GL-MT1300 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += glinet_gl-mt1300 @@ -871,7 +902,7 @@ define Device/h3c_tx180x KERNEL := $$(KERNEL_INITRAMFS) | h3c-blank-header IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := H3C - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools endef define Device/h3c_tx1800-plus @@ -908,7 +939,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) haier-sim_wr1800k-factory endif IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools endef define Device/haier_har-20s2u1 @@ -961,7 +992,7 @@ define Device/humax_e10 IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | \ edimax-header -s CSYS -m EA03 -f 0x70000 -S 0x01100000 | \ check-size | zip upg -P f013c26cf0a320fb71d03356dcb6bb63 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += humax_e10 @@ -1002,7 +1033,7 @@ define Device/iodata_wn-ax1167gr2 DEVICE_MODEL := WN-AX1167GR2 KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d42 -n '3.10(XBC.1)b10' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-ax1167gr2 @@ -1011,7 +1042,7 @@ define Device/iodata_wn-ax2033gr DEVICE_MODEL := WN-AX2033GR KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d42 -n '3.10(VST.1)C10' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-ax2033gr @@ -1020,7 +1051,7 @@ define Device/iodata_wn-dx1167r DEVICE_MODEL := WN-DX1167R KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d43 -n '3.10(XIK.1)b10' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-dx1167r @@ -1038,7 +1069,7 @@ define Device/iodata_wn-dx2033gr DEVICE_MODEL := WN-DX2033GR KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d42 -n '3.10(XID.0)b30' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-dx2033gr @@ -1061,7 +1092,7 @@ define Device/iodata_wnpr2600g IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 0104003a 8844A2D168B45A2D - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wnpr2600g @@ -1071,7 +1102,7 @@ define Device/iptime_a3002mesh UIMAGE_NAME := a3002me DEVICE_VENDOR := ipTIME DEVICE_MODEL := A3002MESH - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iptime_a3002mesh @@ -1099,7 +1130,7 @@ define Device/iptime_a3004t IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := ipTIME DEVICE_MODEL := A3004T - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += iptime_a3004t @@ -1109,7 +1140,7 @@ define Device/iptime_a6004ns-m UIMAGE_NAME := a6004nm DEVICE_VENDOR := ipTIME DEVICE_MODEL := A6004NS-M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport endef TARGET_DEVICES += iptime_a6004ns-m @@ -1120,7 +1151,7 @@ define Device/iptime_a6ns-m UIMAGE_NAME := a6nm DEVICE_VENDOR := ipTIME DEVICE_MODEL := A6ns-M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport endef TARGET_DEVICES += iptime_a6ns-m @@ -1131,7 +1162,7 @@ define Device/iptime_a8004t UIMAGE_NAME := a8004t DEVICE_VENDOR := ipTIME DEVICE_MODEL := A8004T - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += iptime_a8004t @@ -1151,7 +1182,7 @@ define Device/iptime_ax2004m check-size | iptime-crc32 ax2004m DEVICE_VENDOR := ipTIME DEVICE_MODEL := AX2004M - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 endef TARGET_DEVICES += iptime_ax2004m @@ -1178,7 +1209,7 @@ define Device/jcg_jhr-ac876m JCG_MAXSIZE := 16064k DEVICE_VENDOR := JCG DEVICE_MODEL := JHR-AC876M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport endef TARGET_DEVICES += jcg_jhr-ac876m @@ -1197,7 +1228,7 @@ define Device/jcg_q20 check-size DEVICE_VENDOR := JCG DEVICE_MODEL := Q20 - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools endef TARGET_DEVICES += jcg_q20 @@ -1210,7 +1241,7 @@ define Device/jcg_y2 JCG_MAXSIZE := 16064k DEVICE_VENDOR := JCG DEVICE_MODEL := Y2 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += jcg_y2 @@ -1276,7 +1307,7 @@ define Device/linksys_ea7xxx KERNEL_SIZE := 4096k IMAGE_SIZE := 36864k DEVICE_VENDOR := Linksys - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware \ uboot-envtools UBINIZE_OPTS := -E 5 IMAGES := sysupgrade.bin factory.bin @@ -1458,7 +1489,7 @@ define Device/mts_wg430223 IMAGES += factory.trx IMAGE/factory.trx := append-kernel | append-ubi | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware uboot-envtools uencrypt + DEVICE_PACKAGES := kmod-mt7615-firmware uboot-envtools uencrypt endef TARGET_DEVICES += mts_wg430223 @@ -1515,7 +1546,7 @@ define Device/netgear_r6260 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0052 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6260 @@ -1527,7 +1558,7 @@ define Device/netgear_r6350 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0052 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6350 @@ -1546,7 +1577,7 @@ define Device/netgear_r6700-v2 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6700-v2 @@ -1558,7 +1589,7 @@ define Device/netgear_r6800 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0062 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6800 @@ -1570,7 +1601,7 @@ define Device/netgear_r6850 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0052 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6850 @@ -1583,7 +1614,7 @@ define Device/netgear_r6900-v2 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6900-v2 @@ -1595,7 +1626,7 @@ define Device/netgear_r7200 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r7200 @@ -1607,7 +1638,7 @@ define Device/netgear_r7450 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r7450 @@ -1631,7 +1662,7 @@ define Device/netgear_wac124 SERCOMM_HWVER := A003 SERCOMM_SWVER := 0x0402 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_wac124 @@ -1639,7 +1670,7 @@ define Device/netgear_wax202 $(Device/dsa-migration) DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WAX202 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware NETGEAR_ENC_MODEL := WAX202 NETGEAR_ENC_REGION := US BLOCKSIZE := 128k @@ -1703,7 +1734,7 @@ define Device/oraybox_x3a IMAGE_SIZE := 15360k DEVICE_VENDOR := OrayBox DEVICE_MODEL := X3A - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += oraybox_x3a @@ -1715,7 +1746,7 @@ define Device/phicomm_k2p DEVICE_ALT0_VENDOR := Phicomm DEVICE_ALT0_MODEL := KE 2P SUPPORTED_DEVICES += k2p - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += phicomm_k2p @@ -1744,7 +1775,7 @@ define Device/raisecom_msg1500-x-00 DEVICE_VARIANT := X.00 DEVICE_ALT0_VENDOR := Nokia DEVICE_ALT0_MODEL := A-040W-Q - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport uboot-envtools endef TARGET_DEVICES += raisecom_msg1500-x-00 @@ -1768,7 +1799,7 @@ define Device/rostelecom_rt-sf-1 SERCOMM_SWVER := 1026 DEVICE_VENDOR := Rostelecom DEVICE_MODEL := RT-SF-1 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware \ kmod-usb3 uboot-envtools endef TARGET_DEVICES += rostelecom_rt-sf-1 @@ -1856,7 +1887,7 @@ define Device/tenbay_t-mb5eu-v01 DEVICE_VENDOR := Tenbay DEVICE_MODEL := T-MB5EU-V01 DEVICE_DTS_CONFIG := config@1 - DEVICE_PACKAGES += kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES += kmod-mt7915-firmware kmod-usb3 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGE_SIZE := 15808k SUPPORTED_DEVICES += mt7621-dm2-t-mb5eu-v01-nor @@ -1880,7 +1911,7 @@ define Device/totolink_a7000r UIMAGE_NAME := C8340R1C-9999 DEVICE_VENDOR := TOTOLINK DEVICE_MODEL := A7000R - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += totolink_a7000r @@ -1890,7 +1921,7 @@ define Device/totolink_x5000r UIMAGE_NAME := C8343R-9999 DEVICE_VENDOR := TOTOLINK DEVICE_MODEL := X5000R - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += totolink_x5000r @@ -1952,7 +1983,7 @@ define Device/tplink_eap615-wall-v1 $(Device/tplink-safeloader) DEVICE_MODEL := EAP615-Wall DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware TPLINK_BOARD_ID := EAP615-WALL-V1 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | pad-to 64k KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd @@ -1960,6 +1991,24 @@ define Device/tplink_eap615-wall-v1 endef TARGET_DEVICES += tplink_eap615-wall-v1 +define Device/tplink_er605-v2 + $(Device/dsa-migration) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := ER605 + DEVICE_VARIANT := v2 + DEVICE_PACKAGES := -wpad-basic-wolfssl kmod-usb3 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + KERNEL_IN_UBI := 1 + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGES += sysupgrade.tar + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE_SIZE := 127744k +endef +TARGET_DEVICES += tplink_er605-v2 + define Device/tplink_mr600-v2-eu $(Device/dsa-migration) $(Device/tplink-v2) @@ -1992,7 +2041,7 @@ define Device/tplink_re500-v1 $(Device/tplink-safeloader) DEVICE_MODEL := RE500 DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware TPLINK_BOARD_ID := RE500-V1 IMAGE_SIZE := 14208k endef @@ -2003,7 +2052,7 @@ define Device/tplink_re650-v1 $(Device/tplink-safeloader) DEVICE_MODEL := RE650 DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware TPLINK_BOARD_ID := RE650-V1 IMAGE_SIZE := 14208k endef @@ -2014,7 +2063,7 @@ define Device/tplink_re650-v2 $(Device/tplink-safeloader) DEVICE_MODEL := RE650 DEVICE_VARIANT := v2 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware TPLINK_BOARD_ID := RE650-V2 IMAGE_SIZE := 7994k endef @@ -2067,7 +2116,7 @@ define Device/ubnt_unifi-6-lite DEVICE_MODEL := UniFi 6 Lite DEVICE_DTS_CONFIG := config@1 DEVICE_DTS_LOADADDR := 0x87000000 - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7915e + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7915-firmware KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGE_SIZE := 15424k endef @@ -2080,7 +2129,7 @@ define Device/ubnt_unifi-flexhd DEVICE_DTS_CONFIG := config@2 DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-leds-ubnt-ledbar + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware kmod-leds-ubnt-ledbar IMAGE_SIZE := 15552k endef TARGET_DEVICES += ubnt_unifi-flexhd @@ -2089,7 +2138,7 @@ define Device/ubnt_unifi-nanohd $(Device/dsa-migration) DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := UniFi nanoHD - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware IMAGE_SIZE := 15552k endef TARGET_DEVICES += ubnt_unifi-nanohd @@ -2101,7 +2150,7 @@ define Device/ubnt_usw-flex DEVICE_DTS_CONFIG := config@1 DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - IMAGE_SIZE := 7360k + IMAGE_SIZE := 14720k endef TARGET_DEVICES += ubnt_usw-flex @@ -2128,6 +2177,18 @@ define Device/unielec_u7621-06-16m endef TARGET_DEVICES += unielec_u7621-06-16m +define Device/unielec_u7621-06-32m + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 32448k + DEVICE_VENDOR := UniElec + DEVICE_MODEL := U7621-06 + DEVICE_VARIANT := 32M + DEVICE_PACKAGES := kmod-ata-ahci kmod-sdhci-mt7620 kmod-usb3 -wpad-basic-wolfssl + SUPPORTED_DEVICES += unielec,u7621-06-32m +endef +TARGET_DEVICES += unielec_u7621-06-32m + define Device/unielec_u7621-06-64m $(Device/dsa-migration) $(Device/uimage-lzma-loader) @@ -2144,7 +2205,7 @@ define Device/wavlink_wl-wn531a6 $(Device/dsa-migration) DEVICE_VENDOR := Wavlink DEVICE_MODEL := WL-WN531A6 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 IMAGE_SIZE := 15040k endef TARGET_DEVICES += wavlink_wl-wn531a6 @@ -2154,7 +2215,7 @@ define Device/wavlink_wl-wn533a8 DEVICE_VENDOR := Wavlink DEVICE_MODEL := WL-WN533A8 KERNEL_INITRAMFS_SUFFIX := -WN533A8$$(KERNEL_SUFFIX) - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 IMAGE_SIZE := 15040k endef TARGET_DEVICES += wavlink_wl-wn533a8 @@ -2212,7 +2273,7 @@ define Device/winstars_ws-wn583a6 DEVICE_ALT0_VENDOR := Gemeita DEVICE_ALT0_MODEL := AC2100 KERNEL_INITRAMFS_SUFFIX := -WN583A6$$(KERNEL_SUFFIX) - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += winstars_ws-wn583a6 @@ -2267,7 +2328,7 @@ define Device/xiaomi_mi-router-3-pro IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport uboot-envtools SUPPORTED_DEVICES += xiaomi,mir3p endef @@ -2296,7 +2357,7 @@ define Device/xiaomi_mi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router AC2100 IMAGE_SIZE := 120320k - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += xiaomi_mi-router-ac2100 @@ -2313,7 +2374,7 @@ define Device/xiaomi_mi-router-cr660x 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 + DEVICE_PACKAGES += kmod-mt7915-firmware uboot-envtools endef define Device/xiaomi_mi-router-cr6606 @@ -2338,7 +2399,7 @@ define Device/xiaomi_redmi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Redmi Router AC2100 IMAGE_SIZE := 120320k - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += xiaomi_redmi-router-ac2100 @@ -2388,7 +2449,7 @@ define Device/yuncore_ax820 IMAGE_SIZE := 15808k DEVICE_VENDOR := YunCore DEVICE_MODEL := AX820 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += yuncore_ax820 @@ -2398,7 +2459,7 @@ define Device/yuncore_fap640 IMAGE_SIZE := 15808k DEVICE_VENDOR := YunCore DEVICE_MODEL := FAP640 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += yuncore_fap640 @@ -2408,7 +2469,7 @@ define Device/yuncore_fap690 IMAGE_SIZE := 15808k DEVICE_VENDOR := YunCore DEVICE_MODEL := FAP690 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += yuncore_fap690 @@ -2537,7 +2598,7 @@ define Device/zyxel_lte3301-plus UBINIZE_OPTS := -E 5 DEVICE_VENDOR := ZyXEL DEVICE_MODEL := LTE3301-PLUS - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ uboot-envtools kmod-usb-ledtrig-usbport kmod-usb-net-qmi-wwan \ kmod-usb-serial-option uqmi KERNEL := $(KERNEL_DTB) | uImage lzma | \ @@ -2571,7 +2632,7 @@ define Device/zyxel_nwa-ax PAGESIZE := 2048 KERNEL_SIZE := 8192k UBINIZE_OPTS := -E 5 - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools zyxel-bootconfig + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools zyxel-bootconfig KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGES += factory.bin ramboot-factory.bin IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | zyxel-nwa-fit diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index a77f1c97e1e..9db2d9e60c2 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -320,6 +320,18 @@ define Device/jotale_js76x8-32m endef TARGET_DEVICES += jotale_js76x8-32m +define Device/keenetic_kn-1613 + BLOCKSIZE := 64k + IMAGE_SIZE := 31488k + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1613 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ + check-size | zyimage -d 0x801613 -v "KN-1613" +endef +TARGET_DEVICES += keenetic_kn-1613 + define Device/kroks_kndrt31r16 IMAGE_SIZE := 16064k DEVICE_VENDOR := Kroks 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 6e8d35ea493..5fafb9b50a9 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 @@ -19,6 +19,11 @@ asus,rp-ac87) ucidef_set_led_rssi "rssimed-wlan1" "RSSIMED" "green:rssimed-wlan1" "wlan1" "40" "100" ucidef_set_led_rssi "rssihigh-wlan1" "RSSIHIGH" "green:rssihigh-wlan1" "wlan1" "70" "100" ;; +asus,rt-ax53u) + ucidef_set_led_usbport "usb" "USB" "blue:usb" "usb1-port2" + ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz" "mt76-phy0" "phy0tpt" + ucidef_set_led_wlan "wlan5g" "WiFi 5GHz" "mt76-phy1" "phy1tpt" + ;; asus,rt-n56u-b1) ucidef_set_led_netdev "lan" "LAN link" "blue:lan" "br-lan" ucidef_set_led_netdev "wan" "WAN link" "blue:wan" "wan" @@ -51,6 +56,13 @@ jcg,y2|\ xzwifi,creativebox-v1) ucidef_set_led_netdev "internet" "internet" "blue:internet" "wan" ;; +dlink,dap-x1860-a1) + ucidef_set_rssimon "wlan1" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "orange:rssilow" "wlan1" "1" "25" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "green:rssilow" "wlan1" "26" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:rssimedium" "wlan1" "51" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan1" "76" "100" + ;; dlink,dir-1960-a1|\ dlink,dir-2640-a1|\ dlink,dir-2660-a1) 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 b7121db64f0..9a8e385a31c 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 @@ -11,6 +11,7 @@ ramips_setup_interfaces() ampedwireless,ally-00x19k|\ asus,rp-ac56|\ asus,rp-ac87|\ + dlink,dap-x1860-a1|\ edimax,re23s|\ mikrotik,ltap-2hnd|\ mikrotik,routerboard-m11g|\ @@ -78,6 +79,11 @@ ramips_setup_interfaces() uci add_list firewall.@zone[1].network='eth_data' uci add_list firewall.@zone[1].network='eth_om' ;; + cudy,m1800|\ + yuncore,ax820|\ + zyxel,nt7101) + ucidef_set_interfaces_lan_wan "lan" "wan" + ;; gnubee,gb-pc1) ucidef_set_interface_lan "ethblack ethblue" ;; @@ -99,6 +105,9 @@ ramips_setup_interfaces() tplink,eap615-wall-v1) ucidef_set_interface_lan "lan0 lan1 lan2 lan3" ;; + tplink,er605-v2) + ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4" "eth0" + ;; tplink,tl-wpa8631p-v3) ucidef_set_interface_lan "lan1 lan2 lan3 plc0" ;; @@ -114,10 +123,6 @@ ramips_setup_interfaces() ubnt,usw-flex) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; - yuncore,ax820|\ - zyxel,nr7101) - ucidef_set_interfaces_lan_wan "lan" "wan" - ;; zyxel,wap6805) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" @@ -225,6 +230,12 @@ ramips_setup_macs() label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base") lan_mac=$label_mac ;; + tplink,er605-v2) + CI_UBIPART="firmware" + label_mac=$(mtd_get_mac_uci_config_ubi "tddp") + lan_mac=$label_mac + wan_mac=$(macaddr_add "$label_mac" 1) + ;; tplink,mr600-v2-eu) label_mac=$(cat "/sys/class/net/eth0/address") wwan_mac=$(macaddr_add $label_mac 1) 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 69ecaefd27c..161bd942db8 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 @@ -22,6 +22,13 @@ case "$board" in hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" macaddr_add $hw_mac_addr "$PHYNBR" > /sys${DEVPATH}/macaddress ;; + dlink,dap-x1860-a1) + hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" + [ "$PHYNBR" = "0" ] && \ + macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && \ + macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress + ;; dlink,dir-853-a3) [ "$PHYNBR" = "0" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary factory 0xe000)" \ 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 c665820169e..53ff9c016c3 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() { beeline,smartbox-giga|\ beeline,smartbox-turbo|\ belkin,rt1800|\ + dlink,dap-x1860-a1|\ dlink,dir-1960-a1|\ dlink,dir-2640-a1|\ dlink,dir-2660-a1|\ @@ -124,6 +125,12 @@ platform_do_upgrade() { iodata_mstc_upgrade_prepare "0x1fe75" nand_do_upgrade "$1" ;; + tplink,er605-v2) + echo "Upgrading tplink,er605-v2" + CI_UBIPART="firmware" + CI_KERNPART="kernel" + nand_do_upgrade "$1" + ;; ubnt,edgerouter-x|\ ubnt,edgerouter-x-sfp) platform_upgrade_ubnt_erx "$1" diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index 66628cea09f..d972762dadc 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -53,6 +53,9 @@ hiwifi,hc5661a|\ hiwifi,hc5761a) ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10" ;; +keenetic,kn-1613) + ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" + ;; mediatek,linkit-smart-7688) ucidef_set_led_wlan "wifi" "wifi" "orange:wifi" "phy0tpt" ;; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 26415e0fa65..7570999a4ef 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -118,6 +118,11 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "6@eth0" ;; + keenetic,kn-1613|\ + motorola,mwr03) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "0:wan" "6@eth0" + ;; kroks,kndrt31r19) ucidef_add_switch "switch0" \ "0:lan" "6@eth0" @@ -129,10 +134,6 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:wan" "6@eth0" ;; - motorola,mwr03) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "0:wan" "6@eth0" - ;; netgear,r6020|\ netgear,r6080|\ netgear,r6120|\ @@ -252,6 +253,9 @@ ramips_setup_macs() totolink,lr1200) wan_mac=$(mtd_get_mac_binary factory 0x2e) ;; + keenetic,kn-1613) + wan_mac=$(mtd_get_mac_binary rf-eeprom 0x28) + ;; linksys,e5400) wan_mac=$(mtd_get_mac_binary factory 0x22) ;; diff --git a/target/linux/ramips/mt76x8/config-5.10 b/target/linux/ramips/mt76x8/config-5.10 index b6687f8949c..514c6746157 100644 --- a/target/linux/ramips/mt76x8/config-5.10 +++ b/target/linux/ramips/mt76x8/config-5.10 @@ -117,6 +117,7 @@ CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_RALINK_ESW_RT3050=y diff --git a/target/linux/ramips/mt76x8/config-5.15 b/target/linux/ramips/mt76x8/config-5.15 index 0734bee16e0..5a82edfb102 100644 --- a/target/linux/ramips/mt76x8/config-5.15 +++ b/target/linux/ramips/mt76x8/config-5.15 @@ -118,6 +118,7 @@ CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_RALINK_ESW_RT3050=y diff --git a/target/linux/ramips/patches-5.15/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch b/target/linux/ramips/patches-5.15/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch index 5aa69421b93..1c8c7cd3d0c 100644 --- a/target/linux/ramips/patches-5.15/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch +++ b/target/linux/ramips/patches-5.15/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch @@ -211,7 +211,7 @@ Acked-by: Greg Kroah-Hartman - --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ /dev/null -@@ -1,600 +0,0 @@ +@@ -1,601 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * BRIEF MODULE DESCRIPTION @@ -307,8 +307,8 @@ Acked-by: Greg Kroah-Hartman - * reset lines are inverted. - */ -struct mt7621_pcie { -- void __iomem *base; - struct device *dev; +- void __iomem *base; - struct list_head ports; - bool resets_inverted; -}; @@ -343,7 +343,7 @@ Acked-by: Greg Kroah-Hartman - writel_relaxed(val, port->base + reg); -} - --static inline u32 mt7621_pci_get_cfgaddr(unsigned int bus, unsigned int slot, +-static inline u32 mt7621_pcie_get_cfgaddr(unsigned int bus, unsigned int slot, - unsigned int func, unsigned int where) -{ - return (((where & 0xF00) >> 8) << 24) | (bus << 16) | (slot << 11) | @@ -354,7 +354,7 @@ Acked-by: Greg Kroah-Hartman - unsigned int devfn, int where) -{ - struct mt7621_pcie *pcie = bus->sysdata; -- u32 address = mt7621_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), +- u32 address = mt7621_pcie_get_cfgaddr(bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn), where); - - writel_relaxed(address, pcie->base + RALINK_PCI_CONFIG_ADDR); @@ -362,7 +362,7 @@ Acked-by: Greg Kroah-Hartman - return pcie->base + RALINK_PCI_CONFIG_DATA + (where & 3); -} - --struct pci_ops mt7621_pci_ops = { +-struct pci_ops mt7621_pcie_ops = { - .map_bus = mt7621_pcie_map_bus, - .read = pci_generic_config_read, - .write = pci_generic_config_write, @@ -370,7 +370,7 @@ Acked-by: Greg Kroah-Hartman - -static u32 read_config(struct mt7621_pcie *pcie, unsigned int dev, u32 reg) -{ -- u32 address = mt7621_pci_get_cfgaddr(0, dev, 0, reg); +- u32 address = mt7621_pcie_get_cfgaddr(0, dev, 0, reg); - - pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR); - return pcie_read(pcie, RALINK_PCI_CONFIG_DATA); @@ -379,7 +379,7 @@ Acked-by: Greg Kroah-Hartman -static void write_config(struct mt7621_pcie *pcie, unsigned int dev, - u32 reg, u32 val) -{ -- u32 address = mt7621_pci_get_cfgaddr(0, dev, 0, reg); +- u32 address = mt7621_pcie_get_cfgaddr(0, dev, 0, reg); - - pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR); - pcie_write(pcie, val, RALINK_PCI_CONFIG_DATA); @@ -719,16 +719,17 @@ Acked-by: Greg Kroah-Hartman -{ - struct mt7621_pcie *pcie = pci_host_bridge_priv(host); - -- host->ops = &mt7621_pci_ops; +- host->ops = &mt7621_pcie_ops; - host->sysdata = pcie; - return pci_host_probe(host); -} - --static const struct soc_device_attribute mt7621_pci_quirks_match[] = { -- { .soc_id = "mt7621", .revision = "E2" } +-static const struct soc_device_attribute mt7621_pcie_quirks_match[] = { +- { .soc_id = "mt7621", .revision = "E2" }, +- { /* sentinel */ } -}; - --static int mt7621_pci_probe(struct platform_device *pdev) +-static int mt7621_pcie_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - const struct soc_device_attribute *attr; @@ -749,7 +750,7 @@ Acked-by: Greg Kroah-Hartman - platform_set_drvdata(pdev, pcie); - INIT_LIST_HEAD(&pcie->ports); - -- attr = soc_device_match(mt7621_pci_quirks_match); +- attr = soc_device_match(mt7621_pcie_quirks_match); - if (attr) - pcie->resets_inverted = true; - @@ -786,7 +787,7 @@ Acked-by: Greg Kroah-Hartman - return err; -} - --static int mt7621_pci_remove(struct platform_device *pdev) +-static int mt7621_pcie_remove(struct platform_device *pdev) -{ - struct mt7621_pcie *pcie = platform_get_drvdata(pdev); - struct mt7621_pcie_port *port; @@ -797,21 +798,21 @@ Acked-by: Greg Kroah-Hartman - return 0; -} - --static const struct of_device_id mt7621_pci_ids[] = { +-static const struct of_device_id mt7621_pcie_ids[] = { - { .compatible = "mediatek,mt7621-pci" }, - {}, -}; --MODULE_DEVICE_TABLE(of, mt7621_pci_ids); +-MODULE_DEVICE_TABLE(of, mt7621_pcie_ids); - --static struct platform_driver mt7621_pci_driver = { -- .probe = mt7621_pci_probe, -- .remove = mt7621_pci_remove, +-static struct platform_driver mt7621_pcie_driver = { +- .probe = mt7621_pcie_probe, +- .remove = mt7621_pcie_remove, - .driver = { - .name = "mt7621-pci", -- .of_match_table = of_match_ptr(mt7621_pci_ids), +- .of_match_table = of_match_ptr(mt7621_pcie_ids), - }, -}; --builtin_platform_driver(mt7621_pci_driver); +-builtin_platform_driver(mt7621_pcie_driver); --- /dev/null +++ b/drivers/pci/controller/pcie-mt7621.c @@ -0,0 +1,600 @@ diff --git a/target/linux/ramips/patches-5.15/103-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch b/target/linux/ramips/patches-5.15/103-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch index 3162ff81070..4b46b3e3f62 100644 --- a/target/linux/ramips/patches-5.15/103-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch +++ b/target/linux/ramips/patches-5.15/103-PCI-mt7621-Move-MIPS-setup-to-pcibios_root_bridge_pr.patch @@ -28,9 +28,9 @@ Acked-by: Thomas Bogendoerfer # arch/mips #include #include -@@ -24,6 +26,35 @@ - +@@ -25,6 +27,35 @@ static u32 detect_magic __initdata; + static struct ralink_soc_info *soc_info_ptr; +int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) +{ diff --git a/target/linux/ramips/patches-5.15/107-PCI-mt7621-Add-sentinel-to-quirks-table.patch b/target/linux/ramips/patches-5.15/107-PCI-mt7621-Add-sentinel-to-quirks-table.patch new file mode 100644 index 00000000000..c055f0096dd --- /dev/null +++ b/target/linux/ramips/patches-5.15/107-PCI-mt7621-Add-sentinel-to-quirks-table.patch @@ -0,0 +1,38 @@ +From 19098934f910b4d47cb30251dd39ffa57bef9523 Mon Sep 17 00:00:00 2001 +From: John Thomson +Date: Tue, 6 Dec 2022 06:46:45 +1000 +Subject: [PATCH] PCI: mt7621: Add sentinel to quirks table + +Current driver is missing a sentinel in the struct soc_device_attribute +array, which causes an oops when assessed by the +soc_device_match(mt7621_pcie_quirks_match) call. + +This was only exposed once the CONFIG_SOC_MT7621 mt7621 soc_dev_attr +was fixed to register the SOC as a device, in: + +commit 7c18b64bba3b ("mips: ralink: mt7621: do not use kzalloc too early") + +Fix it by adding the required sentinel. + +Link: https://lore.kernel.org/lkml/26ebbed1-0fe9-4af9-8466-65f841d0b382@app.fastmail.com +Link: https://lore.kernel.org/r/20221205204645.301301-1-git@johnthomson.fastmail.com.au +Fixes: b483b4e4d3f6 ("staging: mt7621-pci: add quirks for 'E2' revision using 'soc_device_attribute'") +Signed-off-by: John Thomson +Signed-off-by: Lorenzo Pieralisi +Acked-by: Sergio Paracuellos +--- + drivers/pci/controller/pcie-mt7621.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/pcie-mt7621.c ++++ b/drivers/pci/controller/pcie-mt7621.c +@@ -471,7 +471,8 @@ static int mt7621_pcie_register_host(str + } + + static const struct soc_device_attribute mt7621_pcie_quirks_match[] = { +- { .soc_id = "mt7621", .revision = "E2" } ++ { .soc_id = "mt7621", .revision = "E2" }, ++ { /* sentinel */ } + }; + + static int mt7621_pcie_probe(struct platform_device *pdev) diff --git a/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform b/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform index 9d45d2ddd5b..98f18cac1be 100644 --- a/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform +++ b/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform @@ -2,4 +2,4 @@ # Realtek RTL838x SoCs # cflags-$(CONFIG_RTL83XX) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ -load-$(CONFIG_RTL83XX) += 0xffffffff80000000 +load-$(CONFIG_RTL83XX) += 0xffffffff80100000 diff --git a/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform b/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform index 9d45d2ddd5b..98f18cac1be 100644 --- a/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform +++ b/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform @@ -2,4 +2,4 @@ # Realtek RTL838x SoCs # cflags-$(CONFIG_RTL83XX) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ -load-$(CONFIG_RTL83XX) += 0xffffffff80000000 +load-$(CONFIG_RTL83XX) += 0xffffffff80100000 diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c index c1d6b0c554b..504b29822a1 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c @@ -1335,7 +1335,7 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str /* Access IACL table (1) via register 0 */ struct table_reg *q = rtl_table_get(RTL8380_TBL_0, 1); u32 r[18]; - int err = 0; + int err; int block = idx / PIE_BLOCK_SIZE; u32 t_select = sw_r32(RTL838X_ACL_BLK_TMPLTE_CTRL(block)); @@ -1344,17 +1344,21 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str for (int i = 0; i < 18; i++) r[i] = 0; - if (!pr->valid) - goto err_out; + if (!pr->valid) { + err = -EINVAL; + pr_err("Rule invalid\n"); + goto errout; + } rtl838x_write_pie_fixed_fields(r, pr); pr_debug("%s: template %d\n", __func__, (t_select >> (pr->tid * 3)) & 0x7); rtl838x_write_pie_templated(r, pr, fixed_templates[(t_select >> (pr->tid * 3)) & 0x7]); - if (rtl838x_write_pie_action(r, pr)) { + err = rtl838x_write_pie_action(r, pr); + if (err) { pr_err("Rule actions too complex\n"); - goto err_out; + goto errout; } /* rtl838x_pie_rule_dump_raw(r); */ @@ -1362,7 +1366,7 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str for (int i = 0; i < 18; i++) sw_w32(r[i], rtl_table_data(q, i)); -err_out: +errout: rtl_table_write(q, idx); rtl_table_release(q); @@ -1798,7 +1802,7 @@ int rtl838x_smi_wait_op(int timeout) /* Reads a register in a page from the PHY */ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val) { - int err = -ETIMEDOUT; + int err; u32 v; u32 park_page; @@ -1812,8 +1816,9 @@ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val) mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32_mask(0xffff0000, port << 16, RTL838X_SMI_ACCESS_PHY_CTRL_2); @@ -1822,23 +1827,24 @@ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val) sw_w32(v | park_page, RTL838X_SMI_ACCESS_PHY_CTRL_1); sw_w32_mask(0, 1, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; *val = sw_r32(RTL838X_SMI_ACCESS_PHY_CTRL_2) & 0xffff; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); - return -ETIMEDOUT; + return err; } /* Write to a register in a page of the PHY */ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val) { - int err = -ETIMEDOUT; + int err; u32 v; u32 park_page; @@ -1847,8 +1853,9 @@ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val) return -ENOTSUPP; mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32(BIT(port), RTL838X_SMI_ACCESS_PHY_CTRL_0); mdelay(10); @@ -1860,27 +1867,29 @@ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val) sw_w32(v | park_page, RTL838X_SMI_ACCESS_PHY_CTRL_1); sw_w32_mask(0, 1, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); - return -ETIMEDOUT; + return err; } /* Read an mmd register of a PHY */ int rtl838x_read_mmd_phy(u32 port, u32 addr, u32 reg, u32 *val) { - int err = -ETIMEDOUT; + int err; u32 v; mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32(1 << port, RTL838X_SMI_ACCESS_PHY_CTRL_0); mdelay(10); @@ -1894,14 +1903,15 @@ int rtl838x_read_mmd_phy(u32 port, u32 addr, u32 reg, u32 *val) v = 1 << 1 | 0 << 2 | 1; sw_w32(v, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; *val = sw_r32(RTL838X_SMI_ACCESS_PHY_CTRL_2) & 0xffff; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); return err; @@ -1910,15 +1920,16 @@ timeout: /* Write to an mmd register of a PHY */ int rtl838x_write_mmd_phy(u32 port, u32 addr, u32 reg, u32 val) { - int err = -ETIMEDOUT; + int err; u32 v; pr_debug("MMD write: port %d, dev %d, reg %d, val %x\n", port, addr, reg, val); val &= 0xffff; mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32(1 << port, RTL838X_SMI_ACCESS_PHY_CTRL_0); mdelay(10); @@ -1931,12 +1942,13 @@ int rtl838x_write_mmd_phy(u32 port, u32 addr, u32 reg, u32 val) v = 1 << 1 | 1 << 2 | 1; sw_w32(v, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); return err; } diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index 66d7ee48954..3dfbcf67c16 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -3,8 +3,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -KERNEL_LOADADDR = 0x80000000 -KERNEL_ENTRY = 0x80000400 +KERNEL_LOADADDR = 0x80100000 +KERNEL_ENTRY = 0x80100400 DEVICE_VARS += \ CAMEO_BOARD_VERSION \ @@ -71,31 +71,17 @@ define Build/h3c-vfs mv $@.new $@ endef -define Build/relocate-kernel - rm -rf $@.relocate - $(CP) ../../generic/image/relocate $@.relocate - $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) LZMA_TEXT_START=0x82000000 \ - CROSS_COMPILE=$(TARGET_CROSS) - ( \ - dd if=$@.relocate/loader.bin bs=32 conv=sync && \ - perl -e '@s = stat("$@"); print pack("N", @s[7])' && \ - cat "$@" \ - ) > "$@.new" - mv "$@.new" "$@" - rm -rf $@.relocate -endef - define Device/Default PROFILES = Default KERNEL := \ kernel-bin | \ append-dtb | \ - gzip | \ + libdeflate-gzip | \ uImage gzip KERNEL_INITRAMFS := \ kernel-bin | \ append-dtb | \ - gzip | \ + libdeflate-gzip | \ uImage gzip DEVICE_DTS_DIR := ../dts-$(KERNEL_PATCHVER) DEVICE_DTS = $$(SOC)_$(1) diff --git a/target/linux/realtek/image/common.mk b/target/linux/realtek/image/common.mk index 702158978fa..214683f8e95 100644 --- a/target/linux/realtek/image/common.mk +++ b/target/linux/realtek/image/common.mk @@ -7,7 +7,7 @@ define Device/d-link_dgs-1210 KERNEL := \ kernel-bin | \ append-dtb | \ - gzip | \ + libdeflate-gzip | \ uImage gzip | \ dlink-cameo CAMEO_KERNEL_PART := 2 @@ -34,14 +34,12 @@ define Device/hpe_1920 KERNEL := \ kernel-bin | \ append-dtb | \ - relocate-kernel | \ 7z | \ h3c-image | \ h3c-vfs KERNEL_INITRAMFS := \ kernel-bin | \ append-dtb | \ - relocate-kernel | \ 7z | \ h3c-image IMAGE/sysupgrade.bin := \ @@ -60,7 +58,7 @@ define Device/zyxel_gs1900 KERNEL_INITRAMFS := \ kernel-bin | \ append-dtb | \ - gzip | \ + libdeflate-gzip | \ zyxel-vers | \ uImage gzip endef diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 8727bfa6fb1..b2e0cc91beb 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -70,7 +70,7 @@ define Device/engenius_ews2910p KERNEL_INITRAMFS := \ kernel-bin | \ append-dtb | \ - gzip | \ + libdeflate-gzip | \ uImage gzip -n 'IMG-0.00.00-c0.0.00' endef TARGET_DEVICES += engenius_ews2910p diff --git a/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch b/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch index 845441b4257..cf93d28f0a1 100644 --- a/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch +++ b/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch @@ -32,7 +32,7 @@ Signed-off-by: Guenter Roeck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -14816,6 +14816,13 @@ S: Maintained +@@ -14824,6 +14824,13 @@ S: Maintained F: include/sound/rt*.h F: sound/soc/codecs/rt* diff --git a/target/linux/realtek/rtl838x/config-5.10 b/target/linux/realtek/rtl838x/config-5.10 index d69345e3012..982dd6cb8f2 100644 --- a/target/linux/realtek/rtl838x/config-5.10 +++ b/target/linux/realtek/rtl838x/config-5.10 @@ -13,7 +13,7 @@ CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y +# CONFIG_COMMON_CLK_BOSTON is not set CONFIG_COMMON_CLK_REALTEK=y CONFIG_COMMON_CLK_RTL83XX=y CONFIG_COMPAT_32BIT_TIME=y diff --git a/target/linux/realtek/rtl838x/config-5.15 b/target/linux/realtek/rtl838x/config-5.15 index 41560725169..326fee1651d 100644 --- a/target/linux/realtek/rtl838x/config-5.15 +++ b/target/linux/realtek/rtl838x/config-5.15 @@ -10,7 +10,6 @@ CONFIG_BLK_DEV_RAM_SIZE=4096 # CONFIG_BMIPS_CPUFREQ is not set CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y CONFIG_COMMON_CLK_REALTEK=y CONFIG_COMMON_CLK_RTL83XX=y CONFIG_COMPAT_32BIT_TIME=y diff --git a/target/linux/realtek/rtl839x/config-5.10 b/target/linux/realtek/rtl839x/config-5.10 index 57eded97fcd..ad43e4523c4 100644 --- a/target/linux/realtek/rtl839x/config-5.10 +++ b/target/linux/realtek/rtl839x/config-5.10 @@ -10,7 +10,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y +# CONFIG_COMMON_CLK_BOSTON is not set CONFIG_COMMON_CLK_REALTEK=y CONFIG_COMMON_CLK_RTL83XX=y CONFIG_COMPAT_32BIT_TIME=y diff --git a/target/linux/realtek/rtl839x/config-5.15 b/target/linux/realtek/rtl839x/config-5.15 index 5dfbec7a68f..95f3a45bad0 100644 --- a/target/linux/realtek/rtl839x/config-5.15 +++ b/target/linux/realtek/rtl839x/config-5.15 @@ -9,7 +9,6 @@ CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y CONFIG_COMMON_CLK_REALTEK=y CONFIG_COMMON_CLK_RTL83XX=y CONFIG_COMPAT_32BIT_TIME=y diff --git a/target/linux/realtek/rtl930x/config-5.10 b/target/linux/realtek/rtl930x/config-5.10 index 3b2b327f08f..4c1a4ffaf25 100644 --- a/target/linux/realtek/rtl930x/config-5.10 +++ b/target/linux/realtek/rtl930x/config-5.10 @@ -13,7 +13,7 @@ CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y +# CONFIG_COMMON_CLK_BOSTON is not set # CONFIG_COMMON_CLK_REALTEK is not set CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 diff --git a/target/linux/realtek/rtl930x/config-5.15 b/target/linux/realtek/rtl930x/config-5.15 index 462cdae5417..7804bcc83df 100644 --- a/target/linux/realtek/rtl930x/config-5.15 +++ b/target/linux/realtek/rtl930x/config-5.15 @@ -12,7 +12,6 @@ CONFIG_BOARD_SCACHE=y CONFIG_CEVT_RTL9300=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y # CONFIG_COMMON_CLK_REALTEK is not set CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 diff --git a/target/linux/realtek/rtl931x/config-5.10 b/target/linux/realtek/rtl931x/config-5.10 index 567421c8d4a..fb7443a8658 100644 --- a/target/linux/realtek/rtl931x/config-5.10 +++ b/target/linux/realtek/rtl931x/config-5.10 @@ -11,7 +11,7 @@ CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y +# CONFIG_COMMON_CLK_BOSTON is not set # CONFIG_COMMON_CLK_REALTEK is not set CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 diff --git a/target/linux/realtek/rtl931x/config-5.15 b/target/linux/realtek/rtl931x/config-5.15 index e1798174b16..0c149bdf6d9 100644 --- a/target/linux/realtek/rtl931x/config-5.15 +++ b/target/linux/realtek/rtl931x/config-5.15 @@ -13,7 +13,6 @@ CONFIG_CLKSRC_MIPS_GIC=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_BOSTON=y # CONFIG_COMMON_CLK_REALTEK is not set CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 diff --git a/target/linux/rockchip/armv8/config-5.10 b/target/linux/rockchip/armv8/config-5.10 index 25e32145d37..1488da23a8b 100644 --- a/target/linux/rockchip/armv8/config-5.10 +++ b/target/linux/rockchip/armv8/config-5.10 @@ -377,6 +377,8 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=256 CONFIG_NVMEM=y +CONFIG_NVMEM_ROCKCHIP_EFUSE=y +# CONFIG_NVMEM_ROCKCHIP_OTP is not set CONFIG_NVMEM_SYSFS=y CONFIG_NVME_CORE=y # CONFIG_NVME_HWMON is not set @@ -492,12 +494,10 @@ CONFIG_REGULATOR_RK808=y CONFIG_RELOCATABLE=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_ROCKCHIP_GRF=y CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_ROCKCHIP_IOMMU=y CONFIG_ROCKCHIP_MBOX=y -# CONFIG_ROCKCHIP_OTP is not set CONFIG_ROCKCHIP_PHY=y CONFIG_ROCKCHIP_PM_DOMAINS=y # CONFIG_ROCKCHIP_SARADC is not set diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15 index 39802ee728f..5f94e0c9f22 100644 --- a/target/linux/rockchip/armv8/config-5.15 +++ b/target/linux/rockchip/armv8/config-5.15 @@ -377,6 +377,8 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=256 CONFIG_NVMEM=y +CONFIG_NVMEM_ROCKCHIP_EFUSE=y +# CONFIG_NVMEM_ROCKCHIP_OTP is not set CONFIG_NVMEM_SYSFS=y CONFIG_NVME_CORE=y # CONFIG_NVME_HWMON is not set @@ -493,12 +495,10 @@ CONFIG_REGULATOR_RK808=y CONFIG_RELOCATABLE=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_ROCKCHIP_GRF=y CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_ROCKCHIP_IOMMU=y CONFIG_ROCKCHIP_MBOX=y -# CONFIG_ROCKCHIP_OTP is not set CONFIG_ROCKCHIP_PHY=y CONFIG_ROCKCHIP_PM_DOMAINS=y # CONFIG_ROCKCHIP_SARADC is not set diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile index 770cbf99dd0..b3ad1db8d50 100644 --- a/target/linux/zynq/Makefile +++ b/target/linux/zynq/Makefile @@ -19,6 +19,7 @@ define Target/Description endef KERNEL_PATCHVER:=5.10 +KERNEL_TESTING_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/zynq/config-5.15 b/target/linux/zynq/config-5.15 new file mode 100644 index 00000000000..da39a6749e1 --- /dev/null +++ b/target/linux/zynq/config-5.15 @@ -0,0 +1,551 @@ +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_ALTERA_FREEZE_BRIDGE is not set +# CONFIG_ALTERA_PR_IP_CORE is not set +CONFIG_ARCH_32BIT_OFF_T=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_V6_V7=y +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_NR_GPIO=1024 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_VEXPRESS=y +CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y +# CONFIG_ARCH_VEXPRESS_SPC is not set +CONFIG_ARCH_ZYNQ=y +CONFIG_ARM=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARM_ERRATA_643719=y +CONFIG_ARM_ERRATA_720789=y +CONFIG_ARM_ERRATA_754322=y +CONFIG_ARM_ERRATA_754327=y +CONFIG_ARM_ERRATA_764369=y +CONFIG_ARM_ERRATA_775420=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GLOBAL_TIMER=y +CONFIG_ARM_GT_INITIAL_PRESCALER_VAL=2 +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_ARM_HEAVY_MB=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_PL172_MPMC is not set +# CONFIG_ARM_SMMU is not set +CONFIG_ARM_THUMB=y +CONFIG_ARM_TIMER_SP804=y +CONFIG_ARM_UNWIND=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_ARM_ZYNQ_CPUIDLE=y +CONFIG_ATAGS=y +CONFIG_AUTO_ZRELADDR=y +# CONFIG_AXI_DMAC is not set +CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_PM=y +CONFIG_BOUNCE=y +CONFIG_CACHE_L2X0=y +CONFIG_CADENCE_TTC_TIMER=y +CONFIG_CADENCE_WATCHDOG=y +CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLKSRC_VERSATILE=y +CONFIG_CLK_SP810=y +CONFIG_CLK_VEXPRESS_OSC=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMA=y +CONFIG_CMA_ALIGNMENT=8 +CONFIG_CMA_AREAS=7 +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_SIZE_MBYTES=16 +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SYSFS is not set +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_SI570=y +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONNECTOR=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CONTIG_ALLOC=y +CONFIG_COREDUMP=y +# CONFIG_CPUFREQ_DT is not set +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_PERFORMANCE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ATTR_SET=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +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_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_CROSS_MEMORY_ATTACH=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_HW=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_RNG2=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_DMADEVICES=y +CONFIG_DMA_CMA=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_OPS=y +CONFIG_DMA_REMAP=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DRM=y +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_FBDEV_EMULATION=y +CONFIG_DRM_FBDEV_OVERALLOC=100 +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_PANEL=y +CONFIG_DRM_PANEL_BRIDGE=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_DTC=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_E1000E=y +CONFIG_EDAC=y +CONFIG_EDAC_ATOMIC_SCRUB=y +# CONFIG_EDAC_DEBUG is not set +CONFIG_EDAC_LEGACY_SYSFS=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC_SYNOPSYS is not set +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_AT25=y +CONFIG_ELF_CORE=y +CONFIG_EXT4_FS=y +CONFIG_EXTCON=y +CONFIG_F2FS_FS=y +CONFIG_FB=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_DEFERRED_IO=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_XILINX is not set +CONFIG_FHANDLE=y +CONFIG_FIXED_PHY=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FPGA=y +CONFIG_FPGA_BRIDGE=y +# CONFIG_FPGA_DFL is not set +# CONFIG_FPGA_MGR_ALTERA_CVP is not set +# CONFIG_FPGA_MGR_ALTERA_PS_SPI is not set +# CONFIG_FPGA_MGR_ICE40_SPI is not set +# CONFIG_FPGA_MGR_MACHXO2_SPI is not set +# CONFIG_FPGA_MGR_XILINX_SPI is not set +CONFIG_FPGA_MGR_ZYNQ_FPGA=y +CONFIG_FPGA_REGION=y +CONFIG_FREEZER=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FWNODE_MDIO=y +CONFIG_FW_CACHE=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_GENERIC_PCI_IOMAP=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_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_VDSO_32=y +CONFIG_GLOB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_GPIO_ZYNQ=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_HAVE_SMP=y +CONFIG_HDMI=y +CONFIG_HID=y +CONFIG_HID_GENERIC=y +CONFIG_HID_MICROSOFT=y +CONFIG_HIGHMEM=y +CONFIG_HIGHPTE=y +CONFIG_HOTPLUG_CPU=y +CONFIG_HWMON=y +CONFIG_HW_CONSOLE=y +CONFIG_HZ_FIXED=0 +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CADENCE=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_ICST=y +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_TRIGGERED_BUFFER=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_KEYBOARD=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_SPARSEKMAP=y +# 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_IP_PNP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_RARP=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +# CONFIG_ISDN is not set +CONFIG_JBD2=y +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +CONFIG_KCMP=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_XZ is not set +CONFIG_KEYBOARD_ATKBD=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +CONFIG_KMAP_LOCAL=y +CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CAMERA=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_MACB=y +# CONFIG_MACB_PCI is not set +CONFIG_MACB_USE_HWSTAMP=y +CONFIG_MARVELL_PHY=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +# CONFIG_MDIO_GPIO is not set +CONFIG_MEMFD_CREATE=y +CONFIG_MEMORY=y +CONFIG_MEMORY_ISOLATION=y +CONFIG_MFD_CORE=y +CONFIG_MFD_SYSCON=y +CONFIG_MFD_VEXPRESS_SYSREG=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_CQHCI=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODULE_STRIPPED is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_BYD=y +CONFIG_MOUSE_PS2_CYPRESS=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +CONFIG_MOUSE_PS2_FOCALTECH=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SMBUS=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_MTD_SPLIT_FIRMWARE=y +# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set +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_NET_SELFTESTS=y +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_VIA is not set +CONFIG_NLS=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NOP_USB_XCEIV=y +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NO_IOPORT_MAP=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_FPGA_REGION is not set +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_PADATA=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_PCI=y +CONFIG_PCIE_XILINX=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_PHYLINK=y +CONFIG_PINCTRL=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PINCTRL_ZYNQ=y +CONFIG_PL310_ERRATA_588369=y +CONFIG_PL310_ERRATA_727915=y +CONFIG_PL310_ERRATA_753970=y +CONFIG_PL310_ERRATA_769419=y +CONFIG_PL330_DMA=y +# CONFIG_PL353_SMC is not set +CONFIG_PLAT_VERSATILE=y +CONFIG_PM=y +CONFIG_PMBUS=y +CONFIG_PM_CLK=y +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_VEXPRESS=y +CONFIG_POWER_SUPPLY=y +CONFIG_PPS=y +CONFIG_PROC_EVENTS=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_R8169=y +CONFIG_RAS=y +CONFIG_RATIONAL=y +CONFIG_REALTEK_PHY=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VEXPRESS is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_ZYNQ=y +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_PCF8563=y +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RTC_MC146818_LIB=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +# CONFIG_SCHED_CORE is not set +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y +CONFIG_SENSORS_PMBUS=y +CONFIG_SENSORS_UCD9000=y +CONFIG_SENSORS_UCD9200=y +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_XILINX_PS_UART=y +CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y +CONFIG_SERIO=y +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_SERPORT=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SOC_BUS=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_CADENCE=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +CONFIG_SPI_XILINX=y +CONFIG_SPI_ZYNQ_QSPI=y +CONFIG_SRAM=y +CONFIG_SRAM_EXEC=y +CONFIG_SRCU=y +# CONFIG_STRIP_ASM_SYMS is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_SWPHY=y +CONFIG_SWP_EMULATE=y +CONFIG_SYNC_FILE=y +CONFIG_SYSFS_SYSCALL=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +# CONFIG_TEXTSEARCH is not set +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 +CONFIG_TIMER_PROBE=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_UIO=y +# CONFIG_UIO_AEC is not set +# CONFIG_UIO_CIF is not set +# CONFIG_UIO_DMEM_GENIRQ is not set +# CONFIG_UIO_MF624 is not set +# CONFIG_UIO_NETX is not set +# CONFIG_UIO_PCI_GENERIC is not set +CONFIG_UIO_PDRV_GENIRQ=y +# CONFIG_UIO_PRUSS is not set +# CONFIG_UIO_SERCOS3 is not set +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_UNWINDER_ARM=y +CONFIG_USB=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_COMMON=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +# CONFIG_USB_EHCI_TT_NEWSCHED is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_XILINX=y +CONFIG_USB_HID=y +CONFIG_USB_NET_DRIVERS=y +CONFIG_USB_OTG=y +CONFIG_USB_OTG_FSM=y +CONFIG_USB_PHY=y +CONFIG_USB_ROLE_SWITCH=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_ULPI=y +CONFIG_USB_ULPI_BUS=y +CONFIG_USB_ULPI_VIEWPORT=y +CONFIG_USE_OF=y +CONFIG_VEXPRESS_CONFIG=y +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +CONFIG_VITESSE_PHY=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_WATCHDOG_CORE=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_XILINX_EMACLITE=y +# CONFIG_XILINX_INTC is not set +# CONFIG_XILINX_PR_DECOUPLER is not set +CONFIG_XILINX_WATCHDOG=y +CONFIG_XILINX_XADC=y +CONFIG_XPS=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_X86=y +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index 0bc8bbd0a3f..7fe797a5aa4 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -2,7 +2,7 @@ choice prompt "Binutils Version" if TOOLCHAINOPTS - default BINUTILS_USE_VERSION_2_37 + default BINUTILS_USE_VERSION_2_39 help Select the version of binutils you wish to use. diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version index a79b72e17fe..eac97877fce 100644 --- a/toolchain/binutils/Config.version +++ b/toolchain/binutils/Config.version @@ -1,12 +1,12 @@ config BINUTILS_VERSION_2_37 - default y if !TOOLCHAINOPTS bool config BINUTILS_VERSION_2_38 bool config BINUTILS_VERSION_2_39 + default y if !TOOLCHAINOPTS bool config BINUTILS_VERSION diff --git a/toolchain/binutils/patches/2.39/005-ld-fix-NEWS-typos.patch b/toolchain/binutils/patches/2.39/005-ld-fix-NEWS-typos.patch new file mode 100644 index 00000000000..39c61d93190 --- /dev/null +++ b/toolchain/binutils/patches/2.39/005-ld-fix-NEWS-typos.patch @@ -0,0 +1,27 @@ +From 9284b63ea39cecbfc1522d9e143ecb7727d77eb5 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Mon, 8 Aug 2022 13:22:26 +0200 +Subject: [PATCH 005/160] ld: fix NEWS typos + +ld/ChangeLog: + + * NEWS: Fix 2 typos. +--- + ld/NEWS | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/ld/NEWS ++++ b/ld/NEWS +@@ -27,10 +27,10 @@ Changes in 2.39: + --enable-warn-rwx-segments=no + will make --no-warn-rwx-segments enabled by default. + +- --enable-defaul-execstack=no ++ --enable-default-execstack=no + will stop the creation of an executable stack simply because an input file + is missing a .note.GNU-stack section, even on architectures where this +- ehaviour is the default. ++ behaviour is the default. + + * TYPE= is now supported in an output section description to set the + section type value. diff --git a/toolchain/binutils/patches/2.39/008-gas-Dwarf-properly-skip-zero-size-functions.patch b/toolchain/binutils/patches/2.39/008-gas-Dwarf-properly-skip-zero-size-functions.patch new file mode 100644 index 00000000000..055da841295 --- /dev/null +++ b/toolchain/binutils/patches/2.39/008-gas-Dwarf-properly-skip-zero-size-functions.patch @@ -0,0 +1,90 @@ +From e8cf73215187b0c08679d726a5cc7c019fa3ea2e Mon Sep 17 00:00:00 2001 +From: Jan Beulich +Date: Wed, 10 Aug 2022 10:34:22 +0200 +Subject: [PATCH 008/160] gas/Dwarf: properly skip zero-size functions + +PR gas/29451 + +While out_debug_abbrev() properly skips such functions, out_debug_info() +mistakenly didn't. It needs to calculate the high_pc expression ahead of +time, in order to skip emitting any data for the function if the value +is zero. + +The one case which would still leave a zero-size entry is when +symbol_get_obj(symp)->size ends up evaluating to zero. I hope we can +expect that to not be the case, otherwise we'd need to have a way to +post-process .debug_info contents between resolving expressions and +actually writing the data out to the file. Even then it wouldn't be +entirely obvious in which way to alter the data. + +(cherry picked from commit d7abcbcea5ddd40a3bf28758b62f35933c59f996) +--- + gas/dwarf2dbg.c | 39 ++++++++++++++++++++------------------- + 1 file changed, 20 insertions(+), 19 deletions(-) + +--- a/gas/dwarf2dbg.c ++++ b/gas/dwarf2dbg.c +@@ -2882,6 +2882,7 @@ out_debug_info (segT info_seg, segT abbr + { + const char *name; + size_t len; ++ expressionS size = { .X_op = O_constant }; + + /* Skip warning constructs (see above). */ + if (symbol_get_bfdsym (symp)->flags & BSF_WARNING) +@@ -2895,6 +2896,18 @@ out_debug_info (segT info_seg, segT abbr + if (!S_IS_DEFINED (symp) || !S_IS_FUNCTION (symp)) + continue; + ++#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */ ++ size.X_add_number = S_GET_SIZE (symp); ++ if (size.X_add_number == 0 && IS_ELF ++ && symbol_get_obj (symp)->size != NULL) ++ { ++ size.X_op = O_add; ++ size.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size); ++ } ++#endif ++ if (size.X_op == O_constant && size.X_add_number == 0) ++ continue; ++ + subseg_set (str_seg, 0); + name_sym = symbol_temp_new_now_octets (); + name = S_GET_NAME (symp); +@@ -2920,29 +2933,17 @@ out_debug_info (segT info_seg, segT abbr + emit_expr (&exp, sizeof_address); + + /* DW_AT_high_pc */ +- exp.X_op = O_constant; +-#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */ +- exp.X_add_number = S_GET_SIZE (symp); +- if (exp.X_add_number == 0 && IS_ELF +- && symbol_get_obj (symp)->size != NULL) +- { +- exp.X_op = O_add; +- exp.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size); +- } +-#else +- exp.X_add_number = 0; +-#endif + if (DWARF2_VERSION < 4) + { +- if (exp.X_op == O_constant) +- exp.X_op = O_symbol; +- exp.X_add_symbol = symp; +- emit_expr (&exp, sizeof_address); ++ if (size.X_op == O_constant) ++ size.X_op = O_symbol; ++ size.X_add_symbol = symp; ++ emit_expr (&size, sizeof_address); + } +- else if (exp.X_op == O_constant) +- out_uleb128 (exp.X_add_number); ++ else if (size.X_op == O_constant) ++ out_uleb128 (size.X_add_number); + else +- emit_leb128_expr (symbol_get_value_expression (exp.X_op_symbol), 0); ++ emit_leb128_expr (symbol_get_value_expression (size.X_op_symbol), 0); + } + + /* End of children. */ diff --git a/toolchain/binutils/patches/2.39/009-PR29462-internal-error-in-relocate-at-powerpc.cc-107.patch b/toolchain/binutils/patches/2.39/009-PR29462-internal-error-in-relocate-at-powerpc.cc-107.patch new file mode 100644 index 00000000000..e325d3bcb09 --- /dev/null +++ b/toolchain/binutils/patches/2.39/009-PR29462-internal-error-in-relocate-at-powerpc.cc-107.patch @@ -0,0 +1,270 @@ +From e3b5d935247084dca057dea72be61b063fe2357a Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Wed, 10 Aug 2022 10:38:52 +0930 +Subject: [PATCH 009/160] PR29462, internal error in relocate, at + powerpc.cc:10796 + +Prior to the inline plt call support (commit 08be322439), the only +local syms with plt entries were local ifunc symbols. There shouldn't +be stubs for other local symbols so don't look for them. The patch +also fixes minor bugs in get_reference_flags; Many relocs are valid +only for ppc64 and a couple only for ppc32. + + PR 29462 + * powerpc.cc (Target_powerpc::Relocate::relocate): Rename + use_plt_offset to pltcal_to_direct, invert logic. For relocs + not used with inline plt sequences against local symbols, only + look for stubs when the symbol is an ifunc. + (Target_powerpc::Scan::get_reference_flags): Correct reloc + handling for relocs not valid for both 32-bit and 64-bit. + +(cherry picked from commit 6158b25f77db11712b84e6a4609898f2615ac749) +--- + gold/powerpc.cc | 129 ++++++++++++++++++++++++++++-------------------- + 1 file changed, 75 insertions(+), 54 deletions(-) + +--- a/gold/powerpc.cc ++++ b/gold/powerpc.cc +@@ -7675,22 +7675,18 @@ Target_powerpc::Scan:: + + switch (r_type) + { ++ case elfcpp::R_PPC64_TOC: ++ if (size != 64) ++ break; ++ // Fall through. + case elfcpp::R_POWERPC_NONE: + case elfcpp::R_POWERPC_GNU_VTINHERIT: + case elfcpp::R_POWERPC_GNU_VTENTRY: +- case elfcpp::R_PPC64_TOC: + // No symbol reference. + break; + + case elfcpp::R_PPC64_ADDR64: + case elfcpp::R_PPC64_UADDR64: +- case elfcpp::R_POWERPC_ADDR32: +- case elfcpp::R_POWERPC_UADDR32: +- case elfcpp::R_POWERPC_ADDR16: +- case elfcpp::R_POWERPC_UADDR16: +- case elfcpp::R_POWERPC_ADDR16_LO: +- case elfcpp::R_POWERPC_ADDR16_HI: +- case elfcpp::R_POWERPC_ADDR16_HA: + case elfcpp::R_PPC64_ADDR16_HIGHER34: + case elfcpp::R_PPC64_ADDR16_HIGHERA34: + case elfcpp::R_PPC64_ADDR16_HIGHEST34: +@@ -7700,6 +7696,16 @@ Target_powerpc::Scan:: + case elfcpp::R_PPC64_D34_HI30: + case elfcpp::R_PPC64_D34_HA30: + case elfcpp::R_PPC64_D28: ++ if (size != 64) ++ break; ++ // Fall through. ++ case elfcpp::R_POWERPC_ADDR32: ++ case elfcpp::R_POWERPC_UADDR32: ++ case elfcpp::R_POWERPC_ADDR16: ++ case elfcpp::R_POWERPC_UADDR16: ++ case elfcpp::R_POWERPC_ADDR16_LO: ++ case elfcpp::R_POWERPC_ADDR16_HI: ++ case elfcpp::R_POWERPC_ADDR16_HA: + ref = Symbol::ABSOLUTE_REF; + break; + +@@ -7710,13 +7716,14 @@ Target_powerpc::Scan:: + ref = Symbol::FUNCTION_CALL | Symbol::ABSOLUTE_REF; + break; + +- case elfcpp::R_PPC64_REL64: +- case elfcpp::R_POWERPC_REL32: + case elfcpp::R_PPC_LOCAL24PC: +- case elfcpp::R_POWERPC_REL16: +- case elfcpp::R_POWERPC_REL16_LO: +- case elfcpp::R_POWERPC_REL16_HI: +- case elfcpp::R_POWERPC_REL16_HA: ++ if (size != 32) ++ break; ++ // Fall through. ++ ref = Symbol::RELATIVE_REF; ++ break; ++ ++ case elfcpp::R_PPC64_REL64: + case elfcpp::R_PPC64_REL16_HIGH: + case elfcpp::R_PPC64_REL16_HIGHA: + case elfcpp::R_PPC64_REL16_HIGHER: +@@ -7729,36 +7736,45 @@ Target_powerpc::Scan:: + case elfcpp::R_PPC64_REL16_HIGHEST34: + case elfcpp::R_PPC64_REL16_HIGHESTA34: + case elfcpp::R_PPC64_PCREL28: ++ if (size != 64) ++ break; ++ // Fall through. ++ case elfcpp::R_POWERPC_REL32: ++ case elfcpp::R_POWERPC_REL16: ++ case elfcpp::R_POWERPC_REL16_LO: ++ case elfcpp::R_POWERPC_REL16_HI: ++ case elfcpp::R_POWERPC_REL16_HA: + ref = Symbol::RELATIVE_REF; + break; + ++ case elfcpp::R_PPC_PLTREL24: ++ if (size != 32) ++ break; ++ ref = Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF; ++ break; ++ + case elfcpp::R_PPC64_REL24_NOTOC: +- if (size == 32) ++ case elfcpp::R_PPC64_REL24_P9NOTOC: ++ case elfcpp::R_PPC64_PLT16_LO_DS: ++ case elfcpp::R_PPC64_PLTSEQ_NOTOC: ++ case elfcpp::R_PPC64_PLTCALL_NOTOC: ++ case elfcpp::R_PPC64_PLT_PCREL34: ++ case elfcpp::R_PPC64_PLT_PCREL34_NOTOC: ++ if (size != 64) + break; + // Fall through. +- case elfcpp::R_PPC64_REL24_P9NOTOC: + case elfcpp::R_POWERPC_REL24: +- case elfcpp::R_PPC_PLTREL24: + case elfcpp::R_POWERPC_REL14: + case elfcpp::R_POWERPC_REL14_BRTAKEN: + case elfcpp::R_POWERPC_REL14_BRNTAKEN: + case elfcpp::R_POWERPC_PLT16_LO: + case elfcpp::R_POWERPC_PLT16_HI: + case elfcpp::R_POWERPC_PLT16_HA: +- case elfcpp::R_PPC64_PLT16_LO_DS: + case elfcpp::R_POWERPC_PLTSEQ: +- case elfcpp::R_PPC64_PLTSEQ_NOTOC: + case elfcpp::R_POWERPC_PLTCALL: +- case elfcpp::R_PPC64_PLTCALL_NOTOC: +- case elfcpp::R_PPC64_PLT_PCREL34: +- case elfcpp::R_PPC64_PLT_PCREL34_NOTOC: + ref = Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF; + break; + +- case elfcpp::R_POWERPC_GOT16: +- case elfcpp::R_POWERPC_GOT16_LO: +- case elfcpp::R_POWERPC_GOT16_HI: +- case elfcpp::R_POWERPC_GOT16_HA: + case elfcpp::R_PPC64_GOT16_DS: + case elfcpp::R_PPC64_GOT16_LO_DS: + case elfcpp::R_PPC64_GOT_PCREL34: +@@ -7768,11 +7784,16 @@ Target_powerpc::Scan:: + case elfcpp::R_PPC64_TOC16_HA: + case elfcpp::R_PPC64_TOC16_DS: + case elfcpp::R_PPC64_TOC16_LO_DS: ++ if (size != 64) ++ break; ++ // Fall through. ++ case elfcpp::R_POWERPC_GOT16: ++ case elfcpp::R_POWERPC_GOT16_LO: ++ case elfcpp::R_POWERPC_GOT16_HI: ++ case elfcpp::R_POWERPC_GOT16_HA: + ref = Symbol::RELATIVE_REF; + break; + +- case elfcpp::R_POWERPC_GOT_TPREL16: +- case elfcpp::R_POWERPC_TLS: + case elfcpp::R_PPC64_TLSGD: + case elfcpp::R_PPC64_TLSLD: + case elfcpp::R_PPC64_TPREL34: +@@ -7781,6 +7802,11 @@ Target_powerpc::Scan:: + case elfcpp::R_PPC64_GOT_TLSLD_PCREL34: + case elfcpp::R_PPC64_GOT_TPREL_PCREL34: + case elfcpp::R_PPC64_GOT_DTPREL_PCREL34: ++ if (size != 64) ++ break; ++ // Fall through. ++ case elfcpp::R_POWERPC_GOT_TPREL16: ++ case elfcpp::R_POWERPC_TLS: + ref = Symbol::TLS_REF; + break; + +@@ -10671,10 +10697,8 @@ Target_powerpc::Reloca + bool has_stub_value = false; + bool localentry0 = false; + unsigned int r_sym = elfcpp::elf_r_sym(rela.get_r_info()); +- bool use_plt_offset +- = (gsym != NULL +- ? gsym->use_plt_offset(Scan::get_reference_flags(r_type, target)) +- : object->local_has_plt_offset(r_sym)); ++ bool pltcall_to_direct = false; ++ + if (is_plt16_reloc(r_type) + || r_type == elfcpp::R_PPC64_PLT_PCREL34 + || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC +@@ -10688,21 +10712,18 @@ Target_powerpc::Reloca + // that the decision depends on the PLTCALL reloc, and we don't + // know the address of that instruction when processing others + // in the sequence. So the decision needs to be made in +- // do_relax(). For now, don't optimise inline plt calls. +- if (gsym) +- use_plt_offset = gsym->has_plt_offset(); +- } +- if (use_plt_offset +- && !is_got_reloc(r_type) +- && !is_plt16_reloc(r_type) +- && r_type != elfcpp::R_PPC64_PLT_PCREL34 +- && r_type != elfcpp::R_PPC64_PLT_PCREL34_NOTOC +- && r_type != elfcpp::R_POWERPC_PLTSEQ +- && r_type != elfcpp::R_POWERPC_PLTCALL +- && r_type != elfcpp::R_PPC64_PLTSEQ_NOTOC +- && r_type != elfcpp::R_PPC64_PLTCALL_NOTOC +- && (!psymval->is_ifunc_symbol() +- || Scan::reloc_needs_plt_for_ifunc(target, object, r_type, false))) ++ // do_relax(). ++ pltcall_to_direct = !(gsym != NULL ++ ? gsym->has_plt_offset() ++ : object->local_has_plt_offset(r_sym)); ++ } ++ else if ((gsym != NULL ++ ? gsym->use_plt_offset(Scan::get_reference_flags(r_type, target)) ++ : psymval->is_ifunc_symbol() && object->local_has_plt_offset(r_sym)) ++ && !is_got_reloc(r_type) ++ && (!psymval->is_ifunc_symbol() ++ || Scan::reloc_needs_plt_for_ifunc(target, object, r_type, ++ false))) + { + if (size == 64 + && gsym != NULL +@@ -10796,9 +10817,9 @@ Target_powerpc::Reloca + gold_assert(has_stub_value || !(os->flags() & elfcpp::SHF_ALLOC)); + } + +- if (use_plt_offset && (is_plt16_reloc(r_type) +- || r_type == elfcpp::R_PPC64_PLT_PCREL34 +- || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC)) ++ if (!pltcall_to_direct && (is_plt16_reloc(r_type) ++ || r_type == elfcpp::R_PPC64_PLT_PCREL34 ++ || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC)) + { + const Output_data_plt_powerpc* plt; + if (gsym) +@@ -10826,7 +10847,7 @@ Target_powerpc::Reloca + value -= target->toc_pointer(); + } + } +- else if (!use_plt_offset ++ else if (pltcall_to_direct + && (is_plt16_reloc(r_type) + || r_type == elfcpp::R_POWERPC_PLTSEQ + || r_type == elfcpp::R_PPC64_PLTSEQ_NOTOC)) +@@ -10835,7 +10856,7 @@ Target_powerpc::Reloca + elfcpp::Swap<32, big_endian>::writeval(iview, nop); + r_type = elfcpp::R_POWERPC_NONE; + } +- else if (!use_plt_offset ++ else if (pltcall_to_direct + && (r_type == elfcpp::R_PPC64_PLT_PCREL34 + || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC)) + { +@@ -11316,8 +11337,8 @@ Target_powerpc::Reloca + } + else if (!has_stub_value) + { +- if (!use_plt_offset && (r_type == elfcpp::R_POWERPC_PLTCALL +- || r_type == elfcpp::R_PPC64_PLTCALL_NOTOC)) ++ if (pltcall_to_direct && (r_type == elfcpp::R_POWERPC_PLTCALL ++ || r_type == elfcpp::R_PPC64_PLTCALL_NOTOC)) + { + // PLTCALL without plt entry => convert to direct call + Insn* iview = reinterpret_cast(view); diff --git a/toolchain/binutils/patches/2.39/011-PR29466-APP-NO_APP-with-.linefile.patch b/toolchain/binutils/patches/2.39/011-PR29466-APP-NO_APP-with-.linefile.patch new file mode 100644 index 00000000000..f7b58199290 --- /dev/null +++ b/toolchain/binutils/patches/2.39/011-PR29466-APP-NO_APP-with-.linefile.patch @@ -0,0 +1,167 @@ +From 9e855cffa1fda44629e7f9b76dfa3e5a51a440e9 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Thu, 11 Aug 2022 09:51:03 +0930 +Subject: [PATCH 011/160] PR29466, APP/NO_APP with .linefile + +Commit 53f2b36a54b9 exposed a bug in sb_scrub_and_add_sb that could +result in losing input. If scrubbing results in expansion past the +holding capacity of do_scrub_chars output buffer, then do_scrub_chars +stashes the extra input for the next call. That call never came +because sb_scrub_and_add_sb wrongly decided it was done. Fix that by +allowing sb_scrub_and_add_sb to see whether there is pending input. +Also allow a little extra space so that in most cases we won't need +to resize the output buffer. + +sb_scrub_and_add_sb also limited output to the size of the input, +rather than the actual output buffer size. Fixing that resulted in a +fail of gas/testsuite/macros/dot with an extra warning: "end of file +not at end of a line; newline inserted". OK, so the macro in dot.s +really does finish without end-of-line. Apparently the macro +expansion code relied on do_scrub_chars returning early. So fix that +too by adding a newline if needed in macro_expand_body. + + PR 29466 + * app.c (do_scrub_pending): New function. + * as.h: Declare it. + * input-scrub.c (input_scrub_include_sb): Add extra space for + two .linefile directives. + * sb.c (sb_scrub_and_add_sb): Take into account pending input. + Allow output to max. + * macro.c (macro_expand_body): Add terminating newline. + * testsuite/config/default.exp (SIZE, SIZEFLAGS): Define. + * testsuite/gas/macros/app5.d, + * testsuite/gas/macros/app5.s: New test. + * testsuite/gas/macros/macros.exp: Run it. + +(cherry picked from commit 4d74aab7aa562fe79d4669cdad0c32610531cbc0) +--- + gas/app.c | 13 +++++++++++++ + gas/as.h | 1 + + gas/input-scrub.c | 6 ++++-- + gas/macro.c | 2 ++ + gas/sb.c | 5 +++-- + gas/testsuite/config/default.exp | 8 ++++++++ + gas/testsuite/gas/macros/app5.d | 6 ++++++ + gas/testsuite/gas/macros/app5.s | 5 +++++ + gas/testsuite/gas/macros/macros.exp | 1 + + 9 files changed, 43 insertions(+), 4 deletions(-) + create mode 100644 gas/testsuite/gas/macros/app5.d + create mode 100644 gas/testsuite/gas/macros/app5.s + +--- a/gas/app.c ++++ b/gas/app.c +@@ -1537,3 +1537,16 @@ do_scrub_chars (size_t (*get) (char *, s + last_char = to[-1]; + return to - tostart; + } ++ ++/* Return amount of pending input. */ ++ ++size_t ++do_scrub_pending (void) ++{ ++ size_t len = 0; ++ if (saved_input) ++ len += saved_input_len; ++ if (state == -1) ++ len += strlen (out_string); ++ return len; ++} +--- a/gas/as.h ++++ b/gas/as.h +@@ -460,6 +460,7 @@ void input_scrub_insert_file (char *); + char * input_scrub_new_file (const char *); + char * input_scrub_next_buffer (char **bufp); + size_t do_scrub_chars (size_t (*get) (char *, size_t), char *, size_t); ++size_t do_scrub_pending (void); + bool scan_for_multibyte_characters (const unsigned char *, const unsigned char *, bool); + int gen_to_words (LITTLENUM_TYPE *, int, long); + int had_err (void); +--- a/gas/input-scrub.c ++++ b/gas/input-scrub.c +@@ -278,9 +278,11 @@ input_scrub_include_sb (sb *from, char * + + next_saved_file = input_scrub_push (position); + +- /* Allocate sufficient space: from->len + optional newline. */ ++ /* Allocate sufficient space: from->len plus optional newline ++ plus two ".linefile " directives, plus a little more for other ++ expansion. */ + newline = from->len >= 1 && from->ptr[0] != '\n'; +- sb_build (&from_sb, from->len + newline); ++ sb_build (&from_sb, from->len + newline + 2 * sizeof (".linefile") + 30); + if (expansion == expanding_repeat && from_sb_expansion >= expanding_macro) + expansion = expanding_nested; + from_sb_expansion = expansion; +--- a/gas/macro.c ++++ b/gas/macro.c +@@ -1056,6 +1056,8 @@ macro_expand_body (sb *in, sb *out, form + loclist = f; + } + ++ if (!err && (out->len == 0 || out->ptr[out->len - 1] != '\n')) ++ sb_add_char (out, '\n'); + return err; + } + +--- a/gas/sb.c ++++ b/gas/sb.c +@@ -119,11 +119,12 @@ sb_scrub_and_add_sb (sb *ptr, sb *s) + So we loop until the input S is consumed. */ + while (1) + { +- size_t copy = s->len - (scrub_position - s->ptr); ++ size_t copy = s->len - (scrub_position - s->ptr) + do_scrub_pending (); + if (copy == 0) + break; + sb_check (ptr, copy); +- ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len, copy); ++ ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len, ++ ptr->max - ptr->len); + } + + sb_to_scrub = 0; +--- a/gas/testsuite/config/default.exp ++++ b/gas/testsuite/config/default.exp +@@ -52,6 +52,14 @@ if ![info exists NMFLAGS] then { + set NMFLAGS {} + } + ++if ![info exists SIZE] then { ++ set SIZE [findfile $base_dir/size] ++} ++ ++if ![info exists SIZEFLAGS] then { ++ set SIZEFLAGS "" ++} ++ + if ![info exists OBJCOPY] then { + set OBJCOPY [findfile $base_dir/../../binutils/objcopy] + } +--- /dev/null ++++ b/gas/testsuite/gas/macros/app5.d +@@ -0,0 +1,6 @@ ++#name: APP with linefile ++#xfail: tic30-*-* ++#size: -G ++# pr29466 just check that the test assembles ++ ++#pass +--- /dev/null ++++ b/gas/testsuite/gas/macros/app5.s +@@ -0,0 +1,5 @@ ++#NO_APP ++#APP ++# 5 "foo.c" 1 ++# 0 "" 2 ++#NO_APP +--- a/gas/testsuite/gas/macros/macros.exp ++++ b/gas/testsuite/gas/macros/macros.exp +@@ -70,6 +70,7 @@ run_dump_test app2 + run_dump_test app3 + remote_download host "$srcdir/$subdir/app4b.s" + run_dump_test app4 ++run_dump_test app5 + + run_list_test badarg "" + diff --git a/toolchain/binutils/patches/2.39/039-LoongArch-ld-Fix-relocation-error-of-pcrel.patch b/toolchain/binutils/patches/2.39/039-LoongArch-ld-Fix-relocation-error-of-pcrel.patch new file mode 100644 index 00000000000..67e499de673 --- /dev/null +++ b/toolchain/binutils/patches/2.39/039-LoongArch-ld-Fix-relocation-error-of-pcrel.patch @@ -0,0 +1,128 @@ +From 509a2ec6ad3ea7eb3f4cf59538cf636a2126e4c3 Mon Sep 17 00:00:00 2001 +From: liuzhensong +Date: Fri, 2 Sep 2022 16:29:14 +0800 +Subject: [PATCH 039/160] LoongArch:ld: Fix relocation error of pcrel. + + Patch for branch 2.39. + Need to reduce the address of pc when using + reloction R_LARCH_SOP_PUSH_PCREL. + + bfd/ + * elfnn-loongarch.c +--- + bfd/elfnn-loongarch.c | 3 +- + ld/testsuite/ld-loongarch-elf/pcrel-const.d | 14 +++++++ + ld/testsuite/ld-loongarch-elf/pcrel-const.lds | 14 +++++++ + ld/testsuite/ld-loongarch-elf/pcrel-const.s | 12 ++++++ + ld/testsuite/ld-loongarch-elf/pr.exp | 39 +++++++++++++++++++ + 5 files changed, 81 insertions(+), 1 deletion(-) + create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.d + create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.lds + create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.s + create mode 100644 ld/testsuite/ld-loongarch-elf/pr.exp + +--- a/bfd/elfnn-loongarch.c ++++ b/bfd/elfnn-loongarch.c +@@ -2341,9 +2341,10 @@ loongarch_elf_relocate_section (bfd *out + case R_LARCH_SOP_PUSH_PLT_PCREL: + unresolved_reloc = false; + +- if (resolved_to_const) ++ if (!is_undefweak && resolved_to_const) + { + relocation += rel->r_addend; ++ relocation -= pc; + break; + } + else if (is_undefweak) +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.d +@@ -0,0 +1,14 @@ ++#as: -mla-global-with-pcrel ++#objdump: -Drsz ++ ++.*:[ ]+file format .* ++ ++ ++Disassembly of section .text: ++ ++.* : ++#... ++[ ]+8:[ ]+02c04084[ ]+addi.d[ ]+\$a0,[ ]+\$a0,[ ]+16\(0x10\) ++#... ++0+14 <__sec_end>: ++#pass +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.lds +@@ -0,0 +1,14 @@ ++ENTRY(foo); ++SECTIONS ++{ ++ .text : { ++ *(.text*) ++ } ++ ++ .data : { ++ __sec_start = .; ++ *(.gzdata) ++ __sec_end = .; ++ } ++} ++PROVIDE(__sec_size = __sec_end); +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.s +@@ -0,0 +1,12 @@ ++ .text ++ .align 2 ++ .globl foo ++ .type foo, @function ++foo: ++ nop ++ la.global $r4,__sec_size ++ ldptr.w $r4,$r4,0 ++ jr $r1 ++ .size foo, .-foo ++ .data ++ .word 1 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/pr.exp +@@ -0,0 +1,39 @@ ++# Expect script for LoongArch ELF linker tests ++# Copyright (C) 2022 Free Software Foundation, Inc. ++# ++# This file is part of the GNU Binutils. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# 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. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++# MA 02110-1301, USA. ++# ++ ++if ![istarget loongarch64-*-*] { ++ return ++} ++ ++set link_tests [list \ ++ [list \ ++ "pcrel const" \ ++ "-T pcrel-const.lds" "" \ ++ "-mla-global-with-pcrel" \ ++ { pcrel-const.s } \ ++ [list \ ++ [list objdump -D pcrel-const.d] \ ++ ] \ ++ "pcrel-const" \ ++ ] \ ++] ++ ++run_ld_link_tests $link_tests diff --git a/toolchain/binutils/patches/2.39/043-Re-PR29466-APP-NO_APP-with-linefile.patch b/toolchain/binutils/patches/2.39/043-Re-PR29466-APP-NO_APP-with-linefile.patch new file mode 100644 index 00000000000..1de501a1ae4 --- /dev/null +++ b/toolchain/binutils/patches/2.39/043-Re-PR29466-APP-NO_APP-with-linefile.patch @@ -0,0 +1,27 @@ +From 4233be14a34d754a70b8b6f6fa42d21f35c6e030 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sat, 10 Sep 2022 07:30:57 +0930 +Subject: [PATCH 043/160] Re: PR29466, APP/NO_APP with linefile + +It looks like I copied the SIZE init across from +binutils/testsuite/config/default.exp without some necessary editing. + + PR 29466 + * testsuite/config/default.exp (SIZE): Adjust relative path. + +(cherry picked from commit 1180f540d5f2f7751b5309bdd6c38d69fcf699e7) +--- + gas/testsuite/config/default.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/gas/testsuite/config/default.exp ++++ b/gas/testsuite/config/default.exp +@@ -53,7 +53,7 @@ if ![info exists NMFLAGS] then { + } + + if ![info exists SIZE] then { +- set SIZE [findfile $base_dir/size] ++ set SIZE [findfile $base_dir/../../binutils/size] + } + + if ![info exists SIZEFLAGS] then { diff --git a/toolchain/binutils/patches/2.39/050-PowerPC64-pcrel-got-relocs-against-local-symbols.patch b/toolchain/binutils/patches/2.39/050-PowerPC64-pcrel-got-relocs-against-local-symbols.patch new file mode 100644 index 00000000000..5c89f6804e5 --- /dev/null +++ b/toolchain/binutils/patches/2.39/050-PowerPC64-pcrel-got-relocs-against-local-symbols.patch @@ -0,0 +1,38 @@ +From 4d7bba23a39fba18d6d13a2941a3c232011a7064 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Fri, 16 Sep 2022 18:08:44 +0930 +Subject: [PATCH 050/160] PowerPC64 pcrel got relocs against local symbols + +Not that anyone would want to indirect via the GOT when an address can +be loaded directly with pla, the following: + + pld 3,x@got@pcrel +x: + +leads to "Internal error in md_apply_fix", because the generic parts +of assembler fixup handling convert the fx_pcrel fixup to one without +a symbol. Stop that happening. + + * config/tc-ppc.c (ppc_force_relocation): Add PLT_PCREL34 and + assorted GOT_PCREL34 relocs. + +(cherry picked from commit 49c3ed081fed6b8e2b48fdc48f805f11e4589514) +--- + gas/config/tc-ppc.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/gas/config/tc-ppc.c ++++ b/gas/config/tc-ppc.c +@@ -6676,6 +6676,12 @@ ppc_force_relocation (fixS *fix) + case BFD_RELOC_PPC_BA16_BRNTAKEN: + case BFD_RELOC_24_PLT_PCREL: + case BFD_RELOC_PPC64_TOC: ++ case BFD_RELOC_PPC64_PLT_PCREL34: ++ case BFD_RELOC_PPC64_GOT_PCREL34: ++ case BFD_RELOC_PPC64_GOT_TLSGD_PCREL34: ++ case BFD_RELOC_PPC64_GOT_TLSLD_PCREL34: ++ case BFD_RELOC_PPC64_GOT_TPREL_PCREL34: ++ case BFD_RELOC_PPC64_GOT_DTPREL_PCREL34: + return 1; + case BFD_RELOC_PPC_B26: + case BFD_RELOC_PPC_BA26: diff --git a/toolchain/binutils/patches/2.39/055-Re-PowerPC64-pcrel-got-relocs-against-local-symbols.patch b/toolchain/binutils/patches/2.39/055-Re-PowerPC64-pcrel-got-relocs-against-local-symbols.patch new file mode 100644 index 00000000000..19b80c3442b --- /dev/null +++ b/toolchain/binutils/patches/2.39/055-Re-PowerPC64-pcrel-got-relocs-against-local-symbols.patch @@ -0,0 +1,94 @@ +From 010db38b54b589ca3e95b498aba2831064970171 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Wed, 21 Sep 2022 09:06:29 +0930 +Subject: [PATCH 055/160] Re: PowerPC64 pcrel got relocs against local symbols + +The last patch wasn't all that shiny. There are rather a lot more +relocations that can hit the assertion in md_apply_fix if the symbol +is local or absolute. Fix them all. + + * config/tc-ppc.c (ppc_force_relocation): Add all relocs that + expect a symbol in md_apply_fix. Remove tls pcrel relocs + already covered in general tls match range. + +(cherry picked from commit 8b168f1a1e09e337d2a970f204a0230c091bbe58) +--- + gas/config/tc-ppc.c | 58 ++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 52 insertions(+), 6 deletions(-) + +--- a/gas/config/tc-ppc.c ++++ b/gas/config/tc-ppc.c +@@ -6666,8 +6666,6 @@ ppc_force_relocation (fixS *fix) + int + ppc_force_relocation (fixS *fix) + { +- /* Branch prediction relocations must force a relocation, as must +- the vtable description relocs. */ + switch (fix->fx_r_type) + { + case BFD_RELOC_PPC_B16_BRTAKEN: +@@ -6676,12 +6674,60 @@ ppc_force_relocation (fixS *fix) + case BFD_RELOC_PPC_BA16_BRNTAKEN: + case BFD_RELOC_24_PLT_PCREL: + case BFD_RELOC_PPC64_TOC: ++ case BFD_RELOC_16_GOTOFF: ++ case BFD_RELOC_LO16_GOTOFF: ++ case BFD_RELOC_HI16_GOTOFF: ++ case BFD_RELOC_HI16_S_GOTOFF: ++ case BFD_RELOC_LO16_PLTOFF: ++ case BFD_RELOC_HI16_PLTOFF: ++ case BFD_RELOC_HI16_S_PLTOFF: ++ case BFD_RELOC_GPREL16: ++ case BFD_RELOC_16_BASEREL: ++ case BFD_RELOC_LO16_BASEREL: ++ case BFD_RELOC_HI16_BASEREL: ++ case BFD_RELOC_HI16_S_BASEREL: ++ case BFD_RELOC_PPC_TOC16: ++ case BFD_RELOC_PPC64_TOC16_LO: ++ case BFD_RELOC_PPC64_TOC16_HI: ++ case BFD_RELOC_PPC64_TOC16_HA: ++ case BFD_RELOC_PPC64_PLTGOT16: ++ case BFD_RELOC_PPC64_PLTGOT16_LO: ++ case BFD_RELOC_PPC64_PLTGOT16_HI: ++ case BFD_RELOC_PPC64_PLTGOT16_HA: ++ case BFD_RELOC_PPC64_GOT16_DS: ++ case BFD_RELOC_PPC64_GOT16_LO_DS: ++ case BFD_RELOC_PPC64_PLT16_LO_DS: ++ case BFD_RELOC_PPC64_SECTOFF_DS: ++ case BFD_RELOC_PPC64_SECTOFF_LO_DS: ++ case BFD_RELOC_PPC64_TOC16_DS: ++ case BFD_RELOC_PPC64_TOC16_LO_DS: ++ case BFD_RELOC_PPC64_PLTGOT16_DS: ++ case BFD_RELOC_PPC64_PLTGOT16_LO_DS: ++ case BFD_RELOC_PPC_EMB_NADDR16: ++ case BFD_RELOC_PPC_EMB_NADDR16_LO: ++ case BFD_RELOC_PPC_EMB_NADDR16_HI: ++ case BFD_RELOC_PPC_EMB_NADDR16_HA: ++ case BFD_RELOC_PPC_EMB_SDAI16: ++ case BFD_RELOC_PPC_EMB_SDA2I16: ++ case BFD_RELOC_PPC_EMB_SDA2REL: ++ case BFD_RELOC_PPC_EMB_SDA21: ++ case BFD_RELOC_PPC_EMB_MRKREF: ++ case BFD_RELOC_PPC_EMB_RELSEC16: ++ case BFD_RELOC_PPC_EMB_RELST_LO: ++ case BFD_RELOC_PPC_EMB_RELST_HI: ++ case BFD_RELOC_PPC_EMB_RELST_HA: ++ case BFD_RELOC_PPC_EMB_BIT_FLD: ++ case BFD_RELOC_PPC_EMB_RELSDA: ++ case BFD_RELOC_PPC_VLE_SDA21: ++ case BFD_RELOC_PPC_VLE_SDA21_LO: ++ case BFD_RELOC_PPC_VLE_SDAREL_LO16A: ++ case BFD_RELOC_PPC_VLE_SDAREL_LO16D: ++ case BFD_RELOC_PPC_VLE_SDAREL_HI16A: ++ case BFD_RELOC_PPC_VLE_SDAREL_HI16D: ++ case BFD_RELOC_PPC_VLE_SDAREL_HA16A: ++ case BFD_RELOC_PPC_VLE_SDAREL_HA16D: + case BFD_RELOC_PPC64_PLT_PCREL34: + case BFD_RELOC_PPC64_GOT_PCREL34: +- case BFD_RELOC_PPC64_GOT_TLSGD_PCREL34: +- case BFD_RELOC_PPC64_GOT_TLSLD_PCREL34: +- case BFD_RELOC_PPC64_GOT_TPREL_PCREL34: +- case BFD_RELOC_PPC64_GOT_DTPREL_PCREL34: + return 1; + case BFD_RELOC_PPC_B26: + case BFD_RELOC_PPC_BA26: diff --git a/toolchain/binutils/patches/2.39/058-elf-Reset-alignment-for-each-PT_LOAD-segment.patch b/toolchain/binutils/patches/2.39/058-elf-Reset-alignment-for-each-PT_LOAD-segment.patch new file mode 100644 index 00000000000..aaf7a1b053c --- /dev/null +++ b/toolchain/binutils/patches/2.39/058-elf-Reset-alignment-for-each-PT_LOAD-segment.patch @@ -0,0 +1,89 @@ +From a98316d5cf970cbc99689797d84c2ea832bcdcbb Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" +Date: Mon, 1 Aug 2022 16:02:39 -0700 +Subject: [PATCH 058/160] elf: Reset alignment for each PT_LOAD segment + +Reset alignment for each PT_LOAD segment to avoid using alignment from +the previous PT_LOAD segment. + +bfd/ + + PR ld/29435 + * elf.c (assign_file_positions_for_load_sections): Reset + alignment for each PT_LOAD segment. + +ld/ + + PR ld/29435 + * testsuite/ld-elf/pr29435.d: New file. + * testsuite/ld-elf/pr29435.s: Likewise. + +(cherry picked from commit 59f214544c50ec7ebbca285ff2b4949f48671690) +--- + bfd/elf.c | 7 ++++--- + ld/testsuite/ld-elf/pr29435.d | 11 +++++++++++ + ld/testsuite/ld-elf/pr29435.s | 6 ++++++ + 3 files changed, 21 insertions(+), 3 deletions(-) + create mode 100644 ld/testsuite/ld-elf/pr29435.d + create mode 100644 ld/testsuite/ld-elf/pr29435.s + +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -5438,8 +5438,6 @@ assign_file_positions_for_load_sections + Elf_Internal_Phdr *p; + file_ptr off; /* Octets. */ + bfd_size_type maxpagesize; +- bfd_size_type p_align; +- bool p_align_p = false; + unsigned int alloc, actual; + unsigned int i, j; + struct elf_segment_map **sorted_seg_map; +@@ -5524,7 +5522,6 @@ assign_file_positions_for_load_sections + qsort (sorted_seg_map, alloc, sizeof (*sorted_seg_map), + elf_sort_segments); + +- p_align = bed->p_align; + maxpagesize = 1; + if ((abfd->flags & D_PAGED) != 0) + { +@@ -5559,6 +5556,8 @@ assign_file_positions_for_load_sections + asection **secpp; + bfd_vma off_adjust; /* Octets. */ + bool no_contents; ++ bfd_size_type p_align; ++ bool p_align_p; + + /* An ELF segment (described by Elf_Internal_Phdr) may contain a + number of sections with contents contributing to both p_filesz +@@ -5569,6 +5568,8 @@ assign_file_positions_for_load_sections + p = phdrs + m->idx; + p->p_type = m->p_type; + p->p_flags = m->p_flags; ++ p_align = bed->p_align; ++ p_align_p = false; + + if (m->count == 0) + p->p_vaddr = m->p_vaddr_offset * opb; +--- /dev/null ++++ b/ld/testsuite/ld-elf/pr29435.d +@@ -0,0 +1,11 @@ ++#ld: -shared -z separate-code -z relro ++#xfail: ![check_shared_lib_support] ++#xfail: ![check_relro_support] ++#readelf: -Wl ++ ++#failif ++#... ++ +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ .* 0x8000 ++#... ++ +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ .* 0x8000 ++#... +--- /dev/null ++++ b/ld/testsuite/ld-elf/pr29435.s +@@ -0,0 +1,6 @@ ++ .text ++ .balign 0x8000 ++ .globl foo ++ .type foo, %function ++foo: ++ .byte 0 diff --git a/toolchain/binutils/patches/2.39/063-PR29542-PowerPC-gold-internal-error-in-get_output_vi.patch b/toolchain/binutils/patches/2.39/063-PR29542-PowerPC-gold-internal-error-in-get_output_vi.patch new file mode 100644 index 00000000000..0d66b7750fc --- /dev/null +++ b/toolchain/binutils/patches/2.39/063-PR29542-PowerPC-gold-internal-error-in-get_output_vi.patch @@ -0,0 +1,29 @@ +From 041c22e35de06d22566f4c71e4425c3351215e66 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 25 Sep 2022 12:07:36 +0930 +Subject: [PATCH 063/160] PR29542, PowerPC gold internal error in + get_output_view, + +We were attempting to set a BSS style section contents. + + PR 29542 + * powerpc.cc (Output_data_plt_powerpc::do_write): Don't set .plt, + .iplt or .lplt section contents when position independent. + +(cherry picked from commit c21736aed1d4877e090df60362413669dbdc391d) +--- + gold/powerpc.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/gold/powerpc.cc ++++ b/gold/powerpc.cc +@@ -4338,7 +4338,8 @@ template + void + Output_data_plt_powerpc::do_write(Output_file* of) + { +- if (!this->sym_ents_.empty()) ++ if (!this->sym_ents_.empty() ++ && !parameters->options().output_is_position_independent()) + { + const section_size_type offset = this->offset(); + const section_size_type oview_size diff --git a/toolchain/binutils/patches/2.39/116-arm-Use-DWARF-numbering-convention-for-pseudo-regist.patch b/toolchain/binutils/patches/2.39/116-arm-Use-DWARF-numbering-convention-for-pseudo-regist.patch new file mode 100644 index 00000000000..82a015ee2bb --- /dev/null +++ b/toolchain/binutils/patches/2.39/116-arm-Use-DWARF-numbering-convention-for-pseudo-regist.patch @@ -0,0 +1,301 @@ +From 88ac930a725b8aac8284a2738f03b843f4343dd0 Mon Sep 17 00:00:00 2001 +From: Victor Do Nascimento +Date: Thu, 17 Nov 2022 14:48:37 +0000 +Subject: [PATCH 116/160] arm: Use DWARF numbering convention for + pseudo-register representation + +The patch, initially submitted to trunk in +https://sourceware.org/pipermail/binutils/2022-July/122092.html ensures correct +support for handling .save directives for mixed-register type lists involving +the ra_auth_code pseudo-register, whereby the support first introduced in 2.39 +(https://sourceware.org/pipermail/binutils/2022-May/120672.html) led to the +generation of unwinder code popping registers in reversed order. + +gas/Changelog: + + * config/tc-arm.c (REG_RA_AUTH_CODE): New. + (parse_dot_save): Likewise. + (parse_reg_list): Remove obsolete code. + (reg_names): Set ra_auth_code to 143. + (s_arm_unwind_save): Handle core and pseudo-register lists via + parse_dot_save. + (s_arm_unwind_save_mixed): Deleted. + (s_arm_unwind_save_pseudo): Handle one register at a time. + * testsuite/gas/arm/unwind-pacbti-m-readelf.d: Fix test. + * testsuite/gas/arm/unwind-pacbti-m.d: Likewise. + +(cherry picked from commit 3a368c4c248f6e9f4bda3a5369befa17a4560293) +--- + gas/config/tc-arm.c | 159 ++++++++++-------- + .../gas/arm/unwind-pacbti-m-readelf.d | 4 +- + gas/testsuite/gas/arm/unwind-pacbti-m.d | 2 +- + 3 files changed, 95 insertions(+), 70 deletions(-) + +--- a/gas/config/tc-arm.c ++++ b/gas/config/tc-arm.c +@@ -742,6 +742,7 @@ const char * const reg_expected_msgs[] = + #define REG_SP 13 + #define REG_LR 14 + #define REG_PC 15 ++#define REG_RA_AUTH_CODE 143 + + /* ARM instructions take 4bytes in the object file, Thumb instructions + take 2: */ +@@ -1943,21 +1944,6 @@ parse_reg_list (char ** strp, enum reg_l + + reg = arm_reg_parse (&str, rt); + +- /* Skip over allowed registers of alternative types in mixed-type +- register lists. */ +- if (reg == FAIL && rt == REG_TYPE_PSEUDO +- && ((reg = arm_reg_parse (&str, REG_TYPE_RN)) != FAIL)) +- { +- cur_reg = reg; +- continue; +- } +- else if (reg == FAIL && rt == REG_TYPE_RN +- && ((reg = arm_reg_parse (&str, REG_TYPE_PSEUDO)) != FAIL)) +- { +- cur_reg = reg; +- continue; +- } +- + if (etype == REGLIST_CLRM) + { + if (reg == REG_SP || reg == REG_PC) +@@ -4139,7 +4125,6 @@ s_arm_unwind_fnstart (int ignored ATTRIB + unwind.sp_restored = 0; + } + +- + /* Parse a handlerdata directive. Creates the exception handling table entry + for the function. */ + +@@ -4297,15 +4282,19 @@ s_arm_unwind_personality (int ignored AT + /* Parse a directive saving pseudo registers. */ + + static void +-s_arm_unwind_save_pseudo (long range) ++s_arm_unwind_save_pseudo (int regno) + { + valueT op; + +- if (range & (1 << 12)) ++ switch (regno) + { ++ case REG_RA_AUTH_CODE: + /* Opcode for restoring RA_AUTH_CODE. */ + op = 0xb4; + add_unwind_opcode (op, 1); ++ break; ++ default: ++ as_bad (_("Unknown register %d encountered\n"), regno); + } + } + +@@ -4375,6 +4364,80 @@ s_arm_unwind_save_core (long range) + } + } + ++/* Implement correct handling of .save lists enabling the split into ++sublists where necessary, while preserving correct sublist ordering. */ ++ ++static void ++parse_dot_save (char **str_p, int prev_reg) ++{ ++ long core_regs = 0; ++ int reg; ++ int in_range = 0; ++ ++ if (**str_p == ',') ++ *str_p += 1; ++ if (**str_p == '}') ++ { ++ *str_p += 1; ++ return; ++ } ++ ++ while ((reg = arm_reg_parse (str_p, REG_TYPE_RN)) != FAIL) ++ { ++ if (!in_range) ++ { ++ if (core_regs & (1 << reg)) ++ as_tsktsk (_("Warning: duplicated register (r%d) in register list"), ++ reg); ++ else if (reg <= prev_reg) ++ as_tsktsk (_("Warning: register list not in ascending order")); ++ ++ core_regs |= (1 << reg); ++ prev_reg = reg; ++ if (skip_past_char(str_p, '-') != FAIL) ++ in_range = 1; ++ else if (skip_past_comma(str_p) == FAIL) ++ first_error (_("bad register list")); ++ } ++ else ++ { ++ int i; ++ if (reg <= prev_reg) ++ first_error (_("bad range in register list")); ++ for (i = prev_reg + 1; i <= reg; i++) ++ { ++ if (core_regs & (1 << i)) ++ as_tsktsk (_("Warning: duplicated register (r%d) in register list"), ++ i); ++ else ++ core_regs |= 1 << i; ++ } ++ in_range = 0; ++ } ++ } ++ if (core_regs) ++ { ++ /* Higher register numbers go in higher memory addresses. When splitting a list, ++ right-most sublist should therefore be .saved first. Use recursion for this. */ ++ parse_dot_save (str_p, reg); ++ /* We're back from recursion, so emit .save insn for sublist. */ ++ s_arm_unwind_save_core (core_regs); ++ return; ++ } ++ /* Handle pseudo-regs, under assumption these are emitted singly. */ ++ else if ((reg = arm_reg_parse (str_p, REG_TYPE_PSEUDO)) != FAIL) ++ { ++ /* Recurse for remainder of input. Note: No assumption is made regarding which ++ register in core register set holds pseudo-register. It's not considered in ++ ordering check beyond ensuring it's not sandwiched between 2 consecutive ++ registers. */ ++ parse_dot_save (str_p, prev_reg + 1); ++ s_arm_unwind_save_pseudo (reg); ++ return; ++ } ++ else ++ as_bad (BAD_SYNTAX); ++} + + /* Parse a directive saving FPA registers. */ + +@@ -4716,39 +4779,13 @@ s_arm_unwind_save_mmxwcg (void) + ignore_rest_of_line (); + } + +-/* Convert range and mask_range into a sequence of s_arm_unwind_core +- and s_arm_unwind_pseudo operations. We assume that mask_range will +- not have consecutive bits set, or that one operation per bit is +- acceptable. */ +- +-static void +-s_arm_unwind_save_mixed (long range, long mask_range) +-{ +- while (mask_range) +- { +- long mask_bit = mask_range & -mask_range; +- long subrange = range & (mask_bit - 1); +- +- if (subrange) +- s_arm_unwind_save_core (subrange); +- +- s_arm_unwind_save_pseudo (mask_bit); +- range &= ~subrange; +- mask_range &= ~mask_bit; +- } +- +- if (range) +- s_arm_unwind_save_core (range); +-} +- + /* Parse an unwind_save directive. + If the argument is non-zero, this is a .vsave directive. */ + + static void + s_arm_unwind_save (int arch_v6) + { +- char *peek, *mask_peek; +- long range, mask_range; ++ char *peek; + struct reg_entry *reg; + bool had_brace = false; + +@@ -4756,7 +4793,7 @@ s_arm_unwind_save (int arch_v6) + as_bad (MISSING_FNSTART); + + /* Figure out what sort of save we have. */ +- peek = mask_peek = input_line_pointer; ++ peek = input_line_pointer; + + if (*peek == '{') + { +@@ -4788,20 +4825,13 @@ s_arm_unwind_save (int arch_v6) + + case REG_TYPE_PSEUDO: + case REG_TYPE_RN: +- mask_range = parse_reg_list (&mask_peek, REGLIST_PSEUDO); +- range = parse_reg_list (&input_line_pointer, REGLIST_RN); +- +- if (range == FAIL || mask_range == FAIL) +- { +- as_bad (_("expected register list")); +- ignore_rest_of_line (); +- return; +- } +- +- demand_empty_rest_of_line (); +- +- s_arm_unwind_save_mixed (range, mask_range); +- return; ++ { ++ if (had_brace) ++ input_line_pointer++; ++ parse_dot_save (&input_line_pointer, -1); ++ demand_empty_rest_of_line (); ++ return; ++ } + + case REG_TYPE_VFD: + if (arch_v6) +@@ -23993,12 +24023,8 @@ static const struct reg_entry reg_names[ + /* XScale accumulator registers. */ + REGNUM(acc,0,XSCALE), REGNUM(ACC,0,XSCALE), + +- /* DWARF ABI defines RA_AUTH_CODE to 143. It also reserves 134-142 for future +- expansion. RA_AUTH_CODE here is given the value 143 % 134 to make it easy +- for tc_arm_regname_to_dw2regnum to translate to DWARF reg number using +- 134 + reg_number should the range 134 to 142 be used for more pseudo regs +- in the future. This also helps fit RA_AUTH_CODE into a bitmask. */ +- REGDEF(ra_auth_code,12,PSEUDO), ++ /* AADWARF32 defines RA_AUTH_CODE to 143. */ ++ REGDEF(ra_auth_code,143,PSEUDO), + }; + #undef REGDEF + #undef REGNUM +@@ -27905,7 +27931,6 @@ create_unwind_entry (int have_data) + return 0; + } + +- + /* Initialize the DWARF-2 unwind information for this procedure. */ + + void +--- a/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d ++++ b/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d +@@ -10,11 +10,11 @@ Unwind section '.ARM.exidx' at offset 0x + + 0x0 : @0x0 + Compact model index: 1 +- 0x84 0x00 pop {r14} + 0xb4 pop {ra_auth_code} + 0x84 0x00 pop {r14} +- 0xb4 pop {ra_auth_code} + 0xa3 pop {r4, r5, r6, r7} + 0xb4 pop {ra_auth_code} ++ 0x84 0x00 pop {r14} ++ 0xb4 pop {ra_auth_code} + 0xa8 pop {r4, r14} + 0xb0 finish +--- a/gas/testsuite/gas/arm/unwind-pacbti-m.d ++++ b/gas/testsuite/gas/arm/unwind-pacbti-m.d +@@ -8,4 +8,4 @@ + .*: file format.* + + Contents of section .ARM.extab: +- 0000 (00840281 b40084b4 b0a8b4a3|81028400 b48400b4 a3b4a8b0) 00000000 .* ++ 0000 (84b40281 84b4a300 b0a8b400|8102b484 00a3b484 00b4a8b0) 00000000 .* diff --git a/toolchain/nasm/Makefile b/toolchain/nasm/Makefile index f733c52912e..64bb5e77511 100644 --- a/toolchain/nasm/Makefile +++ b/toolchain/nasm/Makefile @@ -5,12 +5,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nasm -PKG_VERSION:=2.15.05 +PKG_VERSION:=2.16.01 PKG_SOURCE_URL:=https://www.nasm.us/pub/nasm/releasebuilds/$(PKG_VERSION)/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz - -PKG_HASH:=3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f +PKG_HASH:=c77745f4802375efeee2ec5c0ad6b7f037ea9c87c92b149a9637ff099f162558 HOST_BUILD_PARALLEL:=1 diff --git a/tools/Makefile b/tools/Makefile index 6300180d3f4..c7c7d007563 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -36,6 +36,7 @@ tools-y += findutils tools-y += firmware-utils tools-y += flex tools-y += gengetopt +tools-y += libdeflate tools-y += libressl tools-y += libtool tools-y += lzma @@ -88,6 +89,7 @@ $(curdir)/genext2fs/compile := $(curdir)/libtool/compile $(curdir)/gengetopt/compile := $(curdir)/libtool/compile $(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/isl/compile := $(curdir)/gmp/compile +$(curdir)/libdeflate/compile := $(curdir)/cmake/compile $(curdir)/libressl/compile := $(curdir)/pkgconf/compile $(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile diff --git a/tools/libdeflate/Makefile b/tools/libdeflate/Makefile new file mode 100644 index 00000000000..d30a8ca674f --- /dev/null +++ b/tools/libdeflate/Makefile @@ -0,0 +1,31 @@ +# +# Copyright (C) 2022 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:=libdeflate +PKG_VERSION:=1.15 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) +PKG_MIRROR_HASH:=122feff4543541b547dc89e832adf262c81911ae1acbccdc591f0353a85b600a + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +define Host/Install + $(INSTALL_BIN) $(HOST_BUILD_DIR)/programs/libdeflate-gzip $(STAGING_DIR_HOST)/bin/ + $(LN) libdeflate-gzip $(STAGING_DIR_HOST)/bin/libdeflate-gunzip +endef + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/libdeflate-gzip + rm -f $(STAGING_DIR_HOST)/bin/libdeflate-gunzip +endef + +$(eval $(call HostBuild)) diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile index 775e1af896b..2a0cc0ab336 100644 --- a/tools/llvm-bpf/Makefile +++ b/tools/llvm-bpf/Makefile @@ -7,17 +7,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=llvm-project -PKG_VERSION:=14.0.6 +PKG_VERSION:=15.0.6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION) -PKG_HASH:=8b3cfd7bc695bd6cea0f37f53f0981f34f87496e79e2529874fd03a2f9dd3a8a +PKG_HASH:=9d53ad04dc60cb7b30e810faf64c5ab8157dadef46c8766f67f286238256ff92 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src -HOST_BUILD_PARALLEL:=1 - CMAKE_BINARY_SUBDIR := build CMAKE_SOURCE_SUBDIR := llvm diff --git a/tools/mpfr/Makefile b/tools/mpfr/Makefile index 6a13be73981..cdcca5f11af 100644 --- a/tools/mpfr/Makefile +++ b/tools/mpfr/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpfr -PKG_VERSION:=4.1.1 +PKG_VERSION:=4.2.0 PKG_CPE_ID:=cpe:/a:mpfr:gnu_mpfr PKG_SOURCE_URL:=@GNU/mpfr http://www.mpfr.org/mpfr-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=ffd195bd567dbaffc3b98b23fd00aad0537680c9896171e44fe3ff79e28ac33d +PKG_HASH:=06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993 HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/mpfr/patches/001-only_src.patch b/tools/mpfr/patches/001-only_src.patch index 68312276c9d..bd9e38aefbd 100644 --- a/tools/mpfr/patches/001-only_src.patch +++ b/tools/mpfr/patches/001-only_src.patch @@ -1,6 +1,6 @@ --- a/Makefile.am +++ b/Makefile.am -@@ -34,7 +34,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -38,7 +38,7 @@ AUTOMAKE_OPTIONS = gnu # old Automake version. ACLOCAL_AMFLAGS = -I m4 @@ -11,7 +11,7 @@ pkgconfig_DATA = mpfr.pc --- a/Makefile.in +++ b/Makefile.in -@@ -397,7 +397,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -401,7 +401,7 @@ AUTOMAKE_OPTIONS = gnu # libtoolize and in case some developer needs to switch back to an # old Automake version. ACLOCAL_AMFLAGS = -I m4 diff --git a/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch b/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch deleted file mode 100644 index bb66a9067c4..00000000000 --- a/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0ce17bae34a6c54de31b126f969d3ddd72c6bc37 Mon Sep 17 00:00:00 2001 -From: Vincent Lefevre -Date: Tue, 22 Nov 2022 16:33:00 +0100 -Subject: [PATCH] Fix mpfr_custom_get_kind() macro bug. - -* src/mpfr.h: in the mpfr_custom_get_kind() macro, changed mpfr_ptr to - mpfr_srcptr for _x to agree with the function prototype, in order to - avoid a compilation failure of user code in some cases. This bug was - introduced by commit 9f94e0311ed53d0c64d4fbca249d19cc4888027e, which - introduced the temporary variable _x to avoid an incorrect number of - evaluations of the x argument. -* tests/tstckintc.c: improved the tests to detect this bug. - -This should fix mpfr bug #1. - -Bug initially reported by FX Coudert: - https://github.com/CGAL/cgal/issues/7064 - -It affects Fedora Linux: - https://bugzilla.redhat.com/show_bug.cgi?id=2144197 ---- - src/mpfr.h | 2 +- - tests/tstckintc.c | 10 +++++++--- - 2 files changed, 8 insertions(+), 4 deletions(-) - ---- a/src/mpfr.h -+++ b/src/mpfr.h -@@ -1027,7 +1027,7 @@ __MPFR_DECLSPEC int mpfr_total_order_p ( - #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 - #define mpfr_custom_get_kind(x) \ - __extension__ ({ \ -- mpfr_ptr _x = (x); \ -+ mpfr_srcptr _x = (x); \ - _x->_mpfr_exp > __MPFR_EXP_INF ? \ - (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (_x) \ - : _x->_mpfr_exp == __MPFR_EXP_INF ? \ ---- a/tests/tstckintc.c -+++ b/tests/tstckintc.c -@@ -295,14 +295,16 @@ static void - test_nan_inf_zero (void) - { - mpfr_ptr val; -+ mpfr_srcptr sval; /* for compilation error checking */ - int sign; - int kind; - - reset_stack (); - - val = new_mpfr (MPFR_PREC_MIN); -+ sval = val; - mpfr_set_nan (val); -- kind = (mpfr_custom_get_kind) (val); -+ kind = (mpfr_custom_get_kind) (sval); - if (kind != MPFR_NAN_KIND) - { - printf ("mpfr_custom_get_kind error: "); -@@ -380,7 +382,8 @@ static long * - dummy_set_si (long si) - { - mpfr_t x; -- long * r = dummy_new (); -+ mpfr_srcptr px; /* for compilation error checking */ -+ long *r = dummy_new (); - int i1, i2, i3, i4, i5; - - /* Check that the type "void *" can be used, like with the function. -@@ -405,7 +408,8 @@ dummy_set_si (long si) - MPFR_ASSERTN (i5 == 1); - - mpfr_set_si (x, si, MPFR_RNDN); -- r[0] = mpfr_custom_get_kind (x); -+ px = x; -+ r[0] = mpfr_custom_get_kind (px); - - /* Check that the type "void *" can be used in C, like with the function - (forbidden in C++). Also check side effects. */ diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 6e287a61b0b..18ba1a236e7 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xz -PKG_VERSION:=5.2.10 +PKG_VERSION:=5.4.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/lzmautils \ http://tukaani.org/xz -PKG_HASH:=01b71df61521d9da698ce3c33148bff06a131628ff037398c09482f3a26e5408 +PKG_HASH:=795ea0494c66d509b052ddc36dc63bd634e59ff2a0f39c16a3b5644dd01d87e6 PKG_CPE_ID:=cpe:/a:tukaani:xz HOST_BUILD_PARALLEL:=1