From 07b20b6d3599bbb28d2d6bb6de22a7ae2757ba45 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Thu, 31 Jul 2025 15:09:49 +0300 Subject: [PATCH 01/17] dropbear: fix typos in path configuration Replace _FILE with _PATH Fixes: d8ff2d8cba7c ("dropbear: refactor configuration") Signed-off-by: Konstantin Demin Link: https://github.com/openwrt/openwrt/pull/19611 Signed-off-by: Hauke Mehrtens --- package/network/services/dropbear/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 72bec46435..dcf67c8400 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -138,9 +138,9 @@ DB_OPT_COMMON = \ MAX_UNAUTH_PER_IP,$(CONFIG_DROPBEAR_MAX_UNAUTH_PER_IP) \ UNAUTH_CLOSE_DELAY,$(CONFIG_DROPBEAR_UNAUTH_CLOSE_DELAY) \ $(if $(CONFIG_DROPBEAR_RSA),DROPBEAR_DEFAULT_RSA_SIZE$(comma)$(CONFIG_DROPBEAR_DEFAULT_RSA_SIZE)) \ - $(if $(CONFIG_DROPBEAR_LASTLOG),LASTLOG_FILE$(comma)$(CONFIG_DROPBEAR_LASTLOG_FILE)) \ - $(if $(CONFIG_DROPBEAR_UTMP),UTMP_FILE$(comma)$(CONFIG_DROPBEAR_UTMP_FILE)) \ - $(if $(CONFIG_DROPBEAR_WTMP),WTMP_FILE$(comma)$(CONFIG_DROPBEAR_WTMP_FILE)) \ + $(if $(CONFIG_DROPBEAR_LASTLOG),LASTLOG_FILE$(comma)$(CONFIG_DROPBEAR_LASTLOG_PATH)) \ + $(if $(CONFIG_DROPBEAR_UTMP),UTMP_FILE$(comma)$(CONFIG_DROPBEAR_UTMP_PATH)) \ + $(if $(CONFIG_DROPBEAR_WTMP),WTMP_FILE$(comma)$(CONFIG_DROPBEAR_WTMP_PATH)) \ ############################################################################## From 27baa3c731a6aec17a3cb8755cf51e78383fa898 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Thu, 31 Jul 2025 14:21:01 +0300 Subject: [PATCH 02/17] dropbear: fix FTBFS when CONFIG_DROPBEAR_SVR_PUBKEY_OPTIONS is not enabled While this is discouraged to disable this option, both upstream and OpenWrt allows one to do it. Signed-off-by: Konstantin Demin Link: https://github.com/openwrt/openwrt/pull/19611 Signed-off-by: Hauke Mehrtens --- .../patches/051-fix-pubkey-options.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 package/network/services/dropbear/patches/051-fix-pubkey-options.patch diff --git a/package/network/services/dropbear/patches/051-fix-pubkey-options.patch b/package/network/services/dropbear/patches/051-fix-pubkey-options.patch new file mode 100644 index 0000000000..ce0a524657 --- /dev/null +++ b/package/network/services/dropbear/patches/051-fix-pubkey-options.patch @@ -0,0 +1,47 @@ +From 91877a0337f432fd29bb1041be5599ea706e5de6 Mon Sep 17 00:00:00 2001 +From: Konstantin Demin +Date: Thu, 31 Jul 2025 14:13:35 +0300 +Subject: fix build without pubkey options + +fixes: +- 98ef42a856 "Don't set pubkey_info directly in checkpubkey_line" +- 62ea53c1e5 "Implement no-touch-required and verify-requred for authorized_keys file" + +Signed-off-by: Konstantin Demin +Forwarded: https://github.com/mkj/dropbear/pull/374 +--- + src/svr-authpubkey.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/src/svr-authpubkey.c ++++ b/src/svr-authpubkey.c +@@ -186,12 +186,14 @@ void svr_auth_pubkey(int valid_user) { + + #if DROPBEAR_SK_ECDSA || DROPBEAR_SK_ED25519 + key->sk_flags_mask = SSH_SK_USER_PRESENCE_REQD; ++#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT + if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->no_touch_required_flag) { + key->sk_flags_mask &= ~SSH_SK_USER_PRESENCE_REQD; + } + if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->verify_required_flag) { + key->sk_flags_mask |= SSH_SK_USER_VERIFICATION_REQD; + } ++#endif /* DROPBEAR_SVR_PUBKEY_OPTIONS */ + #endif + + /* create the data which has been signed - this a string containing +@@ -513,7 +515,13 @@ static int checkpubkey(const char* keyal + line_num++; + + ret = checkpubkey_line(line, line_num, filename, keyalgo, keyalgolen, +- keyblob, keybloblen, &ses.authstate.pubkey_info); ++ keyblob, keybloblen, ++#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT ++ &ses.authstate.pubkey_info ++#else ++ NULL ++#endif ++ ); + if (ret == DROPBEAR_SUCCESS) { + break; + } From 68e5f46899eb3e0faa78dca698a1ee60691412fe Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Thu, 31 Jul 2025 16:24:09 +0300 Subject: [PATCH 03/17] dropbear: relax path permission checks for authorized keys Check permissions of correct folder for certificates too. Fixes: bbe4d6ddb2a9 ("dropbear: bump to 2025.88") Signed-off-by: Konstantin Demin Link: https://github.com/openwrt/openwrt/pull/19611 Signed-off-by: Hauke Mehrtens --- package/network/services/dropbear/Makefile | 2 +- .../patches/050-dropbear-multihop-fix.patch | 17 ++-- .../dropbear/patches/100-pubkey_path.patch | 93 ++++++++++++++----- 3 files changed, 79 insertions(+), 33 deletions(-) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index dcf67c8400..87b1a2459f 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dropbear PKG_VERSION:=2025.88 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ diff --git a/package/network/services/dropbear/patches/050-dropbear-multihop-fix.patch b/package/network/services/dropbear/patches/050-dropbear-multihop-fix.patch index bde2dda066..d8d6ff18c9 100644 --- a/package/network/services/dropbear/patches/050-dropbear-multihop-fix.patch +++ b/package/network/services/dropbear/patches/050-dropbear-multihop-fix.patch @@ -1,15 +1,16 @@ -Author: Konstantin Demin +From 5cc0127000db5f7567b54d0495fb91a8e452fe09 Mon Sep 17 00:00:00 2001 +From: Konstantin Demin +Date: Fri, 9 May 2025 22:39:35 +0300 Subject: Fix proxycmd without netcat -Fixes commit e5a0ef27c227 "Execute multihop commands directly, no shell" +fixes e5a0ef27c2 "Execute multihop commands directly, no shell" +Signed-off-by: Konstantin Demin Forwarded: https://github.com/mkj/dropbear/pull/363 - +--- src/cli-main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -diff --git a/src/cli-main.c b/src/cli-main.c -index 2fafa88900..0a052a3512 100644 --- a/src/cli-main.c +++ b/src/cli-main.c @@ -77,7 +77,11 @@ int main(int argc, char ** argv) { @@ -25,7 +26,7 @@ index 2fafa88900..0a052a3512 100644 cli_proxy_cmd(&sock_in, &sock_out, &proxy_cmd_pid); if (signal(SIGINT, kill_proxy_sighandler) == SIG_ERR || signal(SIGTERM, kill_proxy_sighandler) == SIG_ERR || -@@ -110,11 +114,13 @@ static void shell_proxy_cmd(const void *user_data_cmd) { +@@ -110,11 +114,13 @@ static void shell_proxy_cmd(const void * dropbear_exit("Failed to run '%s'\n", cmd); } @@ -39,7 +40,7 @@ index 2fafa88900..0a052a3512 100644 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) { char * cmd_arg = NULL; -@@ -145,9 +151,11 @@ static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) { +@@ -145,9 +151,11 @@ static void cli_proxy_cmd(int *sock_in, cmd_arg = m_malloc(shell_cmdlen); snprintf(cmd_arg, shell_cmdlen, "exec %s", cli_opts.proxycmd); exec_fn = shell_proxy_cmd; @@ -51,7 +52,7 @@ index 2fafa88900..0a052a3512 100644 } ret = spawn_command(exec_fn, cmd_arg, sock_out, sock_in, NULL, pid_out); -@@ -159,6 +167,7 @@ static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) { +@@ -159,6 +167,7 @@ static void cli_proxy_cmd(int *sock_in, cleanup: m_free(cli_opts.proxycmd); m_free(cmd_arg); diff --git a/package/network/services/dropbear/patches/100-pubkey_path.patch b/package/network/services/dropbear/patches/100-pubkey_path.patch index 307762fec0..5aafdffe67 100644 --- a/package/network/services/dropbear/patches/100-pubkey_path.patch +++ b/package/network/services/dropbear/patches/100-pubkey_path.patch @@ -1,29 +1,55 @@ + src/svr-authpubkey.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 55 insertions(+), 4 deletions(-) + --- a/src/svr-authpubkey.c +++ b/src/svr-authpubkey.c -@@ -435,20 +435,45 @@ out: - /* Returns the full path to the user's authorized_keys file in an - * allocated string which caller must free. */ - static char *authorized_keys_filepath() { -+ static const char * const global_authkeys_dir = "/etc/dropbear"; -+ /* strlen(global_authkeys_dir) */ -+ #define n_global_authkeys_dir 13 -+ static const char * const authkeys_file = "authorized_keys"; -+ /* strlen(authkeys_file) */ -+ #define n_authkeys_file 15 +@@ -79,6 +79,39 @@ static void send_msg_userauth_pk_ok(cons + const unsigned char* keyblob, unsigned int keybloblen); + static int checkfileperm(char * filename); + ++static const char * const global_authkeys_dir = "/etc/dropbear"; ++/* strlen(global_authkeys_dir) */ ++#define n_global_authkeys_dir 13 ++static const char * const authkeys_file = "authorized_keys"; ++/* strlen(authkeys_file) */ ++#define n_authkeys_file 15 + ++/* OpenWrt-specific: ++ use OpenWrt' global authorized keys directory if: ++ 1. logging as uid 0 (typically root). ++ 2. "svr_opts.authorized_keys_dir" is set to default i.e. no "-D" option was specified ++ OR ++ "-D" option is specified as homedir-relative path ("~" or "~/...") ++ OR ++ "-D" option is specified as "/etc/dropbear". ++ */ ++static int is_openwrt_defaults(void) { ++ if (ses.authstate.pw_uid != 0) return 0; ++ switch (svr_opts.authorized_keys_dir[0]) { ++ case '~': ++ switch (svr_opts.authorized_keys_dir[1]) { ++ case 0: ++ return 1; ++ case '/': ++ return 1; ++ } ++ break; ++ case '/': ++ return (strcmp(svr_opts.authorized_keys_dir, global_authkeys_dir) == 0); ++ } ++ return 0; ++} ++ + /* process a pubkey auth request, sending success or failure message as + * appropriate */ + void svr_auth_pubkey(int valid_user) { +@@ -439,16 +472,22 @@ out: + static char *authorized_keys_filepath() { size_t len = 0; char *pathname = NULL, *dir = NULL; - const char *filename = "authorized_keys"; + -+ /* OpenWrt-specific: -+ use OpenWrt' global authorized keys directory if: -+ 1. logging as uid 0 (typically root) -+ 2. "svr_opts.authorized_keys_dir" is set to default i.e. no "-D" option was specified -+ */ -+ while (1) { -+ if (ses.authstate.pw_uid != 0) break; -+ if (svr_opts.authorized_keys_dir[0] == '/') break; -+ ++ if (is_openwrt_defaults()) { + len = n_global_authkeys_dir + n_authkeys_file + 2; + pathname = m_malloc(len); + snprintf(pathname, len, "%s/%s", global_authkeys_dir, authkeys_file); @@ -42,10 +68,29 @@ + snprintf(pathname, len, "%s/%s", dir, authkeys_file); m_free(dir); return pathname; -+ -+ /* not needed anymore */ -+ #undef n_global_authkeys_dir -+ #undef n_authkeys_file } +@@ -549,11 +588,23 @@ out: + * When this path is inside the user's home dir it checks up to and including + * the home dir, otherwise it checks every path component. */ + static int checkpubkeyperms() { +- char *path = authorized_keys_filepath(), *sep = NULL; ++ char *path = NULL, *sep = NULL; + int ret = DROPBEAR_SUCCESS; - /* Checks whether a specified publickey (and associated algorithm) is an ++ if (is_openwrt_defaults()) { ++ TRACE(("enter checkpubkeyperms/openwrt")) ++ if (checkfileperm(global_authkeys_dir) != DROPBEAR_SUCCESS) { ++ TRACE(("checkpubkeyperms: bad perm on %s", global_authkeys_dir)) ++ ret = DROPBEAR_FAILURE; ++ } ++ TRACE(("leave checkpubkeyperms/openwrt")) ++ return ret; ++ } ++ + TRACE(("enter checkpubkeyperms")) + ++ path = authorized_keys_filepath(); ++ + /* Walk back up path checking permissions, stopping at either homedir, + * or root if the path is outside of the homedir. */ + while ((sep = strrchr(path, '/')) != NULL) { From 0fa192a3a254a283db00792f82b0fdcd27922a79 Mon Sep 17 00:00:00 2001 From: Andres Heinloo Date: Wed, 6 Aug 2025 16:44:29 +0200 Subject: [PATCH 04/17] kernel: Add kmod-w1-slave-ds2438 This patch adds support for building the ds2438 one-wire kernel module. Signed-off-by: Andres Heinloo Link: https://github.com/openwrt/openwrt/pull/19694 Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/w1.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/package/kernel/linux/modules/w1.mk b/package/kernel/linux/modules/w1.mk index 9cba28da11..ba2f3d2fe4 100644 --- a/package/kernel/linux/modules/w1.mk +++ b/package/kernel/linux/modules/w1.mk @@ -174,3 +174,19 @@ define KernelPackage/w1-slave-ds2413/description endef $(eval $(call KernelPackage,w1-slave-ds2413)) + + +define KernelPackage/w1-slave-ds2438 + TITLE:=DS2438 Smart Battery Monitor + KCONFIG:= \ + CONFIG_W1_SLAVE_DS2438 + FILES:=$(W1_SLAVES_DIR)/w1_ds2438.ko + AUTOLOAD:=$(call AutoProbe,w1_ds2438) + $(call AddDepends/w1) +endef + +define KernelPackage/w1-slave-ds2438/description + Kernel module for 1-wire DS2438 Smart Battery Monitor support +endef + +$(eval $(call KernelPackage,w1-slave-ds2438)) From feec7cf34d27e3492f90d13c934c4a0c3b3df633 Mon Sep 17 00:00:00 2001 From: Issam Hamdi Date: Thu, 20 Feb 2025 16:06:00 +0100 Subject: [PATCH 05/17] realtek: dsa: rtl83xx: flush scheduled work on removal The workqueue items don't need to be processed directly when they are scheduled. It can happen that they are simply processed at a much later time. It is therefore necessary to ensure that all workqueue items of a driver are no longer being processed before the driver (or structures of this driver) are destroyed. When skipping this step, the driver driver can cause a kernel Oops on reboot. Unfortunately, it is not recommended [1] to flush items out of the system workqueue - simply because this can cause deadlocks. The driver itself must have a private workqueue which is then flushed. [1] https://lkml.kernel.org/r/49925af7-78a8-a3dd-bce6-cfc02e1a9236@I-love.SAKURA.ne.jp Signed-off-by: Issam Hamdi Signed-off-by: Harshal Gohel Signed-off-by: Sharadanand Karanjkar Link: https://github.com/openwrt/openwrt/pull/19570 Signed-off-by: Hauke Mehrtens --- .../drivers/net/dsa/rtl83xx/common.c | 37 +++++++++++++++++-- .../files-6.12/drivers/net/dsa/rtl83xx/dsa.c | 6 ++- .../drivers/net/dsa/rtl83xx/rtl838x.h | 1 + 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c index 7f96bdd82d..069faf7ed9 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c @@ -1330,7 +1330,7 @@ static int rtl83xx_netevent_event(struct notifier_block *this, pr_debug("%s: updating neighbour on port %d, mac %016llx\n", __func__, port, net_work->mac); - schedule_work(&net_work->work); + queue_work(priv->wq, &net_work->work); if (err) netdev_warn(dev, "failed to handle neigh update (err %d)\n", err); break; @@ -1452,7 +1452,7 @@ static int rtl83xx_fib_event(struct notifier_block *this, unsigned long event, v break; } - schedule_work(&fib_work->work); + queue_work(priv->wq, &fib_work->work); return NOTIFY_DONE; } @@ -1486,6 +1486,7 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev) priv->ds->ops = &rtl83xx_switch_ops; priv->ds->needs_standalone_vlan_filtering = true; priv->dev = dev; + dev_set_drvdata(dev, priv); err = devm_mutex_init(dev, &priv->reg_mutex); if (err) @@ -1583,10 +1584,16 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev) return err; } + priv->wq = create_singlethread_workqueue("rtl83xx"); + if (!priv->wq) { + dev_err(dev, "Error creating workqueue: %d\n", err); + return -ENOMEM; + } + err = dsa_register_switch(priv->ds); if (err) { dev_err(dev, "Error registering switch: %d\n", err); - return err; + goto err_register_switch; } /* dsa_to_port returns dsa_port from the port list in @@ -1694,13 +1701,37 @@ err_register_fib_nb: err_register_ne_nb: unregister_netdevice_notifier(&priv->nb); err_register_nb: + dsa_switch_shutdown(priv->ds); +err_register_switch: + destroy_workqueue(priv->wq); + return err; } static void rtl83xx_sw_remove(struct platform_device *pdev) { + struct rtl838x_switch_priv *priv = platform_get_drvdata(pdev); + + if (!priv) + return; + /* TODO: */ pr_debug("Removing platform driver for rtl83xx-sw\n"); + + /* unregister notifiers which will create workqueue entries with + * references to the switch structures. Also stop self-arming delayed + * work items to avoid them still accessing the DSA structures + * when they are getting shut down. + */ + unregister_fib_notifier(&init_net, &priv->fib_nb); + unregister_netevent_notifier(&priv->ne_nb); + cancel_delayed_work_sync(&priv->counters_work); + + dsa_switch_shutdown(priv->ds); + + destroy_workqueue(priv->wq); + + dev_set_drvdata(&pdev->dev, NULL); } static const struct of_device_id rtl83xx_switch_of_ids[] = { diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c index a14b502cf1..17a8b46f0c 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c @@ -1236,7 +1236,8 @@ static void rtldsa_poll_counters(struct work_struct *work) spin_unlock(&counters->lock); } - schedule_delayed_work(&priv->counters_work, RTLDSA_COUNTERS_POLL_INTERVAL); + queue_delayed_work(priv->wq, &priv->counters_work, + RTLDSA_COUNTERS_POLL_INTERVAL); } static void rtldsa_init_counters(struct rtl838x_switch_priv *priv) @@ -1254,7 +1255,8 @@ static void rtldsa_init_counters(struct rtl838x_switch_priv *priv) } INIT_DELAYED_WORK(&priv->counters_work, rtldsa_poll_counters); - schedule_delayed_work(&priv->counters_work, RTLDSA_COUNTERS_POLL_INTERVAL); + queue_delayed_work(priv->wq, &priv->counters_work, + RTLDSA_COUNTERS_POLL_INTERVAL); } static void rtldsa_get_strings(struct dsa_switch *ds, diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h index 896e9ab24b..18405bdc02 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h @@ -1143,6 +1143,7 @@ struct rtl838x_switch_priv { u32 lag_primary[MAX_LAGS]; u32 is_lagmember[57]; u64 lagmembers; + struct workqueue_struct *wq; struct notifier_block nb; /* TODO: change to different name */ struct notifier_block ne_nb; struct notifier_block fib_nb; From 9ce23ac84009d720bb6d65605508bf8a737b184d Mon Sep 17 00:00:00 2001 From: Felix Golatofski Date: Mon, 4 Aug 2025 16:59:39 +0200 Subject: [PATCH 06/17] ath79: fix LED GPIOs for COMFAST CF-EW71 v2 The vendor DTS defined incorrect GPIOs for the LEDs, which caused them to not function properly. Initially, the WAN, WLAN LEDs appeared to work, but further testing showed that they were non-functional. This patch corrects the GPIO assignments in the DTS, restoring full LED functionality including blinking, except the power LED which cannot be software controlled. Tested on a CF-EW71 v2 unit. Fixes: ee3a6adc6c22 ("ath79: add support for Comfast CF-EW71 v2") Signed-off-by: Felix Golatofski Link: https://github.com/openwrt/openwrt/pull/19665 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts b/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts index c5a96c6613..934cb19a58 100644 --- a/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts +++ b/target/linux/ath79/dts/qca9531_comfast_cf-ew71-v2.dts @@ -32,13 +32,13 @@ led_wan: wan { function = LED_FUNCTION_WAN; color = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; }; wlan { function = LED_FUNCTION_WLAN; color = ; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; }; From 1199a7aad67a820b961720dafc658a2d8b6a2386 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 16 Jul 2025 22:30:26 +0800 Subject: [PATCH 07/17] ramips: add support for SIM SIMAX1800U SIM SIMAX1800U has the similar hardware design as the SIMAX1800T. The only difference is the Ethernet portmap. Specification ------------- - SoC : Mediatek MT7621 - RAM : 256 MiB DDR3 - Flash : 128 MiB NAND Flash - WLAN : Mediatek MT7905 DBDC - 2.4 GHz : 2x2 MIMO WiFi6 - 5 GHz : 2x2 MIMO WiFi6 - Ethernet : MT7621 built-in 10/100/1000 Mbps 1x WAN; 3x LAN - UART : 3.3V, 115200n8 - Buttons : 1x RESET; 1x WPS/MESH - LEDs : 1x Multi-Color(Blue;Green;Red) - Power : DC 12V1A - CMIIT ID : 2022AP7163 - TFTP IP : - server : 192.168.1.254 - router : 192.168.1.28 TFTP Installation(recommend) ------------ 1. Set local tftp server IP "192.168.1.254" and NetMask "255.255.255.0". 2. Rename initramfs-kernel.bin to "factory.bin" and put it in the root directory of the tftp server. tftpd64 is a good choice for Windows. 3. Remove all Ethernet cables and WiFi connections from the PC, except for the one connected to the SIMAX1800U. Start the TFTP server, plug in the power adapter and wait for the OpenWrt system to boot. 4. Backup "firmware" partition and rename it to "firmware.bin". We need it to back to the stock firmware. 5. Use "fw_printenv" command to list envs. If "firmware_select=2" is observed then set u-boot env variable via command: `fw_setenv firmware_select 1` 6. Apply sysupgrade.bin in OpenWrt LuCI. Web UI Installation ------------ 1. Apply update by uploading initramfs-factory.bin to the web UI. 2. Use "fw_printenv" command to list envs. If "firmware_select=2" is observed then set u-boot env variable via command: `fw_setenv firmware_select 1` 3. Apply squashfs-sysupgrade.bin in OpenWrt LuCI. Return to Stock Firmware ---------------------------- Restore the backup firmware partition in the installation step 4. MAC addresses ------------- +---------+-------------------+ | | MAC example | +---------+-------------------+ | LABEL | 98:xx:xx:xx:xx:b2 | | LAN | 98:xx:xx:xx:xx:b5 | | WAN | 98:xx:xx:xx:xx:b2 | | WLAN2G | 98:xx:xx:xx:xx:b4 | | WLAN5G | 9a:xx:xx:xx:xx:b4 | +---------+-------------------+ Tips: ----------- User can use `TFTP Installation` method to recover a brick device. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/19455 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7621_haier-sim_wr1800k.dtsi | 8 ------ .../ramips/dts/mt7621_haier_har-20s2u1.dts | 20 +++++++++++++ .../ramips/dts/mt7621_sim_simax1800t.dts | 20 +++++++++++++ .../ramips/dts/mt7621_sim_simax1800u.dts | 28 +++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 7 +++++ .../mt7621/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 3 +- .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 8 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_sim_simax1800u.dts diff --git a/target/linux/ramips/dts/mt7621_haier-sim_wr1800k.dtsi b/target/linux/ramips/dts/mt7621_haier-sim_wr1800k.dtsi index dd7b72707e..8bd63967c0 100644 --- a/target/linux/ramips/dts/mt7621_haier-sim_wr1800k.dtsi +++ b/target/linux/ramips/dts/mt7621_haier-sim_wr1800k.dtsi @@ -67,16 +67,10 @@ &gmac1 { status = "okay"; label = "wan"; - phy-handle = <ðphy4>; - nvmem-cells = <&macaddr_factory_8004 (-3)>; nvmem-cell-names = "mac-address"; }; -ðphy4 { - /delete-property/ interrupts; -}; - &nand { status = "okay"; @@ -166,7 +160,6 @@ ports { port@1 { status = "okay"; - label = "lan3"; }; port@2 { @@ -176,7 +169,6 @@ port@3 { status = "okay"; - label = "lan1"; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_haier_har-20s2u1.dts b/target/linux/ramips/dts/mt7621_haier_har-20s2u1.dts index dede7dbb20..8c1b23f8eb 100644 --- a/target/linux/ramips/dts/mt7621_haier_har-20s2u1.dts +++ b/target/linux/ramips/dts/mt7621_haier_har-20s2u1.dts @@ -6,3 +6,23 @@ compatible = "haier,har-20s2u1", "mediatek,mt7621-soc"; model = "Haier HAR-20S2U1"; }; + +ðphy4 { + /delete-property/ interrupts; +}; + +&gmac1 { + phy-handle = <ðphy4>; +}; + +&switch0 { + ports { + port@1 { + label = "lan3"; + }; + + port@3 { + label = "lan1"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_sim_simax1800t.dts b/target/linux/ramips/dts/mt7621_sim_simax1800t.dts index 3c5c9179d2..b75af605bb 100644 --- a/target/linux/ramips/dts/mt7621_sim_simax1800t.dts +++ b/target/linux/ramips/dts/mt7621_sim_simax1800t.dts @@ -6,3 +6,23 @@ compatible = "sim,simax1800t", "mediatek,mt7621-soc"; model = "SIM SIMAX1800T"; }; + +ðphy4 { + /delete-property/ interrupts; +}; + +&gmac1 { + phy-handle = <ðphy4>; +}; + +&switch0 { + ports { + port@1 { + label = "lan3"; + }; + + port@3 { + label = "lan1"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_sim_simax1800u.dts b/target/linux/ramips/dts/mt7621_sim_simax1800u.dts new file mode 100644 index 0000000000..70fff673f5 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_sim_simax1800u.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_haier-sim_wr1800k.dtsi" + +/ { + compatible = "sim,simax1800u", "mediatek,mt7621-soc"; + model = "SIM SIMAX1800U"; +}; + +ðphy0 { + /delete-property/ interrupts; +}; + +&gmac1 { + phy-handle = <ðphy0>; +}; + +&switch0 { + ports { + port@1 { + label = "lan1"; + }; + + port@3 { + label = "lan3"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2549f353e9..578c293224 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2615,6 +2615,13 @@ define Device/sim_simax1800t endef TARGET_DEVICES += sim_simax1800t +define Device/sim_simax1800u + $(Device/haier-sim_wr1800k) + DEVICE_VENDOR := SIM + DEVICE_MODEL := SIMAX1800U +endef +TARGET_DEVICES += sim_simax1800u + define Device/snr_snr-cpe-me1 $(Device/dsa-migration) $(Device/uimage-lzma-loader) 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 1e194fef5f..c12c46dc10 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 @@ -22,6 +22,7 @@ ramips_setup_interfaces() mercusys,mr70x-v1|\ netgear,wax202|\ sim,simax1800t|\ + sim,simax1800u|\ tplink,mr600-v2-eu|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-ac2100|\ 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 0c9c98399a..21ab3f16ea 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 @@ -105,7 +105,8 @@ case "$board" in ;; haier,har-20s2u1|\ jcg,y2|\ - sim,simax1800t) + sim,simax1800t|\ + sim,simax1800u) [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary factory 0x4)" > /sys${DEVPATH}/macaddress ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 9180118f3d..a1f14f9d78 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -138,6 +138,7 @@ platform_do_upgrade() { sercomm,na502|\ sercomm,na502s|\ sim,simax1800t|\ + sim,simax1800u|\ tplink,ec330-g5u-v1|\ wifire,s1500-nbn|\ xiaomi,mi-router-3g|\ From c65ae24cf13ec9cd158d2ffb2f36cd90c7b5781c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 16 Jul 2025 22:30:26 +0800 Subject: [PATCH 08/17] uboot-envtools: ramips: add env config for SIM SIMAX1800U This newly supported device has the same env partition size and offset as SIMAX1800T. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/19455 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-tools/uboot-envtools/files/ramips | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-tools/uboot-envtools/files/ramips b/package/boot/uboot-tools/uboot-envtools/files/ramips index 8d53524a2c..3ec3da6988 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/ramips +++ b/package/boot/uboot-tools/uboot-envtools/files/ramips @@ -85,7 +85,8 @@ zyxel,wsm20) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; haier,har-20s2u1|\ -sim,simax1800t) +sim,simax1800t|\ +sim,simax1800u) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd1" "0x40000" "0x40000" "0x20000" ;; From 536a25ebf849b2de22792786b4c6f0c15471ee93 Mon Sep 17 00:00:00 2001 From: Jiasheng Zhu Date: Thu, 24 Jul 2025 21:09:30 +0800 Subject: [PATCH 09/17] mediatek: add support for OpenFi 6C OpenFi 6C is a portable Wi-Fi 6 travel router based on MediaTek MT7981B+MT7976CN. Two slightly different versions have been sold. The V1 board has a green color and lacks the modem LED. The V2 board is black and has a LED for the modem. The firmware should work on both of them. Specifications: - SoC: MediaTek MT7981B (Filogic 820) 1.3GHz dual-core ARM Cortex-A53 - RAM: 1GB DDR4 - Flash: 256MB SPI NAND - Wireless: 2.4GHz/5GHz 802.11ax - Ethernet: 1x 10/100/1000M LAN - USB: 1x USB 3.0 Type-A port - Expansion: M.2 slot for 5G modem - Cooling: PWM-controlled fan - Buttons: Reset, Mode switch - LEDs: System, Ethernet, 5G WiFi, Modem status **Installation via U-Boot web page** 1. Set static IP 192.168.21.2/255.255.255.0 on your computer. 2. Connect to the Ethernet port and hold the reset button while booting the device. Wait for 6-8 seconds, and release the reset button. 3. Open U-boot web page on your browser at http://192.168.21.1 4. Select the OpenWRT sysupgrade image, upload it, and start the upgrade. 5. Wait for automatic reboot. **Installation via sysupgrade** Flash the sysupgrade file via LuCI upgrade page without saving the settings. Signed-off-by: Jiasheng Zhu Link: https://github.com/openwrt/openwrt/pull/19512 Signed-off-by: Hauke Mehrtens --- .../linux/mediatek/dts/mt7981b-openfi-6c.dts | 272 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 3 + .../filogic/base-files/etc/board.d/02_network | 1 + target/linux/mediatek/image/filogic.mk | 13 + 4 files changed, 289 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-openfi-6c.dts diff --git a/target/linux/mediatek/dts/mt7981b-openfi-6c.dts b/target/linux/mediatek/dts/mt7981b-openfi-6c.dts new file mode 100644 index 0000000000..dd62098816 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-openfi-6c.dts @@ -0,0 +1,272 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include +#include +#include + +#include "mt7981b.dtsi" + +/ { + model = "OpenFi 6C"; + compatible = "openfi,6c", "mediatek,mt7981b"; + + aliases { + led-boot = &led_sys_green; + led-failsafe = &led_sys_green; + led-running = &led_sys_green; + led-upgrade = &led_sys_green; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + mode { + label = "mode"; + linux,input-type = ; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_sys_green: led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + }; + + led-1 { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + }; + + led-2 { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-3 { + function = LED_FUNCTION_MOBILE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + modem_power { + gpio-export,name = "modem_power"; + gpio-export,output = <1>; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + modem_reset { + gpio-export,name = "modem_reset"; + gpio-export,output = <1>; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + modem_reset_2 { + gpio-export,name = "modem_reset_2"; + gpio-export,output = <0>; + gpios = <&pio 12 GPIO_ACTIVE_HIGH>; + }; + }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&pio 8 GPIO_ACTIVE_LOW>; + regulator-boot-on; + }; +}; + +&fan { + pwms = <&pwm 0 40000 0>; + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + nvmem-cells = <&macaddr_factory_4 0>; + nvmem-cell-names = "mac-address"; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "hw"; + reg = <0x0580000 0x0080000>; + read-only; + }; + + partition@600000 { + label = "cfg"; + reg = <0x0600000 0x0080000>; + read-only; + }; + + partition@680000 { + label = "ubi"; + reg = <0x680000 0xe980000>; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + + pwm_pins: pwm-pins { + mux { + function = "pwm"; + groups = "pwm0_0", "pwm1_0"; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + #address-cells = <1>; + #size-cells = <0>; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + status = "okay"; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; + }; +}; + +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm_pins>; + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index f88f01cde3..6d4c7903bc 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -127,6 +127,9 @@ openembed,som7981) ucidef_set_led_netdev "lanact" "LANACT" "amber:lan" "eth1" "rx tx" ucidef_set_led_netdev "lanlink" "LANLINK" "green:lan" "eth1" "link" ;; +openfi,6c) + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" "link tx rx" + ;; openwrt,one) ucidef_set_led_netdev "wanact" "WANACT" "mdio-bus:0f:green:wan" "eth0" "rx tx" ucidef_set_led_netdev "wanlink" "WANLINK" "mdio-bus:0f:amber:wan" "eth0" "link" 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 f9b7440664..802df4608c 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 @@ -93,6 +93,7 @@ mediatek_setup_interfaces() cudy,ap3000-v1|\ cudy,re3000-v1|\ netgear,wax220|\ + openfi,6c|\ ubnt,unifi-6-plus|\ wavlink,wl-wn573hx3|\ zyxel,nwa50ax-pro) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 040fe36cd7..e9e74efa1f 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1646,6 +1646,19 @@ define Device/openembed_som7981 endef TARGET_DEVICES += openembed_som7981 +define Device/openfi_6c + DEVICE_VENDOR := OpenFi + DEVICE_MODEL := 6C + DEVICE_DTS := mt7981b-openfi-6c + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + 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 += openfi_6c + define Device/openwrt_one DEVICE_VENDOR := OpenWrt DEVICE_MODEL := One From e45d783bce28c647c29a56f5be69da1b2a1db52c Mon Sep 17 00:00:00 2001 From: Harshal Gohel Date: Tue, 17 Jun 2025 12:46:42 +0000 Subject: [PATCH 10/17] realtek: rtl931x: Fix VLAN tagging and untagging * In RTL931x, bit 31 of the (4th column) of 802_1Q_VLAN_QINQ table indicates the validity of l2 tunnel. Before bit 63 (3rd column) was being checked for validity of l2 tunnel. * The untagged_ports requires 64 bits to represent 56 ports. Do not store u64 in u32 variable * First 24 ports are represented in the 2nd register not just first 20 Signed-off-by: Harshal Gohel Signed-off-by: Sharadanand Karanjkar Link: https://github.com/openwrt/openwrt/pull/19576 Signed-off-by: Hauke Mehrtens --- .../files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c index ed6674e044..000e414000 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c @@ -204,9 +204,8 @@ static void rtl931x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info) info->hash_uc_fid = !!(x & BIT(31)); info->hash_mc_fid = !!(x & BIT(30)); info->if_id = (x >> 20) & 0x3ff; - info->profile_id = (x >> 16) & 0xf; info->multicast_grp_mask = x & 0xffff; - if (x & BIT(31)) + if (y & BIT(31)) info->l2_tunnel_list_id = y >> 18; else info->l2_tunnel_list_id = -1; @@ -217,21 +216,19 @@ static void rtl931x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info) /* Read UNTAG table via table register 3 */ r = rtl_table_get(RTL9310_TBL_3, 0); rtl_table_read(r, vlan); - v = ((u64)sw_r32(rtl_table_data(r, 0))) << 25; - v |= sw_r32(rtl_table_data(r, 1)) >> 7; - rtl_table_release(r); + info->untagged_ports = ((u64)sw_r32(rtl_table_data(r, 0))) << 25; + info->untagged_ports |= sw_r32(rtl_table_data(r, 1)) >> 7; - info->untagged_ports = v; + rtl_table_release(r); } static void rtl931x_vlan_set_tagged(u32 vlan, struct rtl838x_vlan_info *info) { + struct table_reg *r; u32 v, w, x, y; - /* Access VLAN table (1) via register 0 */ - struct table_reg *r = rtl_table_get(RTL9310_TBL_0, 3); v = info->tagged_ports >> 25; - w = (info->tagged_ports & 0x1fffff) << 7; + w = (info->tagged_ports & GENMASK(24, 0)) << 7; w |= info->fid & 0x7f; x = info->hash_uc_fid ? BIT(31) : 0; x |= info->hash_mc_fid ? BIT(30) : 0; @@ -245,6 +242,7 @@ static void rtl931x_vlan_set_tagged(u32 vlan, struct rtl838x_vlan_info *info) y = 0; } + r = rtl_table_get(RTL9310_TBL_0, 3); sw_w32(v, rtl_table_data(r, 0)); sw_w32(w, rtl_table_data(r, 1)); sw_w32(x, rtl_table_data(r, 2)); From 56499702a3c8a0057568ea69442a53de80386fad Mon Sep 17 00:00:00 2001 From: Harshal Gohel Date: Mon, 14 Jul 2025 11:11:47 +0200 Subject: [PATCH 11/17] realtek: rtl931x: Sync family parameters with RTL930x Some of the parameters added to RTL9300_FAMILY_ID are missing for RTL9310_FAMILY_ID. Simply add the missing ones to keep sharing code between the two SoCs. Signed-off-by: Harshal Gohel Signed-off-by: Sharadanand Karanjkar Link: https://github.com/openwrt/openwrt/pull/19574 Signed-off-by: Hauke Mehrtens --- .../files-6.12/drivers/net/dsa/rtl83xx/common.c | 10 ++++++++++ .../files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h | 1 + 2 files changed, 11 insertions(+) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c index 069faf7ed9..2dd93de552 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c @@ -1536,6 +1536,9 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev) priv->r = &rtl930x_reg; priv->ds->num_ports = 29; priv->fib_entries = 16384; + /* TODO A version based on CHIP_INFO and MODEL_NAME_INFO should + * be constructed. For now, just set it to a static 'A' + */ priv->version = RTL8390_VERSION_A; priv->n_lags = 16; sw_w32(1, RTL930X_ST_CTRL); @@ -1553,9 +1556,16 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev) priv->r = &rtl931x_reg; priv->ds->num_ports = 57; priv->fib_entries = 16384; + /* TODO A version based on CHIP_INFO and MODEL_NAME_INFO should + * be constructed. For now, just set it to a static 'A' + */ priv->version = RTL8390_VERSION_A; priv->n_lags = 16; + sw_w32(1, RTL931x_ST_CTRL); priv->l2_bucket_size = 8; + priv->n_pie_blocks = 16; + priv->port_ignore = 0x3f; + priv->n_counters = 2048; break; } pr_debug("Chip version %c\n", priv->version); diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h index 18405bdc02..b8f543bd9e 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h @@ -276,6 +276,7 @@ #define MV_ACT_COPY2CPU 3 #define RTL930X_ST_CTRL (0x8798) +#define RTL931x_ST_CTRL (0x8000) #define RTL930X_L2_PORT_SABLK_CTRL (0x905c) #define RTL930X_L2_PORT_DABLK_CTRL (0x9060) From 62938204dbc0c3faf7fd6b9a5f59103167b71f27 Mon Sep 17 00:00:00 2001 From: Harshal Gohel Date: Mon, 7 Jul 2025 17:18:17 +0000 Subject: [PATCH 12/17] realtek: rtl931x: Add smi_poll_ctrl The comment incorrectly stated that RTL931X doesn't have smi_poll_ctrl. But there is actually a register for using it. Signed-off-by: Harshal Gohel Signed-off-by: Sharadanand Karanjkar Link: https://github.com/openwrt/openwrt/pull/19574 Signed-off-by: Hauke Mehrtens --- .../linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c index 000e414000..05bf68a744 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c @@ -1639,7 +1639,7 @@ const struct rtl838x_reg rtl931x_reg = { .l2_ctrl_1 = RTL931X_L2_AGE_CTRL, .l2_port_aging_out = RTL931X_L2_PORT_AGE_CTRL, .set_ageing_time = rtl931x_set_ageing_time, - /* .smi_poll_ctrl does not exist */ + .smi_poll_ctrl = RTL931X_SMI_PORT_POLLING_CTRL, .l2_tbl_flush_ctrl = RTL931X_L2_TBL_FLUSH_CTRL, .exec_tbl0_cmd = rtl931x_exec_tbl0_cmd, .exec_tbl1_cmd = rtl931x_exec_tbl1_cmd, From 92489f50c766c7c532b7a0230fd6181c840f7310 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Wed, 29 Jan 2025 19:23:33 +0100 Subject: [PATCH 13/17] realtek: rtl931x: Fix size of TRK_MBR_CTRL group block Each MBR ctrl block has 64 bits to store the 56 possible ports. The offsets between the groups is therefore also 64 bit. Signed-off-by: Sven Eckelmann Signed-off-by: Sharadanand Karanjkar Link: https://github.com/openwrt/openwrt/pull/19574 Signed-off-by: Hauke Mehrtens --- .../realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c index 05bf68a744..f6a098c701 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c @@ -179,9 +179,9 @@ static void rtl931x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, u32 port priv->r->exec_tbl0_cmd(cmd); } -inline static int rtl931x_trk_mbr_ctr(int group) +inline static int rtldsa_931x_trk_mbr_ctr(int group) { - return RTL931X_TRK_MBR_CTRL + (group << 2); + return RTL931X_TRK_MBR_CTRL + (group << 3); } static void rtl931x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info) @@ -1675,7 +1675,7 @@ const struct rtl838x_reg rtl931x_reg = { .vlan_port_keep_tag_set = rtl931x_vlan_port_keep_tag_set, .vlan_port_pvidmode_set = rtl931x_vlan_port_pvidmode_set, .vlan_port_pvid_set = rtl931x_vlan_port_pvid_set, - .trk_mbr_ctr = rtl931x_trk_mbr_ctr, + .trk_mbr_ctr = rtldsa_931x_trk_mbr_ctr, .set_vlan_igr_filter = rtl931x_set_igr_filter, .set_vlan_egr_filter = rtl931x_set_egr_filter, .set_distribution_algorithm = rtl931x_set_distribution_algorithm, From 4c4cecab2fdbd26a72cfb91269143842bdeff6ee Mon Sep 17 00:00:00 2001 From: Harshal Gohel Date: Mon, 7 Jul 2025 15:58:19 +0000 Subject: [PATCH 14/17] realtek: rtl93xx: Add GPIO access register definitions mach-rtl83xx.h contained the required register definitions for older SoC families but was missing it for RTL930x and RTL931x. Signed-off-by: Harshal Gohel Signed-off-by: Sharadanand Karanjkar Link: https://github.com/openwrt/openwrt/pull/19574 Signed-off-by: Hauke Mehrtens --- .../arch/mips/include/asm/mach-rtl838x/mach-rtl83xx.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/linux/realtek/files-6.12/arch/mips/include/asm/mach-rtl838x/mach-rtl83xx.h b/target/linux/realtek/files-6.12/arch/mips/include/asm/mach-rtl838x/mach-rtl83xx.h index 263f246275..2946674036 100644 --- a/target/linux/realtek/files-6.12/arch/mips/include/asm/mach-rtl838x/mach-rtl83xx.h +++ b/target/linux/realtek/files-6.12/arch/mips/include/asm/mach-rtl838x/mach-rtl83xx.h @@ -236,12 +236,22 @@ #define RTL930X_LED_GLB_CTRL (0xCC00) #define RTL931X_LED_GLB_CTRL (0x0600) +#define RTL930X_EXT_GPIO_GLB_CTRL (0xC600) +#define RTL931X_EXT_GPIO_GLB_CTRL (0x07D4) + #define RTL838X_EXT_GPIO_DIR (0xA08C) #define RTL839X_EXT_GPIO_DIR (0x0214) +#define RTL930X_EXT_GPIO_DIR (0xC608) +#define RTL931X_EXT_GPIO_DIR (0x07DC) #define RTL838X_EXT_GPIO_DATA (0xA094) #define RTL839X_EXT_GPIO_DATA (0x021c) +#define RTL930X_EXT_GPIO_DATA (0xC614) +#define RTL931X_EXT_GPIO_DATA (0x07E8) #define RTL838X_EXT_GPIO_INDRT_ACCESS (0xA09C) #define RTL839X_EXT_GPIO_INDRT_ACCESS (0x0224) +#define RTL930X_EXT_GPIO_INDRT_ACCESS (0xC620) +#define RTL931X_EXT_GPIO_INDRT_ACCESS (0x07F4) + #define RTL838X_EXTRA_GPIO_CTRL (0xA0E0) #define RTL838X_DMY_REG5 (0x0144) #define RTL838X_EXTRA_GPIO_CTRL (0xA0E0) From cbc2cdbb80ecb8ba9018ee4d6614e9d7a367efee Mon Sep 17 00:00:00 2001 From: Rani Hod Date: Sat, 19 Apr 2025 19:44:02 +0300 Subject: [PATCH 15/17] ramips: mt76x8: add support for Wodesys WD-R1208U This commit adds support for a dual-band AC1200 wall plug manufactured by Shenzhen Century Xinyang Tech Co., Ltd. SoC: Mediatek MT7628AN (MIPS 24KEc single core, 580 MHz) RAM: 128 MiB DDR2 (Hynix HY5PS1G1631C) ROM: 8 MiB SPI NOR (Zbit ZB25VQ64ASIG) Wired: one FE RJ45 port (+ an unpopulated footprint for a 2nd) WiFi: Mediatek MT7612E Ant.: four 2 dBi external antennas (two 2.4GHz, two 5 GHz) LEDs: - Power (green, always on) - 2.4G (green, controlled by MT7628) - 5G (green, controlled by MT7612) - Extender (green, GPIO 37, used as status LED) - LAN (green/yellow, controlled by RT3050 ESW) Buttons: WPS and reset (both connected to GPIO 38) Power: 5V 2-pin JST-XH on main PCB 110/220V AC to 5V 1.5A DC on auxiliary PCB UART: 57600 8n1 3.3v, holes available on the PCB as J5 pinout is (Gnd) (Tx) (Rx) MAC: 1C:BF:CE:xx:xx:xx (2.4 GHz, label) 1C:BF:CE:xx:xx:xx + 1 (LAN) 1C:BF:CE:xx:xx:xx + 2 (WAN, not in use) 1C:BF:CE:xx:xx:xx + 3 (5 GHz) Original firmware is Chaos Calmer 15.05.01 (kernel 3.10.108) with a few custom packages and a non-LuCI web interface. Telnet is enabled, requiring an unknown root password [1]. Root password is also needed to access the router via UART console, but passwordless telnet can be enabled via a trivial web exploit [2] and then the root password can be removed by editing `/etc/shadow`. Installation: Upload `sysupgrade` binary via web interface at `http://192.168.188.1/settings.shtml`. Alternatively, remove root password and use u-boot menu to flash image via TFTP. Notes: - Device model in Chaos Calmer is "mtk-apsoc-demo". - It is sold under several brands, e.g., Fenvi and Linkavenir. It is available in two colors: white and black. - PCB is marked "WD206AD v1.0". - Instead of a standard ethernet transformer, the PCB has a few tiny SMD coils. - The housing is identical to the one used by a 2020 model, WD-R1203U, which is RTL8812-based. The older model has an FCC listing with external and internal images: ZNPWD-R1203U. The FCC listing contains a letter [3] claiming WD-R1203U and WD-R1208U are internally identical, but evidently they are not. [1] root:$1$7rmMiPJj$91iv9LWhfkZE/t7aCBdo.0:18388:0:99999:7::: This is the same hash as in Wodesys WD-R1802U. There are other root password hashes in `/etc/shadow_sf` and `/etc/shadow_yn`. [2] curl -X POST http://192.168.188.1/cgi-bin/adm.cgi \ -d page=Lang -d langType="en;killall telnetd;telnetd -l /bin/sh" [3] https://fcc.report/FCC-ID/ZNPWD-R1203U/4767033 Signed-off-by: Rani Hod Link: https://github.com/openwrt/openwrt/pull/19535 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_wodesys_wd-r1208u.dts | 148 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 9 ++ 2 files changed, 157 insertions(+) create mode 100644 target/linux/ramips/dts/mt7628an_wodesys_wd-r1208u.dts diff --git a/target/linux/ramips/dts/mt7628an_wodesys_wd-r1208u.dts b/target/linux/ramips/dts/mt7628an_wodesys_wd-r1208u.dts new file mode 100644 index 0000000000..00cf5f80fe --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_wodesys_wd-r1208u.dts @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "wodesys,wd-r1208u", "mediatek,mt7628an-soc"; + model = "Wodesys WD-R1208U"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + label-mac-device = &wmac; + }; + + keys { + compatible = "gpio-keys"; + + button-reset { // both reset and wps button + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + + // non-GPIO LEDs: + // Power, WLAN_2GHZ, WLAN_5GHZ, LAN + }; +}; + +&spi0 { + 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 = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x200>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "wdt", "refclk", "p4led_an"; + function = "gpio"; + }; + + wlan { + groups = "wled_an"; + function = "wled_an"; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portdisable = <0x27>; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 0d60d2b95e..147acb81b7 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -1228,6 +1228,15 @@ define Device/wiznet_wizfi630s endef TARGET_DEVICES += wiznet_wizfi630s +define Device/wodesys_wd-r1208u + IMAGE_SIZE := 7872k + DEVICE_VENDOR := Wodesys + DEVICE_MODEL := WD-R1208U + DEVICE_PACKAGES := kmod-mt76x2 + SUPPORTED_DEVICES += mtk-apsoc-demo +endef +TARGET_DEVICES += wodesys_wd-r1208u + define Device/wrtnode_wrtnode2p IMAGE_SIZE := 32448k DEVICE_VENDOR := WRTnode From 8a9b9e928efee3dc40ac7b16f7be78d4d548bf0d Mon Sep 17 00:00:00 2001 From: Jan Taczanowski Date: Thu, 24 Jul 2025 23:19:34 +0200 Subject: [PATCH 16/17] mpc85xx: HPE MSM460 add HPE MSM430 alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define MSM430 as alternative name, to explicitly show the device is supported using existing image (MSM460). I can confirm that the guide from https://github.com/blocktrron/msm460-flashing works perfectly fine with the HP MSM430 as well. In fact, the MSM430 running the original firmware operates as a 2x3:2 access point, but after flashing it with OpenWRT, it functions as a 3x3:3 access point — just like the MSM460 model. It seems that the MSM430 is essentially the same hardware as the MSM460, with limitations imposed by the original (HP) software. Signed-off-by: Jan Taczanowski Link: https://github.com/openwrt/openwrt/pull/19540 Signed-off-by: Hauke Mehrtens --- target/linux/mpc85xx/image/p1020.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/mpc85xx/image/p1020.mk b/target/linux/mpc85xx/image/p1020.mk index c310b26c87..fcc4619ad2 100644 --- a/target/linux/mpc85xx/image/p1020.mk +++ b/target/linux/mpc85xx/image/p1020.mk @@ -94,6 +94,8 @@ TARGET_DEVICES += extreme-networks_ws-ap3825i define Device/hpe_msm460 DEVICE_VENDOR := Hewlett-Packard DEVICE_MODEL := MSM460 + DEVICE_ALT0_VENDOR := Hewlett-Packard + DEVICE_ALT0_MODEL := MSM430 KERNEL = kernel-bin | fit none $(KDIR)/image-$$(DEVICE_DTS).dtb KERNEL_NAME := zImage.la3000000 KERNEL_ENTRY := 0x3000000 From 56b083221f22d370682ff8dcbb3041f3d719a581 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 3 Aug 2025 10:43:56 +0200 Subject: [PATCH 17/17] strace: update to 6.15 Release Notes: - https://github.com/strace/strace/releases/tag/v6.15 Link: https://github.com/openwrt/openwrt/pull/19643 Signed-off-by: Nick Hainke --- package/devel/strace/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index d2708b60cd..ec5e6fb5be 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=6.14 +PKG_VERSION:=6.15 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=244f3b5c20a32854ca9b7ca7a3ee091dd3d4bd20933a171ecee8db486c77d3c9 +PKG_HASH:=8552dfab08abc22a0f2048c98fd9541fd4d71b6882507952780dab7c7c512f51 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=LGPL-2.1-or-later