diff --git a/.devcontainer/ci-env/devcontainer.json b/.devcontainer/ci-env/devcontainer.json new file mode 100644 index 00000000000..23b0555e66a --- /dev/null +++ b/.devcontainer/ci-env/devcontainer.json @@ -0,0 +1,12 @@ +{ + "name": "CI build container", + "image": "ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v9", + "features": { + }, + "remoteUser": "buildbot", + "customizations": { + "vscode": { + "extensions": ["ms-vscode.cpptools", "plorefice.devicetree"] + } + } +} diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index aeeb9385d34..2ad79700d76 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -105,7 +105,9 @@ dongwon,dw02-412h-128m|\ glinet,gl-ar300m-lite|\ glinet,gl-ar300m-nand|\ glinet,gl-ar300m-nor|\ -glinet,gl-ar300m16) +glinet,gl-ar300m16|\ +glinet,gl-s200-nor|\ +glinet,gl-s200-nor-nand) idx="$(find_mtd_index u-boot-env)" [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a04c0616e57..49d6c9d67fd 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -127,6 +127,7 @@ xiaomi,redmi-router-ac2100) zyxel,lte3301-plus) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x80000" ;; +zyxel,lte5398-m904|\ zyxel,nr7101) idx="$(find_mtd_index Config)" [ -n "$idx" ] && \ diff --git a/package/firmware/linux-firmware/mellanox.mk b/package/firmware/linux-firmware/mellanox.mk new file mode 100644 index 00000000000..039c7deb105 --- /dev/null +++ b/package/firmware/linux-firmware/mellanox.mk @@ -0,0 +1,9 @@ +Package/mlxsw_spectrum-firmware = $(call Package/firmware-default,Mellanox Spectrum firmware) +define Package/mlxsw_spectrum-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mellanox + $(CP) \ + $(PKG_BUILD_DIR)/mellanox/mlxsw_spectrum-*.mfa2 \ + $(1)/lib/firmware/mellanox +endef + +$(eval $(call BuildPackage,mlxsw_spectrum-firmware)) diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index 092bdf2b107..8638d508235 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -77,6 +77,23 @@ endef $(eval $(call KernelPackage,hwmon-adt7475)) +define KernelPackage/hwmon-coretemp + TITLE:=Intel Core/Core2/Atom temperature sensor + KCONFIG:=CONFIG_SENSORS_CORETEMP + FILES:=$(LINUX_DIR)/drivers/hwmon/coretemp.ko + AUTOLOAD:=$(call AutoProbe,coretemp) + $(call AddDepends/hwmon,) +endef + +define KernelPackage/hwmon-coretemp/description + Kernel module for Intel Core/Core2/Atom temperature monitoring support. + Most of the family 6 CPUs are supported. + Check Documentation/hwmon/coretemp.rst for details. +endef + +$(eval $(call KernelPackage,hwmon-coretemp)) + + define KernelPackage/hwmon-dme1737 TITLE:=SMSC DME1737 and compatible monitoring support KCONFIG:=CONFIG_SENSORS_DME1737 diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index fcf9c987e8e..24af1b7f615 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -147,6 +147,22 @@ endef $(eval $(call KernelPackage,leds-apu)) +define KernelPackage/leds-mlxcpld + SUBMENU:=$(LEDS_MENU) + TITLE:=LED support for the Mellanox boards + FILES:=$(LINUX_DIR)/drivers/leds/leds-mlxcpld.ko + KCONFIG:=CONFIG_LEDS_MLXCPLD + AUTOLOAD:=$(call AutoProbe,leds-mlxcpld) +endef + +define KernelPackage/leds-mlxcpld/description + This option enables support for the LEDs on the Mellanox + boards. +endef + +$(eval $(call KernelPackage,leds-mlxcpld)) + + define KernelPackage/leds-pca955x SUBMENU:=$(LEDS_MENU) TITLE:=LED driver for PCA955x I2C chips diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index c7d32d73170..8d67a3187a6 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -318,3 +318,29 @@ define KernelPackage/oid-registry endef $(eval $(call KernelPackage,oid-registry)) + + +define KernelPackage/lib-objagg + SUBMENU:=$(LIB_MENU) + TITLE:=objagg support + FILES:=$(LINUX_DIR)/lib/objagg.ko + KCONFIG:= \ + CONFIG_OBJAGG \ + CONFIG_TEST_OBJAGG=n + AUTOLOAD:=$(call AutoProbe,objagg) +endef + +$(eval $(call KernelPackage,lib-objagg)) + + +define KernelPackage/lib-parman + SUBMENU:=$(LIB_MENU) + TITLE:=parman support + FILES:=$(LINUX_DIR)/lib/parman.ko + KCONFIG:= \ + CONFIG_PARMAN \ + CONFIG_TEST_PARMAN=n + AUTOLOAD:=$(call AutoProbe,parman) +endef + +$(eval $(call KernelPackage,lib-parman)) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 9057ec56151..74ea07e2611 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1343,7 +1343,7 @@ $(eval $(call KernelPackage,mlx4-core)) define KernelPackage/mlx5-core SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Mellanox ConnectX(R) mlx5 core Network Driver - DEPENDS:=@PCI_SUPPORT +kmod-ptp + DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mlxfw FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko KCONFIG:= CONFIG_MLX5_CORE \ CONFIG_MLX5_CORE_EN=y \ @@ -1372,6 +1372,119 @@ endef $(eval $(call KernelPackage,mlx5-core)) +define KernelPackage/mlxfw + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies firmware flash module + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko + KCONFIG:=CONFIG_MLXFW + AUTOLOAD:=$(call AutoProbe,mlxfw) +endef + +define KernelPackage/mlxfw/description + This driver supports Mellanox Technologies Firmware + flashing common logic. +endef + +$(eval $(call KernelPackage,mlxfw)) + + +define KernelPackage/mlxsw-core + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies Switch ASICs support + DEPENDS:=+kmod-mlxfw +kmod-hwmon-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_core.ko + KCONFIG:= \ + CONFIG_MLXSW_CORE \ + CONFIG_MLXSW_CORE_HWMON=y \ + CONFIG_MLXSW_CORE_THERMAL=y + AUTOLOAD:=$(call AutoProbe,mlxsw_core) +endef + +define KernelPackage/mlxsw-core/description + This driver supports Mellanox Technologies Switch ASICs family. +endef + +$(eval $(call KernelPackage,mlxsw-core)) + + +define KernelPackage/mlxsw-i2c + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=I2C bus implementation for Mellanox Technologies Switch ASICs + DEPENDS:=+kmod-mlxsw-core +kmod-i2c-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_i2c.ko + KCONFIG:=CONFIG_MLXSW_I2C + AUTOLOAD:=$(call AutoProbe,mlxsw_i2c) +endef + +define KernelPackage/mlxsw-i2c/description + This is I2C bus implementation for Mellanox Technologies Switch ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-i2c)) + + +define KernelPackage/mlxsw-minimal + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies minimal I2C support + DEPENDS:=+kmod-mlxsw-core +kmod-mlxsw-i2c + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_minimal.ko + KCONFIG:=CONFIG_MLXSW_MINIMAL + AUTOLOAD:=$(call AutoProbe,mlxsw_minimal) +endef + +define KernelPackage/mlxsw-minimal/description + This driver supports I2C access for Mellanox Technologies Switch + ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-minimal)) + + +define KernelPackage/mlxsw-pci + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=PCI bus implementation for Mellanox Technologies Switch ASICs + DEPENDS:=@PCI_SUPPORT +kmod-mlxsw-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_pci.ko + KCONFIG:=CONFIG_MLXSW_PCI + AUTOLOAD:=$(call AutoProbe,mlxsw_pci) +endef + +define KernelPackage/mlxsw-pci/description + This is PCI bus implementation for Mellanox Technologies Switch ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-pci)) + + +define KernelPackage/mlxsw-spectrum + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies Spectrum family support + DEPENDS:= \ + +kmod-mlxsw-core +kmod-mlxsw-pci +kmod-lib-objagg +kmod-lib-parman \ + +kmod-ip6-tunnel +kmod-ptp +kmod-sched-act-sample +kmod-vxlan + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko + KCONFIG:= \ + CONFIG_MLXSW_SPECTRUM \ + CONFIG_NET_SWITCHDEV=y \ + CONFIG_MLXSW_SPECTRUM_DCB=y \ + CONFIG_DCB=y \ + CONFIG_AMD_XGBE_DCB=n \ + CONFIG_IXGBE_DCB=n \ + CONFIG_I40E_DCB=n \ + CONFIG_QLCNIC_DCB=n \ + CONFIG_FSL_DPAA2_ETH_DCB=n \ + CONFIG_FSL_DPAA2_SWITCH=n + AUTOLOAD:=$(call AutoProbe,mlxsw_spectrum) +endef + +define KernelPackage/mlxsw-spectrum/description + This driver supports Mellanox Technologies + Spectrum/Spectrum-2/Spectrum-3/Spectrum-4 Ethernet Switch ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-spectrum)) + + define KernelPackage/net-selftests SUBMENU:=$(NETWORK_DEVICES_MENU) DEPENDS:=+kmod-libphy diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 055dca68182..face5794727 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -1046,31 +1046,33 @@ define KernelPackage/zram/description endef define KernelPackage/zram/config - choice - prompt "ZRAM Default compressor" - default ZRAM_DEF_COMP_LZORLE + if PACKAGE_kmod-zram + choice + prompt "ZRAM Default compressor" + default ZRAM_DEF_COMP_LZORLE - config ZRAM_DEF_COMP_LZORLE + config ZRAM_DEF_COMP_LZORLE bool "lzo-rle" select PACKAGE_kmod-lib-lzo - config ZRAM_DEF_COMP_LZO + config ZRAM_DEF_COMP_LZO bool "lzo" select PACKAGE_kmod-lib-lzo - config ZRAM_DEF_COMP_LZ4 + config ZRAM_DEF_COMP_LZ4 bool "lz4" select PACKAGE_kmod-lib-lz4 - config ZRAM_DEF_COMP_LZ4HC + config ZRAM_DEF_COMP_LZ4HC bool "lz4-hc" select PACKAGE_kmod-lib-lz4hc - config ZRAM_DEF_COMP_ZSTD + config ZRAM_DEF_COMP_ZSTD bool "zstd" select PACKAGE_kmod-lib-zstd - endchoice + endchoice + endif endef $(eval $(call KernelPackage,zram)) diff --git a/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch new file mode 100644 index 00000000000..6c476e90581 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch @@ -0,0 +1,117 @@ +From e8053643b6d70e23a634f14e4408f3a6d1d3a6bf Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 27 May 2023 09:04:48 +0000 +Subject: [PATCH] wifi: ath: add struct_group for struct ath_cycle_counters + +Add a struct_group to around all members in struct ath_cycle_counters. +It can help the compiler detect the intended bounds of the memcpy() and +memset(). + +This patch fixes the following build warning: + +In function 'fortify_memset_chk', + inlined from 'ath9k_ps_wakeup' at /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/backports-6.1.24/drivers/net/wireless/ath/ath9k/main.c:140:3: +./include/linux/fortify-string.h:314:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] + 314 | __write_overflow_field(p_size_field, size); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ath/ath.h | 10 ++++++---- + drivers/net/wireless/ath/ath5k/ani.c | 2 +- + drivers/net/wireless/ath/ath5k/base.c | 4 ++-- + drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +- + drivers/net/wireless/ath/ath9k/link.c | 2 +- + drivers/net/wireless/ath/ath9k/main.c | 4 ++-- + drivers/net/wireless/ath/hw.c | 2 +- + 7 files changed, 14 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/ath/ath.h ++++ b/drivers/net/wireless/ath/ath.h +@@ -43,10 +43,12 @@ struct ath_ani { + }; + + struct ath_cycle_counters { +- u32 cycles; +- u32 rx_busy; +- u32 rx_frame; +- u32 tx_frame; ++ struct_group(cnts, ++ u32 cycles; ++ u32 rx_busy; ++ u32 rx_frame; ++ u32 tx_frame; ++ ); + }; + + enum ath_device_state { +--- a/drivers/net/wireless/ath/ath5k/ani.c ++++ b/drivers/net/wireless/ath/ath5k/ani.c +@@ -379,7 +379,7 @@ ath5k_hw_ani_get_listen_time(struct ath5 + spin_lock_bh(&common->cc_lock); + + ath_hw_cycle_counters_update(common); +- memcpy(&as->last_cc, &common->cc_ani, sizeof(as->last_cc)); ++ memcpy(&as->last_cc.cnts, &common->cc_ani.cnts, sizeof(as->last_cc.cnts)); + + /* clears common->cc_ani */ + listen = ath_hw_get_listen_time(common); +--- a/drivers/net/wireless/ath/ath5k/base.c ++++ b/drivers/net/wireless/ath/ath5k/base.c +@@ -2985,8 +2985,8 @@ ath5k_reset(struct ath5k_hw *ah, struct + memset(&ah->survey, 0, sizeof(ah->survey)); + spin_lock_bh(&common->cc_lock); + ath_hw_cycle_counters_update(common); +- memset(&common->cc_survey, 0, sizeof(common->cc_survey)); +- memset(&common->cc_ani, 0, sizeof(common->cc_ani)); ++ memset(&common->cc_survey.cnts, 0, sizeof(common->cc_survey.cnts)); ++ memset(&common->cc_ani.cnts, 0, sizeof(common->cc_ani.cnts)); + spin_unlock_bh(&common->cc_lock); + + /* +--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c ++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c +@@ -665,7 +665,7 @@ ath5k_get_survey(struct ieee80211_hw *hw + ah->survey.time_rx += cc->rx_frame / div; + ah->survey.time_tx += cc->tx_frame / div; + } +- memset(cc, 0, sizeof(*cc)); ++ memset(&cc->cnts, 0, sizeof(cc->cnts)); + spin_unlock_bh(&common->cc_lock); + + memcpy(survey, &ah->survey, sizeof(*survey)); +--- a/drivers/net/wireless/ath/ath9k/link.c ++++ b/drivers/net/wireless/ath/ath9k/link.c +@@ -536,7 +536,7 @@ int ath_update_survey_stats(struct ath_s + if (cc->cycles > 0) + ret = cc->rx_busy * 100 / cc->cycles; + +- memset(cc, 0, sizeof(*cc)); ++ memset(&cc->cnts, 0, sizeof(cc->cnts)); + + ath_update_survey_nf(sc, pos); + +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -135,8 +135,8 @@ void ath9k_ps_wakeup(struct ath_softc *s + if (power_mode != ATH9K_PM_AWAKE) { + spin_lock(&common->cc_lock); + ath_hw_cycle_counters_update(common); +- memset(&common->cc_survey, 0, sizeof(common->cc_survey)); +- memset(&common->cc_ani, 0, sizeof(common->cc_ani)); ++ memset(&common->cc_survey.cnts, 0, sizeof(common->cc_survey.cnts)); ++ memset(&common->cc_ani.cnts, 0, sizeof(common->cc_ani.cnts)); + spin_unlock(&common->cc_lock); + } + +--- a/drivers/net/wireless/ath/hw.c ++++ b/drivers/net/wireless/ath/hw.c +@@ -183,7 +183,7 @@ int32_t ath_hw_get_listen_time(struct at + listen_time = (cc->cycles - cc->rx_frame - cc->tx_frame) / + (common->clockrate * 1000); + +- memset(cc, 0, sizeof(*cc)); ++ memset(&cc->cnts, 0, sizeof(cc->cnts)); + + return listen_time; + } diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index cc8221d7ce1..dd75390ee76 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -262,6 +262,11 @@ define KernelPackage/mt7921-firmware TITLE:=MediaTek MT7921 firmware endef +define KernelPackage/mt7922-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7922 firmware +endef + define KernelPackage/mt792x-common $(KernelPackage/mt76-default) TITLE:=MediaTek MT792x wireless driver common code @@ -597,6 +602,14 @@ define KernelPackage/mt7921-firmware/install $(1)/lib/firmware/mediatek endef +define KernelPackage/mt7922-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin \ + $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7922_1.bin \ + $(1)/lib/firmware/mediatek +endef + define Package/mt76-test/install mkdir -p $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin @@ -630,6 +643,7 @@ $(eval $(call KernelPackage,mt7916-firmware)) $(eval $(call KernelPackage,mt7981-firmware)) $(eval $(call KernelPackage,mt7986-firmware)) $(eval $(call KernelPackage,mt7921-firmware)) +$(eval $(call KernelPackage,mt7922-firmware)) $(eval $(call KernelPackage,mt792x-common)) $(eval $(call KernelPackage,mt792x-usb)) $(eval $(call KernelPackage,mt7921-common)) diff --git a/package/libs/libselinux/Makefile b/package/libs/libselinux/Makefile index 816e09f30ce..f90d4993c83 100644 --- a/package/libs/libselinux/Makefile +++ b/package/libs/libselinux/Makefile @@ -18,6 +18,8 @@ PKG_LICENSE_FILES:=LICENSE PKG_MAINTAINER:=Thomas Petazzoni PKG_CPE_ID:=cpe:/a:selinuxproject:libselinux +PKG_BUILD_FLAGS:=no-lto + HOST_BUILD_DEPENDS:=libsepol/host musl-fts/host pcre2/host include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/libsepol/Makefile b/package/libs/libsepol/Makefile index 613d19388d5..b1a34d293e0 100644 --- a/package/libs/libsepol/Makefile +++ b/package/libs/libsepol/Makefile @@ -16,6 +16,8 @@ PKG_HASH:=78fdaf69924db780bac78546e43d9c44074bad798c2c415d0b9bb96d065ee8a2 PKG_MAINTAINER:=Thomas Petazzoni PKG_CPE_ID:=cpe:/a:selinuxproject:libsepol +PKG_BUILD_FLAGS:=no-lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 64048a963a4..73ec5e198da 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:=4 +PKG_RELEASE:=5 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 88f01caa93e..593840cca88 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -571,7 +571,7 @@ function iface_load_config(filename) let bss; let line; - while ((line = trim(f.read("line"))) != null) { + while ((line = rtrim(f.read("line"), "\n")) != null) { let val = split(line, "=", 2); if (!val[0]) continue; @@ -593,7 +593,7 @@ function iface_load_config(filename) push(config.radio.data, line); } - while ((line = trim(f.read("line"))) != null) { + while ((line = rtrim(f.read("line"), "\n")) != null) { if (line == "#default_macaddr") bss.default_macaddr = true; diff --git a/package/network/services/hostapd/patches/135-mbedtls-fix-owe-association.patch b/package/network/services/hostapd/patches/135-mbedtls-fix-owe-association.patch new file mode 100644 index 00000000000..0c29432d3f8 --- /dev/null +++ b/package/network/services/hostapd/patches/135-mbedtls-fix-owe-association.patch @@ -0,0 +1,91 @@ +The code for hostapd-mbedtls did not work when used for OWE association. + +When handling association requests, the buffer offsets and length assumptions were incorrect, leading to never calculating the y point, thus denying association. + +Also when crafting the association response, the buffer contained the trailing key-type. + +Fix up both issues to adhere to the specification and make hostapd-mbedtls work with the OWE security type. + +--- a/src/crypto/crypto_mbedtls.c ++++ b/src/crypto/crypto_mbedtls.c +@@ -2299,25 +2299,30 @@ struct crypto_ecdh * crypto_ecdh_init2(i + struct wpabuf * crypto_ecdh_get_pubkey(struct crypto_ecdh *ecdh, int inc_y) + { + mbedtls_ecp_group *grp = &ecdh->grp; +- size_t len = CRYPTO_EC_plen(grp); ++ size_t prime_len = CRYPTO_EC_plen(grp); ++ size_t output_len = prime_len; ++ u8 output_offset = 0; ++ u8 buf[256]; ++ + #ifdef MBEDTLS_ECP_MONTGOMERY_ENABLED + /* len */ + #endif + #ifdef MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED +- if (mbedtls_ecp_get_type(grp) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS) +- len = inc_y ? len*2+1 : len+1; ++ if (mbedtls_ecp_get_type(grp) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS) { ++ output_len = inc_y ? prime_len * 2 + 1 : prime_len + 1; ++ output_offset = 1; ++ } + #endif +- struct wpabuf *buf = wpabuf_alloc(len); +- if (buf == NULL) ++ ++ if (output_len > sizeof(buf)) + return NULL; ++ + inc_y = inc_y ? MBEDTLS_ECP_PF_UNCOMPRESSED : MBEDTLS_ECP_PF_COMPRESSED; +- if (mbedtls_ecp_point_write_binary(grp, &ecdh->Q, inc_y, &len, +- wpabuf_mhead_u8(buf), len) == 0) { +- wpabuf_put(buf, len); +- return buf; ++ if (mbedtls_ecp_point_write_binary(grp, &ecdh->Q, inc_y, &output_len, ++ buf, output_len) == 0) { ++ return wpabuf_alloc_copy(buf + output_offset, output_len - output_offset); + } + +- wpabuf_free(buf); + return NULL; + } + +@@ -2379,10 +2384,7 @@ struct wpabuf * crypto_ecdh_set_peerkey( + os_memcpy(buf+2, key, len); + } + len >>= 1; /*(repurpose len to prime_len)*/ +- } +- else if (key[0] == 0x02 || key[0] == 0x03) { /* (inc_y == 0) */ +- --len; /*(repurpose len to prime_len)*/ +- ++ } else { /* (inc_y == 0) */ + /* mbedtls_ecp_point_read_binary() does not currently support + * MBEDTLS_ECP_PF_COMPRESSED format (buf[1] = 0x02 or 0x03) + * (returns MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE) */ +@@ -2390,22 +2392,21 @@ struct wpabuf * crypto_ecdh_set_peerkey( + /* derive y, amend buf[] with y for UNCOMPRESSED format */ + if (sizeof(buf)-2 < len*2 || len == 0) + return NULL; ++ + buf[0] = (u8)(1+len*2); + buf[1] = 0x04; ++ os_memcpy(buf+2, key, len); ++ + mbedtls_mpi bn; + mbedtls_mpi_init(&bn); +- int ret = mbedtls_mpi_read_binary(&bn, key+1, len) +- || crypto_mbedtls_short_weierstrass_derive_y(grp, &bn, +- key[0] & 1) ++ int ret = mbedtls_mpi_read_binary(&bn, key, len) ++ || crypto_mbedtls_short_weierstrass_derive_y(grp, &bn, 0) + || mbedtls_mpi_write_binary(&bn, buf+2+len, len); + mbedtls_mpi_free(&bn); + if (ret != 0) + return NULL; + } + +- if (key[0] == 0) /*(repurpose len to prime_len)*/ +- len = CRYPTO_EC_plen(grp); +- + if (mbedtls_ecdh_read_public(&ecdh->ctx, buf, buf[0]+1)) + return NULL; + } diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 0d6d76fc080..aded1b7b1fd 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -20,7 +20,7 @@ PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared PKG_INSTALL:=1 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections no-lto PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0 PKG_CPE_ID:=cpe:/a:netfilter_core_team:iptables diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index e5add395ff9..c6a14956fd1 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -17,6 +17,8 @@ PKG_MIRROR_HASH:=5eddf584a1c3ed5637162d6bfc573ed1ce3691fcb38bdd55bf9f1e11e82ccc4 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=no-lto + IWINFO_ABI_VERSION:=20230701 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index e7de3ef77d1..26b588c7ef5 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git -PKG_SOURCE_DATE:=2022-10-20 -PKG_SOURCE_VERSION:=c8c9f105aa2d03146664fa1cc1bd2c837aa4aadd -PKG_MIRROR_HASH:=5fd1b3c8f5e7c4b52ed81a0c69504fbf39e69c0ecd1f8278969cf22f57fdb2a9 +PKG_SOURCE_DATE:=2023-10-29 +PKG_SOURCE_VERSION:=eea292401c388a4eb59c0caf5d00aa046c6059f4 +PKG_MIRROR_HASH:=744f7e2010bd16ca08b03551287a0e1d119e1e6e099f8abf935328d3d1344893 PKG_MAINTAINER:=Matti Laakso PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index eab7f1ea13d..f8e655455a5 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -38,6 +38,7 @@ proto_qmi_setup() { local ip4table ip6table local cid_4 pdh_4 cid_6 pdh_6 local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 + local profile_pdptype json_get_vars device apn v6apn auth username password pincode delay modes json_get_vars pdptype profile v6profile dhcp dhcpv6 autoconnect plmn ip4table @@ -98,6 +99,37 @@ proto_qmi_setup() { fi done + # Check if UIM application is stuck in illegal state + local uim_state_timeout=0 + while true; do + json_load "$(uqmi -s -d "$device" --uim-get-sim-state)" + json_get_var card_application_state card_application_state + + # SIM card is either completely absent or state is labeled as illegal + # Try to power-cycle the SIM card to recover from this state + if [ -z "$card_application_state" -o "$card_application_state" = "illegal" ]; then + echo "SIM in illegal state - Power-cycling SIM" + + # Try to reset SIM application + uqmi -d "$device" --uim-power-off --uim-slot 1 + sleep 3 + uqmi -d "$device" --uim-power-on --uim-slot 1 + + if [ "$uim_state_timeout" -lt "$timeout" ] || [ "$timeout" = "0" ]; then + let uim_state_timeout++ + sleep 1 + continue + fi + + # Recovery failed + proto_notify_error "$interface" SIM_ILLEGAL_STATE + proto_block_restart "$interface" + return 1 + else + break + fi + done + if uqmi -s -d "$device" --uim-get-sim-state | grep -q '"Not supported"\|"Invalid QMI command"' && uqmi -s -d "$device" --get-pin-status | grep -q '"Not supported"\|"Invalid QMI command"' ; then [ -n "$pincode" ] && { @@ -185,15 +217,6 @@ proto_qmi_setup() { fi fi - if [ -n "$mcc" -a -n "$mnc" ]; then - uqmi -s -d "$device" --set-plmn --mcc "$mcc" --mnc "$mnc" > /dev/null 2>&1 || { - echo "Unable to set PLMN" - proto_notify_error "$interface" PLMN_FAILED - proto_block_restart "$interface" - return 1 - } - fi - # Cleanup current state if any uqmi -s -d "$device" --stop-network 0xffffffff --autoconnect > /dev/null 2>&1 uqmi -s -d "$device" --set-ip-family ipv6 --stop-network 0xffffffff --autoconnect > /dev/null 2>&1 @@ -221,8 +244,25 @@ proto_qmi_setup() { uqmi -s -d "$device" --network-register > /dev/null 2>&1 + # PLMN selection must happen after the call to network-register + if [ -n "$mcc" -a -n "$mnc" ]; then + uqmi -s -d "$device" --set-plmn --mcc "$mcc" --mnc "$mnc" > /dev/null 2>&1 || { + echo "Unable to set PLMN" + proto_notify_error "$interface" PLMN_FAILED + proto_block_restart "$interface" + return 1 + } + fi + + [ -n "$modes" ] && { + uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1 + sleep 3 + # Scan network to not rely on registration-timeout after RAT change + uqmi -s -d "$device" --network-scan > /dev/null 2>&1 + } + echo "Waiting for network registration" - sleep 1 + sleep 5 local registration_timeout=0 local registration_state="" while true; do @@ -247,11 +287,9 @@ proto_qmi_setup() { fi proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED - proto_block_restart "$interface" return 1 done - [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1 echo "Starting network $interface" @@ -259,6 +297,13 @@ proto_qmi_setup() { [ "$pdptype" = "ip" -o "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] || pdptype="ip" + # Configure PDP type and APN for profile 1. + # In case GGSN rejects IPv4v6 PDP, modem might not be able to + # establish a non-LTE data session. + profile_pdptype="$pdptype" + [ "$profile_pdptype" = "ip" ] && profile_pdptype="ipv4" + uqmi -s -d "$device" --modify-profile "3gpp,1" --apn "$apn" --pdp-type "$profile_pdptype" > /dev/null 2>&1 + if [ "$pdptype" = "ip" ]; then [ -z "$autoconnect" ] && autoconnect=1 [ "$autoconnect" = 0 ] && autoconnect="" diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index 9496ffb366b..46e7bb0dcdb 100644 --- a/package/utils/lua/Makefile +++ b/package/utils/lua/Makefile @@ -21,6 +21,8 @@ PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYRIGHT PKG_CPE_ID:=cpe:/a:lua:lua +PKG_BUILD_FLAGS:=no-lto + HOST_PATCH_DIR := ./patches-host include $(INCLUDE_DIR)/package.mk diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor-nand.dts b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor-nand.dts new file mode 100644 index 00000000000..297093c09a1 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor-nand.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "qca9531_glinet_gl-s200.dtsi" + +/ { + compatible = "glinet,gl-s200-nor-nand", "qca,qca9531"; + model = "GL.iNet GL-S200 (NOR/NAND)"; +}; + +&nor_partitions { + partition@60000 { + label = "kernel"; + reg = <0x060000 0x400000>; + }; + parition@460000 { + label = "nor_reserved"; + reg = <0x460000 0xb80000>; + }; + parition@fe0000 { + label = "log"; + reg = <0xfe0000 0x020000>; + }; +}; + +&flash_nand { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor.dts b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor.dts new file mode 100644 index 00000000000..e1ca4eaf738 --- /dev/null +++ b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "qca9531_glinet_gl-s200.dtsi" + +/ { + compatible = "glinet,gl-s200-nor", "qca,qca9531"; + model = "GL.iNet GL-S200 (NOR)"; +}; + +&nor_partitions { + partition@60000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x060000 0xf80000>; + }; + partition@fe0000 { + label = "log"; + reg = <0xfe0000 0x020000>; + }; +}; diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-s200.dtsi b/target/linux/ath79/dts/qca9531_glinet_gl-s200.dtsi new file mode 100644 index 00000000000..44bb83af64a --- /dev/null +++ b/target/linux/ath79/dts/qca9531_glinet_gl-s200.dtsi @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca953x.dtsi" + +/ { + compatible = "glinet,gl-s200", "qca,qca9531"; + model = "GL.iNet GL-S200"; + + aliases { + label-mac-device = ð0; + }; + + keys { + compatible = "gpio-keys"; + + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + reset { + label = "reset"; + linux,code = ; + linux,input-type = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + switch { + label = "switch"; + linux,code = ; + linux,input-type = ; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + blue_led { + label = "gl-s200:blue"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + white_led { + label = "gl-s200:white"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + orange_led { + label = "gl-s200:orange"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + gpio_zigbee_reset { + gpio-export,name = "gpio1"; + gpio-export,output = <1>; + gpio-export,direction_may_change; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; + + gpio_zwave_reset { + gpio-export,name = "gpio2"; + gpio-export,output = <1>; + gpio-export,direction_may_change; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + }; + + gpio_zigbee_upgrade { + gpio-export,name = "gpio11"; + gpio-export,output = <1>; + gpio-export,direction_may_change; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + + gpio_zwave_upgrade { + gpio-export,name = "gpio17"; + gpio-export,output = <1>; + gpio-export,direction_may_change; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&gpio { + ngpios = <17>; + gpio-line-names = + "","reset-zigbee","reset-zwave","reset", + "LED-orange","","","","","","", + "upgrade-zigbee","LED-white","LED-blue", + "switch","","","upgrade-zwave"; +}; + +&pcie0 { + status = "okay"; +}; + +&uart { + status = "okay"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + nor_partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + art: partition@50000 { + label = "art"; + reg = <0x050000 0x010000>; + read-only; + + compatible = "nvmem-cells"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_wan_lan: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; + + calibration_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + }; + }; + }; + }; + + flash_nand: flash@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <25000000>; + status = "disabled"; + + nand_partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + nand_ubi: partition@0 { + label = "ubi"; + reg = <0x000000 0x8000000>; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; + + nvmem-cells = <&macaddr_wan_lan 0>; + nvmem-cell-names = "mac-address"; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_wan_lan 1>; + nvmem-cell-names = "mac-address"; +}; + +&wmac { + status = "okay"; + nvmem-cells = <&calibration_art_1000>; + nvmem-cell-names = "calibration"; +}; diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts index b7ac902003c..1b860dbf2d5 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts @@ -13,10 +13,11 @@ &keys { rfkill { + label = "rfkill"; gpios = <&gpio 23 GPIO_ACTIVE_LOW>; linux,code = ; linux,input-type = ; - debounce-interval = <60>; + debounce-interval = <1000>; }; }; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index fd324507023..5c9e190e193 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -203,6 +203,35 @@ define Device/glinet_gl-e750 endef TARGET_DEVICES += glinet_gl-e750 +define Device/glinet_gl-s200-common + SOC := qca9531 + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-S200 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-serial-ch341 + SUPPORTED_DEVICES += gl-s200 glinet,gl-s200 +endef + +define Device/glinet_gl-s200-nor + $(Device/glinet_gl-s200-common) + DEVICE_VARIANT := NOR + IMAGE_SIZE := 16000k +endef +TARGET_DEVICES += glinet_gl-s200-nor + +define Device/glinet_gl-s200-nor-nand + $(Device/glinet_gl-s200-common) + DEVICE_VARIANT := NOR/NAND + KERNEL_SIZE := 4096k + BLOCKSIZE := 128k + PAGESIZE := 2048 + VID_HDR_OFFSET := 2048 + IMAGES += factory.img + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi + SUPPORTED_DEVICES += gl-s200 glinet,gl-s200 +endef +TARGET_DEVICES += glinet_gl-s200-nor-nand + define Device/glinet_gl-xe300 SOC := qca9531 DEVICE_VENDOR := GL.iNet diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index 60f085d3783..f5dda414c2f 100644 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -40,6 +40,8 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "6@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" ;; + glinet,gl-s200-nor|\ + glinet,gl-s200-nor-nand|\ netgear,pgzng1) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; diff --git a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh index 5a4f76ba516..117b2f900a2 100644 --- a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh @@ -20,6 +20,8 @@ platform_do_upgrade() { ;; glinet,gl-ar750s-nor|\ glinet,gl-ar750s-nor-nand|\ + glinet,gl-s200-nor|\ + glinet,gl-s200-nor-nand|\ glinet,gl-x1200-nor|\ glinet,gl-x1200-nor-nand) nand_nor_do_upgrade "$1" diff --git a/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch index 7db6346c37e..36f5331bd01 100644 --- a/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -847,6 +847,17 @@ out_error: +@@ -870,6 +870,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch index 3546696a23a..119868eddb3 100644 --- a/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch @@ -33,7 +33,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->flags = MTD_CAP_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -840,6 +840,17 @@ out_error: +@@ -863,6 +863,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index de619f60b68..bc2509ff478 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -3878,6 +3878,7 @@ CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" # CONFIG_MTD_SPLIT_LZMA_FW is not set # CONFIG_MTD_SPLIT_MINOR_FW is not set # CONFIG_MTD_SPLIT_SEAMA_FW is not set +# CONFIG_MTD_SPLIT_SEIL_FW is not set CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y CONFIG_MTD_SPLIT_SUPPORT=y # CONFIG_MTD_SPLIT_TPLINK_FW is not set diff --git a/target/linux/generic/config-6.1 b/target/linux/generic/config-6.1 index ce2e4f2954b..cc339e476f9 100644 --- a/target/linux/generic/config-6.1 +++ b/target/linux/generic/config-6.1 @@ -4011,6 +4011,7 @@ CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" # CONFIG_MTD_SPLIT_LZMA_FW is not set # CONFIG_MTD_SPLIT_MINOR_FW is not set # CONFIG_MTD_SPLIT_SEAMA_FW is not set +# CONFIG_MTD_SPLIT_SEIL_FW is not set CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y CONFIG_MTD_SPLIT_SUPPORT=y # CONFIG_MTD_SPLIT_TPLINK_FW is not set diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig b/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig index 895150e9cb3..17d590890da 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig @@ -105,3 +105,8 @@ config MTD_SPLIT_H3C_VFS bool "Parser finding rootfs appended to H3C VFS" depends on MTD_SPLIT_SUPPORT select MTD_SPLIT + +config MTD_SPLIT_SEIL_FW + bool "IIJ SEIL firmware parser" + depends on MTD_SPLIT_SUPPORT + select MTD_SPLIT diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile b/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile index a969c336aae..e9d63c83325 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_MTD_SPLIT_BCM63XX_FW) += mtdsplit_bcm63xx.o obj-$(CONFIG_MTD_SPLIT_BCM_WFI_FW) += mtdsplit_bcm_wfi.o obj-$(CONFIG_MTD_SPLIT_CFE_BOOTFS) += mtdsplit_cfe_bootfs.o obj-$(CONFIG_MTD_SPLIT_SEAMA_FW) += mtdsplit_seama.o +obj-$(CONFIG_MTD_SPLIT_SEIL_FW) += mtdsplit_seil.o obj-$(CONFIG_MTD_SPLIT_SQUASHFS_ROOT) += mtdsplit_squashfs.o obj-$(CONFIG_MTD_SPLIT_UIMAGE_FW) += mtdsplit_uimage.o obj-$(CONFIG_MTD_SPLIT_FIT_FW) += mtdsplit_fit.o diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seil.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seil.c new file mode 100644 index 00000000000..e58bb49b23f --- /dev/null +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seil.c @@ -0,0 +1,191 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* a mtdsplit driver for IIJ SEIL devices */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mtdsplit.h" + +#define NR_PARTS 2 +#define SEIL_VFMT 1 +#define LDR_ENV_PART_NAME "bootloader-env" +#define LDR_ENV_KEY_BOOTDEV "BOOTDEV" + +struct seil_header { + uint64_t id; /* Identifier */ + uint8_t copy[80]; /* Copyright */ + uint32_t dcrc; /* Data CRC Checksum */ + uint32_t vfmt; /* Image Version Format */ + uint32_t vmjr; /* Image Version Major */ + uint32_t vmnr; /* Image Version Minor */ + uint8_t vrel[32]; /* Image Version Release */ + uint32_t dxor; /* xor value for Data? */ + uint32_t dlen; /* Data Length */ +}; + +/* + * check whether the current mtd device is active or not + * + * example of BOOTDEV value (IIJ SA-W2): + * - "flash" : primary image on flash + * - "rescue" : secondary image on flash + * - "usb" : usb storage + * - "lan0/1" : network + */ +static bool seil_bootdev_is_active(struct device_node *np) +{ + struct mtd_info *env_mtd; + char *buf, *var, *value, *eq; + const char *devnm; + size_t rdlen; + int ret; + + /* + * read bootdev name of the partition + * if doesn't exist, return true and skip checking of active device + */ + ret = of_property_read_string(np, "iij,bootdev-name", &devnm); + if (ret == -EINVAL) + return true; + else if (ret < 0) + return false; + + env_mtd = get_mtd_device_nm(LDR_ENV_PART_NAME); + if (IS_ERR(env_mtd)) { + pr_err("failed to get mtd device \"%s\"", LDR_ENV_PART_NAME); + return false; + } + + buf = vmalloc(env_mtd->size); + if (!buf) + return false; + + ret = mtd_read(env_mtd, 0, env_mtd->size, &rdlen, buf); + if (ret || rdlen != env_mtd->size) { + pr_err("failed to read from mtd (%d)\n", ret); + ret = 0; + goto exit_vfree; + } + + for (var = buf, ret = false; + var < buf + env_mtd->size && *var; + var = value + strlen(value) + 1) { + eq = strchr(var, '='); + if (!eq) + break; + *eq = '\0'; + value = eq + 1; + + pr_debug("ENV: %s=%s\n", var, value); + if (!strcmp(var, LDR_ENV_KEY_BOOTDEV)) { + ret = !strcmp(devnm, value); + break; + } + } + +exit_vfree: + vfree(buf); + + return ret; +} + +static int mtdsplit_parse_seil_fw(struct mtd_info *master, + const struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +{ + struct device_node *np = mtd_get_of_node(master); + struct mtd_partition *parts; + struct seil_header header; + size_t image_size = 0; + size_t rootfs_offset; + size_t hdrlen = sizeof(header); + size_t retlen; + int ret; + u64 id; + + if (!seil_bootdev_is_active(np)) + return -ENODEV; + + ret = of_property_read_u64(np, "iij,seil-id", &id); + if (ret) { + pr_err("failed to get iij,seil-id from dt\n"); + return ret; + } + pr_debug("got seil-id=0x%016llx from dt\n", id); + + parts = kcalloc(NR_PARTS, sizeof(*parts), GFP_KERNEL); + if (!parts) + return -ENOMEM; + + ret = mtd_read(master, 0, hdrlen, &retlen, (void *)&header); + if (ret) + goto err_free_parts; + + if (retlen != hdrlen) { + ret = -EIO; + goto err_free_parts; + } + + if (be64_to_cpu(header.id) != id || + be32_to_cpu(header.vfmt) != SEIL_VFMT) { + pr_debug("no valid seil image found in \"%s\"\n", master->name); + ret = -ENODEV; + goto err_free_parts; + } + + image_size = hdrlen + be32_to_cpu(header.dlen); + if (image_size > master->size) { + pr_err("seil image exceeds MTD device \"%s\"\n", master->name); + ret = -EINVAL; + goto err_free_parts; + } + + /* find the roots after the seil image */ + ret = mtd_find_rootfs_from(master, image_size, + master->size, &rootfs_offset, NULL); + if (ret || (master->size - rootfs_offset) == 0) { + pr_debug("no rootfs after seil image in \"%s\"\n", + master->name); + ret = -ENODEV; + goto err_free_parts; + } + + parts[0].name = KERNEL_PART_NAME; + parts[0].offset = 0; + parts[0].size = rootfs_offset; + + parts[1].name = ROOTFS_PART_NAME; + parts[1].offset = rootfs_offset; + parts[1].size = master->size - rootfs_offset; + + *pparts = parts; + return NR_PARTS; + +err_free_parts: + kfree(parts); + return ret; +} + +static const struct of_device_id mtdsplit_seil_fw_of_match_table[] = { + { .compatible = "iij,seil-firmware" }, + {}, +}; +MODULE_DEVICE_TABLE(of, mtdsplit_seil_fw_of_match_table); + +static struct mtd_part_parser mtdsplit_seil_fw_parser = { + .owner = THIS_MODULE, + .name = "seil-fw", + .of_match_table = mtdsplit_seil_fw_of_match_table, + .parse_fn = mtdsplit_parse_seil_fw, + .type = MTD_PARSER_TYPE_FIRMWARE, +}; + +module_mtd_part_parser(mtdsplit_seil_fw_parser); 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 62737aa779f..1df6f2f18bf 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" -@@ -1083,6 +1084,8 @@ int mtd_device_parse_register(struct mtd +@@ -1106,6 +1107,8 @@ int mtd_device_parse_register(struct mtd register_reboot_notifier(&mtd->reboot_notifier); } 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 947b2c262f3..ed46301b0ee 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 -@@ -761,7 +761,8 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -784,7 +784,8 @@ int add_mtd_device(struct mtd_info *mtd) mutex_unlock(&mtd_table_mutex); diff --git a/target/linux/generic/hack-6.1/402-mtd-blktrans-call-add-disks-after-mtd-device.patch b/target/linux/generic/hack-6.1/402-mtd-blktrans-call-add-disks-after-mtd-device.patch index 295da11eb48..c82ca3edd84 100644 --- a/target/linux/generic/hack-6.1/402-mtd-blktrans-call-add-disks-after-mtd-device.patch +++ b/target/linux/generic/hack-6.1/402-mtd-blktrans-call-add-disks-after-mtd-device.patch @@ -91,7 +91,7 @@ Signed-off-by: Daniel Golle #include "mtdcore.h" -@@ -1075,6 +1076,8 @@ int mtd_device_parse_register(struct mtd +@@ -1098,6 +1099,8 @@ int mtd_device_parse_register(struct mtd register_reboot_notifier(&mtd->reboot_notifier); } diff --git a/target/linux/generic/hack-6.1/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch b/target/linux/generic/hack-6.1/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch index 8e8e5cea8d6..7c7e4c814e6 100644 --- a/target/linux/generic/hack-6.1/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch +++ b/target/linux/generic/hack-6.1/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 -@@ -750,7 +750,8 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -773,7 +773,8 @@ int add_mtd_device(struct mtd_info *mtd) mutex_unlock(&mtd_table_mutex); diff --git a/target/linux/generic/pending-5.15/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch b/target/linux/generic/pending-5.15/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch new file mode 100644 index 00000000000..650e10a3a5d --- /dev/null +++ b/target/linux/generic/pending-5.15/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch @@ -0,0 +1,48 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 31 Oct 2023 15:51:01 +0100 +Subject: [PATCH] mtd: don't register NVMEM devices for partitions with custom + drivers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes issue exposed by upstream commit f4cf4e5db331 ("Revert +"nvmem: add new config option""). + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/mtdcore.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -537,6 +537,29 @@ static int mtd_nvmem_add(struct mtd_info + struct device_node *node = mtd_get_of_node(mtd); + struct nvmem_config config = {}; + ++ /* ++ * Do NOT register NVMEM device for any partition that is meant to be ++ * handled by a U-Boot env driver. That would result in associating two ++ * different NVMEM devices with the same OF node. ++ * ++ * An example of unwanted behaviour of above (forwardtrace): ++ * of_get_mac_addr_nvmem() ++ * of_nvmem_cell_get() ++ * __nvmem_device_get() ++ * ++ * We can't have __nvmem_device_get() return "mtdX" NVMEM device instead ++ * of U-Boot env NVMEM device. That would result in failing to find ++ * NVMEM cell. ++ * ++ * This issue seems to affect U-Boot env case only and will go away with ++ * switch to NVMEM layouts. ++ */ ++ if (of_device_is_compatible(node, "u-boot,env") || ++ of_device_is_compatible(node, "u-boot,env-redundant-bool") || ++ of_device_is_compatible(node, "u-boot,env-redundant-count") || ++ of_device_is_compatible(node, "brcm,env")) ++ return 0; ++ + config.id = -1; + config.dev = &mtd->dev; + config.name = dev_name(&mtd->dev); diff --git a/target/linux/generic/pending-6.1/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch b/target/linux/generic/pending-6.1/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch new file mode 100644 index 00000000000..42b5a564b15 --- /dev/null +++ b/target/linux/generic/pending-6.1/401-mtd-don-t-register-NVMEM-devices-for-partitions-with.patch @@ -0,0 +1,48 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 31 Oct 2023 15:51:01 +0100 +Subject: [PATCH] mtd: don't register NVMEM devices for partitions with custom + drivers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes issue exposed by upstream commit f4cf4e5db331 ("Revert +"nvmem: add new config option""). + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/mtdcore.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -519,6 +519,29 @@ static int mtd_nvmem_add(struct mtd_info + struct device_node *node = mtd_get_of_node(mtd); + struct nvmem_config config = {}; + ++ /* ++ * Do NOT register NVMEM device for any partition that is meant to be ++ * handled by a U-Boot env driver. That would result in associating two ++ * different NVMEM devices with the same OF node. ++ * ++ * An example of unwanted behaviour of above (forwardtrace): ++ * of_get_mac_addr_nvmem() ++ * of_nvmem_cell_get() ++ * __nvmem_device_get() ++ * ++ * We can't have __nvmem_device_get() return "mtdX" NVMEM device instead ++ * of U-Boot env NVMEM device. That would result in failing to find ++ * NVMEM cell. ++ * ++ * This issue seems to affect U-Boot env case only and will go away with ++ * switch to NVMEM layouts. ++ */ ++ if (of_device_is_compatible(node, "u-boot,env") || ++ of_device_is_compatible(node, "u-boot,env-redundant-bool") || ++ of_device_is_compatible(node, "u-boot,env-redundant-count") || ++ of_device_is_compatible(node, "brcm,env")) ++ return 0; ++ + config.id = -1; + config.dev = &mtd->dev; + config.name = dev_name(&mtd->dev); diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts new file mode 100644 index 00000000000..2e9114f99c0 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts @@ -0,0 +1,382 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "ASUS TUF-AX6000"; + compatible = "asus,tuf-ax6000", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = "ubi.mtd=UBI_DEV"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + mesh { + label = "wps"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wlan { + label = "white:wlan"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + + led_system: system { + label = "white:system"; + gpios = <&pio 11 GPIO_ACTIVE_HIGH>; + }; + + wan-red { + label = "red:wan"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + cover-blue { + label = "blue:cover"; + gpios = <&pio 20 GPIO_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; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + /* LAN */ + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + /* WAN */ + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <50000>; + reset-post-delay-us = <20000>; + + phy5: phy@5 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + + mxl,led-config = <0x03f0 0x0 0x0 0x0>; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + + /* LED0: CONN (WAN white) */ + mxl,led-config = <0x03f0 0x0 0x0 0x0>; + }; + + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&pcie_phy { + status = "okay"; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <20000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x400000>; + read-only; + }; + + partition@400000 { + label = "UBI_DEV"; + reg = <0x400000 0xfc00000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <4>; + label = "lan1"; + }; + + port@2 { + reg = <3>; + label = "lan2"; + }; + + port@3 { + reg = <2>; + label = "lan3"; + }; + + port@4 { + reg = <1>; + label = "lan4"; + }; + + port@5 { + reg = <5>; + label = "lan5"; + phy-mode = "2500base-x"; + phy-handle = <&phy5>; + + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy@1 { + reg = <1>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@2 { + reg = <2>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@3 { + reg = <3>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + + phy@4 { + reg = <4>; + + mediatek,led-config = < + 0x21 0x8009 /* BASIC_CTRL */ + 0x22 0x0c00 /* ON_DURATION */ + 0x23 0x1400 /* BLINK_DURATION */ + 0x24 0x8000 /* LED0_ON_CTRL */ + 0x25 0x0000 /* LED0_BLINK_CTRL */ + 0x26 0xc007 /* LED1_ON_CTRL */ + 0x27 0x003f /* LED1_BLINK_CTRL */ + >; + }; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; \ No newline at end of file diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index d9fa4773535..aad1d67ff6f 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -15,6 +15,9 @@ mediatek_setup_interfaces() mediatek,mt7981-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; + asus,tuf-ax6000) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 + ;; netgear,wax220|\ ubnt,unifi-6-plus|\ zyxel,nwa50ax-pro) @@ -78,7 +81,8 @@ mediatek_setup_macs() local label_mac="" case $board in - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) wan_mac="${addr}" diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index e7826373489..63c1ec31b7a 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -45,7 +45,8 @@ case "$FIRMWARE" in ;; "mediatek/mt7986_eeprom_mt7976_dbdc.bin") case "$board" in - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" caldata_extract_ubi "Factory" 0x0 0x1000 ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 5de4061c948..395cc0f2dc5 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -16,7 +16,8 @@ case "$board" in [ "$PHYNBR" = "1" ] && cat $key_path/6gMAC > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "2" ] && cat $key_path/5gMAC > /sys${DEVPATH}/macaddress ;; - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index 69d0ab6c60c..d770b136432 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -10,7 +10,8 @@ preinit_set_mac_address() { ip link set dev game address "$(cat $key_path/LANMAC)" ip link set dev eth1 address "$(cat $key_path/WANMAC)" ;; - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) ip link set dev eth0 address "$addr" diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index c8eea2eca26..b7b9d659932 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -56,7 +56,8 @@ platform_do_upgrade() { CI_ROOTPART="rootfs" emmc_do_upgrade "$1" ;; - asus,tuf-ax4200) + asus,tuf-ax4200|\ + asus,tuf-ax6000) CI_UBIPART="UBI_DEV" CI_KERNPART="linux" nand_do_upgrade "$1" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index f7b838cf3bf..e501ac3c744 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -121,6 +121,22 @@ define Device/asus_tuf-ax4200 endef TARGET_DEVICES += asus_tuf-ax4200 +define Device/asus_tuf-ax6000 + DEVICE_VENDOR := ASUS + DEVICE_MODEL := TUF-AX6000 + DEVICE_DTS := mt7986a-asus-tuf-ax6000 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware + IMAGES := sysupgrade.bin + KERNEL := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += asus_tuf-ax6000 + define Device/acer_predator-w6 DEVICE_VENDOR := Acer DEVICE_MODEL := Predator W6 diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index 147ae0b31f7..5c176d4963d 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -30,6 +30,9 @@ mvebu_setup_interfaces() fortinet,fg-50e) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "eth1 eth2" ;; + iij,sa-w2) + ucidef_set_interfaces_lan_wan "ge1_0 ge1_1 ge1_2 ge1_3" "ge0" + ;; iptime,nas1dual) ucidef_set_interface_lan "eth0 eth1" "dhcp" ;; diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 8432fdbfc81..7f45aa8a915 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -56,6 +56,20 @@ platform_do_upgrade() { fortinet,fg-50e) fortinet_do_upgrade "$1" ;; + iij,sa-w2) + local envmtd=$(find_mtd_part "bootloader-env") + local bootdev=$(grep "BOOTDEV=" "$envmtd") + case "${bootdev#*=}" in + flash) PART_NAME="firmware" ;; + rescue) PART_NAME="rescue" ;; + *) + echo "invalid BOOTDEV is set (\"${bootdev#*=}\")" + umount -a + reboot -f + ;; + esac + default_do_upgrade "$1" + ;; linksys,wrt1200ac|\ linksys,wrt1900ac-v1|\ linksys,wrt1900ac-v2|\ diff --git a/target/linux/mvebu/cortexa9/config-5.15 b/target/linux/mvebu/cortexa9/config-5.15 index 88a2f14c026..e666dd486fb 100644 --- a/target/linux/mvebu/cortexa9/config-5.15 +++ b/target/linux/mvebu/cortexa9/config-5.15 @@ -1,3 +1,4 @@ CONFIG_LED_TRIGGER_PHY=y +CONFIG_MTD_SPLIT_SEIL_FW=y CONFIG_PHY_MVEBU_A38X_COMPHY=y CONFIG_RTC_DRV_MV=y diff --git a/target/linux/mvebu/cortexa9/config-6.1 b/target/linux/mvebu/cortexa9/config-6.1 index b78c734fada..b2625c3b32e 100644 --- a/target/linux/mvebu/cortexa9/config-6.1 +++ b/target/linux/mvebu/cortexa9/config-6.1 @@ -3,6 +3,7 @@ CONFIG_CPU_LITTLE_ENDIAN=y CONFIG_CURRENT_POINTER_IN_TPIDRURO=y CONFIG_IRQSTACKS=y CONFIG_LED_TRIGGER_PHY=y +CONFIG_MTD_SPLIT_SEIL_FW=y CONFIG_PHY_MVEBU_A38X_COMPHY=y CONFIG_RTC_DRV_MV=y CONFIG_THREAD_INFO_IN_TASK=y diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-380-iij-sa-w2.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-380-iij-sa-w2.dts new file mode 100644 index 00000000000..d2483611ae6 --- /dev/null +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-380-iij-sa-w2.dts @@ -0,0 +1,390 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include +#include +#include +#include "armada-380.dtsi" + +/ { + model = "IIJ SA-W2"; + compatible = "iij,sa-w2", "marvell,armada380"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + label-mac-device = &ge0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x10000000>; /* 256MB */ + }; + + soc { + ranges = ; + + pcie { + status = "okay"; + + pcie@1,0 { + status = "okay"; + }; + + pcie@3,0 { + status = "okay"; + }; + }; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&pmx_keys_pins>; + + button-init { + label = "init"; + linux,code = ; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pmx_leds_pins>; + + led-0 { + label = "green:wlan5g"; + gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>; + color = ; + linux,default-trigger = "phy0tpt"; + }; + + led-1 { + label = "red:wlan5g"; + gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-2 { + label = "green:status"; + gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led-3 { + label = "red:status"; + gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led-4 { + label = "green:mobile"; + gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-5 { + label = "red:mobile"; + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-6 { + label = "green:wlan2g"; + gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; + color = ; + linux,default-trigger = "phy1tpt"; + }; + + led-7 { + label = "red:wlan2g"; + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led_power_green: led-8 { + label = "green:power"; + gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + color = ; + }; + + led_power_red: led-9 { + label = "red:power"; + gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-10 { + label = "green:usb1"; + gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; + color = ; + linux,default-trigger = "usbport"; + trigger-sources = <&hub_port2>; + }; + + led-11 { + label = "green:usb0"; + gpios = <&gpio1 23 GPIO_ACTIVE_LOW>; + color = ; + linux,default-trigger = "usbport"; + trigger-sources = <&hub_port1>; + }; + }; + + regulator-vbus-usb0 { + compatible = "regulator-fixed"; + regulator-name = "vbus-usb0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio1 20 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + regulator-vbus-usb1 { + compatible = "regulator-fixed"; + regulator-name = "vbus-usb1"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio1 21 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&pinctrl { + pmx_usb_pins: usb-pins { + marvell,pins = "mpp2", /* smsc usb2514b reset */ + "mpp48", "mpp49", /* port over current */ + "mpp52", "mpp53"; /* port vbus */ + marvell,function = "gpio"; + }; + + pmx_keys_pins: keys-pins { + marvell,pins = "mpp18"; + marvell,function = "gpio"; + }; + + pmx_leds_pins: leds-pins { + marvell,pins = "mpp19", "mpp20", "mpp33", "mpp34", "mpp35", + "mpp36", "mpp44", "mpp45", "mpp46", "mpp47", + "mpp54", "mpp55"; + marvell,function = "gpio"; + }; +}; + +&gpio0 { + usb-hub-reset { + gpio-hog; + gpios = <2 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&usb0 { + pinctrl-names = "default"; + pinctrl-0 = <&pmx_usb_pins>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + /* SMSC USB2514B on PCB */ + hub@1 { + compatible = "usb424,2514"; + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + hub_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + hub_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; + }; +}; + +&bm { + status = "okay"; +}; + +&bm_bppi { + status = "okay"; +}; + +ð1 { + pinctrl-names = "default"; + pinctrl-0 = <&ge1_rgmii_pins>; + status = "okay"; + + phy-connection-type = "rgmii-id"; + buffer-manager = <&bm>; + bm,pool-long = <2>; + bm,pool-short = <3>; + + nvmem-cells = <&macaddr_bdinfo_6 1>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&mdio { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + /* Marvell 88E6172 */ + switch@0 { + compatible = "marvell,mv88e6085"; + reg = <0x0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gpio1>; + interrupts = <10 IRQ_TYPE_LEVEL_LOW>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "ge1_0"; + }; + + port@1 { + reg = <1>; + label = "ge1_1"; + }; + + port@2 { + reg = <2>; + label = "ge1_2"; + }; + + port@3 { + reg = <3>; + label = "ge1_3"; + }; + + ge0: port@4 { + reg = <4>; + label = "ge0"; + nvmem-cells = <&macaddr_bdinfo_6 0>; + nvmem-cell-names = "mac-address"; + }; + + /* + * eth0 is connected to port5 for WAN connection + * on port4 ("GE0") + */ + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <ð1>; + phy-connection-type = "rgmii-id"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&rtc { + status = "disabled"; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spi1_pins>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x100000>; + label = "bootloader"; + read-only; + }; + + partition@100000 { + reg = <0x100000 0x10000>; + label = "bootloader-env"; + read-only; + }; + + partition@110000 { + compatible = "nvmem-cells"; + reg = <0x110000 0xf0000>; + label = "board_info"; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_6: macaddr@6 { + compatible = "mac-base"; + reg = <0x6 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@200000 { + compatible = "iij,seil-firmware"; + reg = <0x200000 0xf00000>; + label = "firmware"; + iij,bootdev-name = "flash"; + iij,seil-id = <0x5345494c 0x32303135>; + }; + + partition@1100000 { + compatible = "iij,seil-firmware"; + reg = <0x1100000 0xf00000>; + label = "rescue"; + iij,bootdev-name = "rescue"; + iij,seil-id = <0x5345494c 0x32303135>; + }; + }; + }; +}; diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 27f41c58a8d..3234d62cd99 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -16,6 +16,23 @@ define Build/fortigate-header mv $@.new $@ endef +define Build/seil-header + ( \ + data_size_crc="$$(gzip -c $@ | tail -c8 | \ + od -An -tx8 --endian little | tr -d ' \n')"; \ + printf "SEIL2015"; \ + printf "$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)" | \ + dd bs=80 count=1 conv=sync 2>/dev/null; \ + printf "$$(echo $${data_size_crc:8:8} | sed 's/../\\x&/g')"; \ + printf "\x00\x00\x00\x01\x00\x00\x00\x09\x00\x00\x00\x63"; \ + printf "$(REVISION)" | dd bs=32 count=1 conv=sync 2>/dev/null; \ + printf "\x00\x00\x00\x00"; \ + printf "$$(echo $${data_size_crc:0:8} | sed 's/../\\x&/g')"; \ + cat $@; \ + ) > $@.new + mv $@.new $@ +endef + define Device/dsa-migration DEVICE_COMPAT_VERSION := 1.1 DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA @@ -134,6 +151,20 @@ define Device/globalscale_mirabox endef TARGET_DEVICES += globalscale_mirabox +define Device/iij_sa-w2 + DEVICE_VENDOR := IIJ + DEVICE_MODEL := SA-W2 + SOC := armada-380 + KERNEL := kernel-bin | append-dtb | seil-header + DEVICE_DTS := armada-380-iij-sa-w2 + IMAGE_SIZE := 15360k + IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \ + append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \ + wpad-basic-mbedtls +endef +TARGET_DEVICES += iij_sa-w2 + define Device/iptime_nas1dual DEVICE_VENDOR := ipTIME DEVICE_MODEL := NAS1dual diff --git a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index 7db6346c37e..36f5331bd01 100644 --- a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -847,6 +847,17 @@ out_error: +@@ -870,6 +870,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts index ef22a6639d4..3f3ed3313f0 100644 --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts @@ -70,7 +70,7 @@ ðernet { pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins &mdio_pins>; + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; @@ -93,6 +93,10 @@ }; }; +&gsw { + mediatek,ephy-base = /bits/ 8 <12>; +}; + &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts index c44ede90657..016ab03c7b7 100644 --- a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts @@ -73,7 +73,7 @@ function = LED_FUNCTION_WLAN; function-enumerator = <0>; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1radio"; + linux,default-trigger = "phy1tpt"; }; led-6 { @@ -82,7 +82,7 @@ function = LED_FUNCTION_WLAN; function-enumerator = <1>; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0radio"; + linux,default-trigger = "phy0tpt"; }; led_power: led-7 { diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts new file mode 100644 index 00000000000..d6f00d9edc8 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "zyxel,lte5398-m904", "mediatek,mt7621-soc"; + model = "ZyXEL LTE5398-M904"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_power_green; + led-failsafe = &led_power_green; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "green:power"; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + }; + + power_blue { + label = "blue:power"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "usbport"; + trigger-sources = <&ehci_port2>; + }; + + internet { + label = "green:internet"; + gpios = <&gpio 23 GPIO_ACTIVE_HIGH>; + }; + + wifi { + label = "green:wifi"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + voice { + label = "green:voice"; + gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; + }; + + lte_green { + label = "green:lte"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + + lte_orange { + label = "orange:lte"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + lte_red { + label = "red:lte"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + lte_power { + gpio-export,name = "lte_power"; + gpio-export,output = <0>; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + + usb_power { + gpio-export,name = "usb_power"; + gpio-export,output = <1>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "Config"; + reg = <0x80000 0x80000>; + }; + + factory: partition@100000 { + compatible = "nvmem-cells"; + label = "Factory"; + reg = <0x100000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; + read-only; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + + macaddr_factory_fe6e: macaddr@fe6e { + reg = <0xfe6e 0x6>; + }; + }; + + partition@140000 { + label = "Kernel"; + reg = <0x140000 0x1ec0000>; + }; + + partition@540000 { + label = "ubi"; + reg = <0x540000 0x1ac0000>; + }; + + partition@2140000 { + label = "Kernel2"; + reg = <0x2140000 0x1ec0000>; + }; + + partition@4000000 { + label = "wwan"; + reg = <0x4000000 0x100000>; + }; + + partition@4100000 { + label = "data"; + reg = <0x4100000 0x1000000>; + }; + + partition@5100000 { + label = "rom-d"; + reg = <0x5100000 0x100000>; + read-only; + }; + + partition@5200000 { + label = "reserve"; + reg = <0x5200000 0x80000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&state_default { + gpio { + groups = "i2c", "rgmii2", "uart3", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_fe6e>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + port@2 { + status = "okay"; + label = "lan2"; + }; + }; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>; + nvmem-cell-names = "eeprom"; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index f3f4873d769..f85f3c8521e 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -578,7 +578,7 @@ define Device/hiwifi_hc5861 DEVICE_VENDOR := HiWiFi DEVICE_MODEL := HC5861 DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci kmod-sdhci-mt7620 \ - kmod-usb-ledtrig-usbport + kmod-phy-realtek kmod-usb-ledtrig-usbport SUPPORTED_DEVICES += hc5861 endef TARGET_DEVICES += hiwifi_hc5861 diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index dc9e5515a7b..65510fccf1b 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2974,6 +2974,21 @@ define Device/zyxel_lte3301-plus endef TARGET_DEVICES += zyxel_lte3301-plus +define Device/zyxel_lte5398-m904 + $(Device/nand) + DEVICE_VENDOR := ZyXEL + DEVICE_MODEL := LTE5398-M904 + KERNEL_SIZE := 31488k + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 uqmi \ + kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb-ledtrig-usbport + KERNEL := $(KERNEL_DTB) | uImage lzma | \ + zytrx-header $$(DEVICE_MODEL) $$(VERSION_DIST)-$$(REVISION) + KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma | \ + zytrx-header $$(DEVICE_MODEL) 9.99(ABQU.1)$$(VERSION_DIST)-recovery + KERNEL_INITRAMFS_SUFFIX := -recovery.bin +endef +TARGET_DEVICES += zyxel_lte5398-m904 + define Device/zyxel_nr7101 $(Device/nand) DEVICE_VENDOR := ZyXEL 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 d4dfdf39e2e..d50e58131d7 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 @@ -248,6 +248,9 @@ yuncore,ax820) zyxel,lte3301-plus) ucidef_set_led_netdev "internet" "internet" "white:internet" "wwan0" ;; +zyxel,lte5398-m904) + ucidef_set_led_netdev "internet" "LTE/3G Internet Activity" "green:internet" "wwan0" "rx tx" + ;; esac board_config_flush 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 b4c2c6dd68a..2fa70a213d3 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 @@ -148,6 +148,10 @@ ramips_setup_interfaces() ubnt,usw-flex) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; + zyxel,lte5398-m904) + ucidef_set_interface_lan "lan1 lan2" + ucidef_set_interface "wan" device "/dev/cdc-wdm0" protocol "qmi" + ;; 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" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches index aebb4163716..22cf272429a 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches @@ -29,7 +29,8 @@ ubnt,edgerouter-x-sfp) ucidef_add_gpio_switch "poe_power_port3" "PoE Power Port3" "403" ucidef_add_gpio_switch "poe_power_port4" "PoE Power Port4" "404" ;; -zyxel,lte3301-plus) +zyxel,lte3301-plus|\ +zyxel,lte5398-m904) ucidef_add_gpio_switch "usb_power" "Power USB Port" "usb_power" "1" ucidef_add_gpio_switch "lte_power" "Power LTE modem" "lte_power" "1" ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index 9db700bff55..c5582473413 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -34,6 +34,7 @@ boot() { [ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1 [ $(printf %d $(fw_printenv -n Image1Try)) -gt 0 ] && fw_setenv Image1Try 0 ;; + zyxel,lte5398-m904|\ zyxel,nr7101) [ $(printf %d $(fw_printenv -n DebugFlag)) -gt 0 ] || fw_setenv DebugFlag 0x1 [ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1 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 203872394bd..777c87bed8e 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -149,6 +149,7 @@ platform_do_upgrade() { platform_upgrade_ubnt_erx "$1" ;; zyxel,lte3301-plus|\ + zyxel,lte5398-m904|\ zyxel,nr7101) fw_setenv CheckBypass 0 fw_setenv Image1Stable 0 diff --git a/target/linux/x86/base-files/etc/board.d/02_network b/target/linux/x86/base-files/etc/board.d/02_network index e00e8c04dd2..0a0f32eb801 100644 --- a/target/linux/x86/base-files/etc/board.d/02_network +++ b/target/linux/x86/base-files/etc/board.d/02_network @@ -31,6 +31,9 @@ cisco-mx100-hw) ucidef_set_network_device_path "eth11" "pci0000:00/0000:00:01.1/0000:02:00.2" ucidef_set_interfaces_lan_wan "mgmt eth2 eth3 eth4 eth5 eth6 eth7 eth8 eth9 eth10 eth11" "wan" ;; +mellanox-technologies-ltd-msn2100) + ucidef_set_interface_lan "eth1 eth2 eth3 eth4 eth5 eth6 eth7 eth8 eth9 eth10 eth11 eth12 eth13 eth14 eth15 eth16" + ;; pc-engines-apu1|pc-engines-apu2|pc-engines-apu3) ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0" ;; diff --git a/target/linux/x86/image/64.mk b/target/linux/x86/image/64.mk index 5ec9978b667..718ff4f63d7 100644 --- a/target/linux/x86/image/64.mk +++ b/target/linux/x86/image/64.mk @@ -4,7 +4,11 @@ define Device/generic DEVICE_PACKAGES += \ kmod-amazon-ena kmod-amd-xgbe kmod-bnx2 kmod-e1000e kmod-e1000 \ kmod-forcedeth kmod-fs-vfat kmod-igb kmod-igc kmod-ixgbe kmod-r8169 \ - kmod-tg3 + kmod-tg3 kmod-mlxsw-core kmod-mlxsw-pci kmod-mlxsw-i2c \ + kmod-mlxsw-spectrum kmod-mlxsw-minimal kmod-mlxfw \ + kmod-leds-mlxcpld kmod-lib-objagg kmod-lib-parman \ + kmod-hwmon-coretemp kmod-hwmon-drivetemp kmod-hwmon-jc42 \ + kmod-i2c-i801 mlxsw_spectrum-firmware GRUB2_VARIANT := generic endef TARGET_DEVICES += generic diff --git a/tools/Makefile b/tools/Makefile index 3a00dcc218f..bc169d7a95a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -96,7 +96,7 @@ $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile $(curdir)/dosfstools/compile := $(curdir)/automake/compile $(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile -$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile $(curdir)/gnulib/compile +$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile $(curdir)/gnulib/compile $(curdir)/libtool/compile $(curdir)/fakeroot/compile := $(curdir)/libtool/compile $(curdir)/findutils/compile := $(curdir)/bison/compile $(curdir)/firmware-utils/compile += $(curdir)/cmake/compile diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 72103411677..6bb2c03fb46 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2023-06-29 -PKG_SOURCE_VERSION:=9e2de8515be15e2b61ae518ce592e5b446ef2d48 -PKG_MIRROR_HASH:=e43d1796dd482ec364e5196f224bb1563dbb0494f0f28fb4e206ef7ef31260fb +PKG_SOURCE_DATE:=2023-10-29 +PKG_SOURCE_VERSION:=635466123429ba8682b575245bbf52e3b33b7163 +PKG_MIRROR_HASH:=316181644733b9a1592aad04ae379cc5f93ff31f03ac76225a1ad5a720265915 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk diff --git a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch b/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch deleted file mode 100644 index 45900e982c9..00000000000 --- a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff -ruN firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c firmware-utils-2022-02-28-002cfaf0/src/ptgen.c ---- firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c 2022-04-23 19:02:07.307896842 +0200 -+++ firmware-utils-2022-02-28-002cfaf0/src/ptgen.c 2022-04-22 18:48:54.477970950 +0200 -@@ -82,6 +82,14 @@ - GUID_INIT( 0x0fc63daf, 0x8483, 0x4772, \ - 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4) - -+#define GUID_PARTITION_SIFIVE_SPL \ -+ GUID_INIT( 0x5b193300, 0xfc78, 0x40cd, \ -+ 0x80, 0x02, 0xe8, 0x6c, 0x45, 0x58, 0x0b, 0x47) -+ -+#define GUID_PARTITION_SIFIVE_UBOOT \ -+ GUID_INIT( 0x2e54b353, 0x1271, 0x4842, \ -+ 0x80, 0x6f, 0xe4, 0x36, 0xd6, 0xaf, 0x69, 0x85) -+ - #define GPT_HEADER_SIZE 92 - #define GPT_ENTRY_SIZE 128 - #define GPT_ENTRY_MAX 128 -@@ -276,6 +284,19 @@ - (1ULL << 56); /* success=1 */ - return true; - } -+ -+ if (!strcmp(type, "sifiveu_spl")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_SPL; -+ return true; -+ } -+ -+ if (!strcmp(type, "sifiveu_uboot")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_UBOOT; -+ return true; -+ } -+ - return false; - } -