Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2025-08-08 16:22:25 +08:00
commit b1d8f36f6b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
28 changed files with 749 additions and 68 deletions

View File

@ -88,7 +88,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"
;;

View File

@ -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 <nbd@nbd.name>
PKG_LICENSE:=LGPL-2.1-or-later

View File

@ -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))

View File

@ -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:= \
@ -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)) \
##############################################################################

View File

@ -1,15 +1,16 @@
Author: Konstantin Demin <rockdrilla@gmail.com>
From 5cc0127000db5f7567b54d0495fb91a8e452fe09 Mon Sep 17 00:00:00 2001
From: Konstantin Demin <rockdrilla@gmail.com>
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 <rockdrilla@gmail.com>
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);

View File

@ -0,0 +1,47 @@
From 91877a0337f432fd29bb1041be5599ea706e5de6 Mon Sep 17 00:00:00 2001
From: Konstantin Demin <rockdrilla@gmail.com>
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 <rockdrilla@gmail.com>
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;
}

View File

@ -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) {

View File

@ -32,13 +32,13 @@
led_wan: wan {
function = LED_FUNCTION_WAN;
color = <LED_COLOR_ID_BLUE>;
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
};
wlan {
function = LED_FUNCTION_WLAN;
color = <LED_COLOR_ID_BLUE>;
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
};

View File

@ -0,0 +1,272 @@
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#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 = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
mode {
label = "mode";
linux,input-type = <EV_SW>;
linux,code = <BTN_0>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
gpio-leds {
compatible = "gpio-leds";
led_sys_green: led-0 {
function = LED_FUNCTION_STATUS;
color = <LED_COLOR_ID_GREEN>;
gpios = <&pio 2 GPIO_ACTIVE_LOW>;
};
led-1 {
function = LED_FUNCTION_LAN;
color = <LED_COLOR_ID_GREEN>;
gpios = <&pio 34 GPIO_ACTIVE_LOW>;
};
led-2 {
function = LED_FUNCTION_WLAN_5GHZ;
color = <LED_COLOR_ID_GREEN>;
gpios = <&pio 35 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
led-3 {
function = LED_FUNCTION_MOBILE;
color = <LED_COLOR_ID_GREEN>;
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";
};
&eth {
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";
};

View File

@ -135,6 +135,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"

View File

@ -100,6 +100,7 @@ mediatek_setup_interfaces()
cudy,ap3000-v1|\
cudy,re3000-v1|\
netgear,wax220|\
openfi,6c|\
ubnt,unifi-6-plus|\
wavlink,wl-wn573hx3|\
zyxel,nwa50ax-pro)

View File

@ -1830,6 +1830,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

View File

@ -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

View File

@ -67,16 +67,10 @@
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy4>;
nvmem-cells = <&macaddr_factory_8004 (-3)>;
nvmem-cell-names = "mac-address";
};
&ethphy4 {
/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";
};
};
};

View File

@ -6,3 +6,23 @@
compatible = "haier,har-20s2u1", "mediatek,mt7621-soc";
model = "Haier HAR-20S2U1";
};
&ethphy4 {
/delete-property/ interrupts;
};
&gmac1 {
phy-handle = <&ethphy4>;
};
&switch0 {
ports {
port@1 {
label = "lan3";
};
port@3 {
label = "lan1";
};
};
};

View File

@ -6,3 +6,23 @@
compatible = "sim,simax1800t", "mediatek,mt7621-soc";
model = "SIM SIMAX1800T";
};
&ethphy4 {
/delete-property/ interrupts;
};
&gmac1 {
phy-handle = <&ethphy4>;
};
&switch0 {
ports {
port@1 {
label = "lan3";
};
port@3 {
label = "lan1";
};
};
};

View File

@ -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";
};
&ethphy0 {
/delete-property/ interrupts;
};
&gmac1 {
phy-handle = <&ethphy0>;
};
&switch0 {
ports {
port@1 {
label = "lan1";
};
port@3 {
label = "lan3";
};
};
};

View File

@ -0,0 +1,148 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7628an.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ {
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 = <KEY_RESTART>;
};
};
leds {
compatible = "gpio-leds";
led_status: led-0 {
function = LED_FUNCTION_STATUS;
color = <LED_COLOR_ID_GREEN>;
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";
};
};
&ethernet {
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;
};
};
};

View File

@ -2630,6 +2630,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)

View File

@ -1242,6 +1242,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

View File

@ -23,6 +23,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|\

View File

@ -108,7 +108,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
;;

View File

@ -139,6 +139,7 @@ platform_do_upgrade() {
sercomm,na502|\
sercomm,na502s|\
sim,simax1800t|\
sim,simax1800u|\
tplink,ec330-g5u-v1|\
wifire,s1500-nbn|\
xiaomi,mi-router-3g|\

View File

@ -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)

View File

@ -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)
@ -1535,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);
@ -1552,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);
@ -1583,10 +1594,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 +1711,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[] = {

View File

@ -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,

View File

@ -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)
@ -1143,6 +1144,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;

View File

@ -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)
@ -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));
@ -1641,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,
@ -1677,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,