From 13a5e02e28d2fb93de6d6ea275e836e08f851752 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 28 Feb 2025 14:15:17 +0100 Subject: [PATCH 01/12] realtek: Add status LED for Netgear GS310TP Power LED is identical to GS308T. Link: https://forum.openwrt.org/t/222970/11 Signed-off-by: Sander Vanheule --- .../dts/rtl8380_netgear_gs310tp-v1.dts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts b/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts index 9d58b3028a..6108462c67 100644 --- a/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts +++ b/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts @@ -2,10 +2,36 @@ #include "rtl8380_netgear_gigabit.dtsi" +#include + / { compatible = "netgear,gs310tp-v1", "realtek,rtl838x-soc"; model = "Netgear GS310TP v1"; + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_amber; + led-running = &led_power_green; + led-upgrade = &led_power_amber; + }; + + leds { + compatible = "gpio-leds"; + + led_power_amber: led-0 { + label = "amber:power"; + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio1 32 GPIO_ACTIVE_LOW>; + }; + + led_power_green: led-1 { + label = "green:power"; + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio1 31 GPIO_ACTIVE_LOW>; + }; + }; }; &gpio1 { From 04ecccf3e93badb4304a0c4caf843869e1e8e551 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 28 Feb 2025 16:29:20 +0100 Subject: [PATCH 02/12] realtek: Drop redundant LED labels Some devices have both the color/function and label property defined. The label can be constructed from the former properties, making it redundant. Signed-off-by: Sander Vanheule --- target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts | 2 -- target/linux/realtek/dts/rtl8393_hpe_1920.dtsi | 1 - 2 files changed, 3 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts b/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts index 6108462c67..7974e42359 100644 --- a/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts +++ b/target/linux/realtek/dts/rtl8380_netgear_gs310tp-v1.dts @@ -19,14 +19,12 @@ compatible = "gpio-leds"; led_power_amber: led-0 { - label = "amber:power"; color = ; function = LED_FUNCTION_POWER; gpios = <&gpio1 32 GPIO_ACTIVE_LOW>; }; led_power_green: led-1 { - label = "green:power"; color = ; function = LED_FUNCTION_POWER; gpios = <&gpio1 31 GPIO_ACTIVE_LOW>; diff --git a/target/linux/realtek/dts/rtl8393_hpe_1920.dtsi b/target/linux/realtek/dts/rtl8393_hpe_1920.dtsi index dda29e59e1..8af34be9a8 100644 --- a/target/linux/realtek/dts/rtl8393_hpe_1920.dtsi +++ b/target/linux/realtek/dts/rtl8393_hpe_1920.dtsi @@ -17,7 +17,6 @@ compatible = "gpio-leds"; led_power: led-0 { - label = "green:power"; color = ; function = LED_FUNCTION_POWER; gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; From 895b4e7cafc8282d7a617fd3e898ad3415f5b6b0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 24 Feb 2025 21:22:52 +0100 Subject: [PATCH 03/12] cli: add support for partial completion with separator character Useful for completing long lists of possible values with common prefix Signed-off-by: Felix Fietkau --- package/utils/cli/files/usr/sbin/cli | 5 ++- .../cli/files/usr/share/ucode/cli/context.uc | 31 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/package/utils/cli/files/usr/sbin/cli b/package/utils/cli/files/usr/sbin/cli index 0a763f2fdb..7d950e6adc 100755 --- a/package/utils/cli/files/usr/sbin/cli +++ b/package/utils/cli/files/usr/sbin/cli @@ -311,7 +311,10 @@ function completion(count) { add = " "; cat = ""; - add += sprintf("%-"+len+"s", entry.name); + let name = entry.name; + if (entry.incomplete) + name += "..."; + add += sprintf("%-"+len+"s", name); str += add; x += length(add); diff --git a/package/utils/cli/files/usr/share/ucode/cli/context.uc b/package/utils/cli/files/usr/share/ucode/cli/context.uc index b3f24f77a8..53b5f57047 100644 --- a/package/utils/cli/files/usr/share/ucode/cli/context.uc +++ b/package/utils/cli/files/usr/share/ucode/cli/context.uc @@ -355,7 +355,36 @@ function complete_arg_list(e, ctx, arg_info, args, base_args, named_args) for (let i = 0; i <= cur_idx; i++) val = shift(args); - return complete_param(e, ctx, cur, val, base_args, named_args); + let ret = complete_param(e, ctx, cur, val, base_args, named_args); + if (!cur.prefix_separator) + return ret; + + let prefix_len = length(val); + let vals = []; + let match_prefix; + for (let cur_val in ret.value) { + let cur_str = cur_val.name; + let cur_suffix = substr(cur_str, prefix_len); + let idx = index(cur_suffix, cur.prefix_separator); + if (idx < 0) { + push(vals, cur_val); + continue; + } + + let cur_prefix = substr(cur_str, 0, prefix_len + idx + 1); + if (cur_prefix == match_prefix) + continue; + + match_prefix = cur_prefix; + push(vals, { + ...cur_val, + name: cur_prefix, + incomplete: true + }); + } + ret.value = vals; + + return ret; } function handle_empty_param(entry, spec, name, argv, named_args) From bc078b833a27c260db7134cd53cc0dfffb494bce Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 25 Feb 2025 16:25:16 +0100 Subject: [PATCH 04/12] cli: add support for create/destroy object editor with single type Allows hooking create/destroy in a separate menu without having the user specify a type argument. Signed-off-by: Felix Fietkau --- .../usr/share/ucode/cli/object-editor.uc | 200 +++++++++++++----- 1 file changed, 148 insertions(+), 52 deletions(-) diff --git a/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc b/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc index c55bf40010..49e72f5c38 100644 --- a/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc +++ b/package/utils/cli/files/usr/share/ucode/cli/object-editor.uc @@ -306,34 +306,42 @@ export function new(info, node) export function object_destroy_call(ctx, argv, named) { - let type_name = argv[0]; - if (!type_name) - return ctx.invalid_argument(); - + let type_info, type_name; let info = this.object_info; - let type_info = info.types[type_name]; + if (info.types) { + type_name = shift(argv); + if (!type_name) + return ctx.invalid_argument(); + + type_info = info.types[type_name]; + } else { + type_info = info.type; + type_name = type_info.name; + } if (!type_info) return ctx.invalid_argument(); let obj_name = type_info.object ?? type_name; - let name = argv[1]; - if (type_info.delete) - return call(type_info.delete, info, ctx.model.scope, ctx, type, name); + let name = shift(argv); + if (type_info.delete) { + if (!call(type_info.delete, info, ctx.model.scope, ctx, type, name)) + return; + } else { + let obj = ctx.data.object_edit[obj_name]; + if (!obj) + return ctx.unknown_error(); - let obj = ctx.data.object_edit[obj_name]; - if (!obj) - return ctx.unknown_error(); + if (!obj[name]) + return ctx.not_found(); - if (!obj[name]) - return ctx.not_found(); - - delete obj[name]; + delete obj[name]; + } if (info.change_cb) call(info.change_cb, info, ctx.model.scope, ctx, argv); - return ctx.ok(`Deleted ${argv[0]} '${name}'`); + return ctx.ok(`Deleted ${type_name} '${name}'`); }; const create_edit_param = { @@ -361,34 +369,38 @@ export function object_create_params(node) export function object_create_call(ctx, argv, named) { - let type_name = argv[0]; - if (!type_name) - return ctx.invalid_argument(); - + let type_info, type_name; let info = this.object_info; - let type_info = info.types[type_name]; + if (info.types) { + type_name = shift(argv); + if (!type_name) + return ctx.invalid_argument(); + + type_info = info.types[type_name]; + } else { + type_info = info.type; + type_name = type_info.name; + } if (!type_info) return ctx.invalid_argument(); let obj_name = type_info.object ?? type_name; - let name = argv[1]; + let name = shift(argv); let obj, data; if (type_info.add) { - data = call(type_info.add, info, ctx.model.scope, ctx, type, name); + data = call(type_info.add, info, ctx.model.scope, ctx, type_name, name, named); if (!data) return; } else { data = {}; } - ctx.data.object_edit[obj_name] ??= {}; - obj = ctx.data.object_edit[obj_name]; - let entry = type_info.node.set; if (entry) { ctx.apply_defaults(); let subctx = ctx.clone(); + subctx.data.name = name; subctx.data.edit = data; try { @@ -404,10 +416,17 @@ export function object_create_call(ctx, argv, named) } } - obj[name] = data; + if (type_info.insert) { + if (!call(type_info.insert, info, ctx.model.scope, ctx, type_name, name, data, named)) + return; + } else { + ctx.data.object_edit[obj_name] ??= {}; + obj = ctx.data.object_edit[obj_name]; + obj[name] = data; + } if (named.edit) - ctx.select(type_name, name); + ctx.select(info.type ? "edit" : type_name, name); return ctx.ok(`Added ${type_name} '${name}'`); }; @@ -415,11 +434,19 @@ export function object_create_call(ctx, argv, named) function object_lookup(ctx, entry, type_name) { let info = entry.object_info; - let type_info = info.types[type_name]; + let type_info = info.types ? info.types[type_name] : info.type; if (!type_info) - return []; + return {}; - let obj_name = type_info.object ?? type_name; + if (type_info.get_object) { + let objs = call(type_info.get_object, info, ctx.model.scope, ctx, type_name); + if (type(objs) != "object") + objs = {}; + + return objs; + } + + let obj_name = type_info.object ?? (info.types ? type_name : type_info.name); return ctx.data.object_edit[obj_name]; } @@ -435,18 +462,65 @@ function object_values(ctx, entry, type_name) export function object_list_call(ctx, argv, named) { - return ctx.list(argv[0] + " list", object_values(ctx, this, argv[0])); + let info = this.object_info; + let type_name = info.types ? argv[0] : info.type.name; + return ctx.list(type_name + " list", object_values(ctx, this, type_name)); +}; + +function object_show_call_single(ctx, entry, type_info, type_name, name) +{ + let obj = object_lookup(ctx, entry, type_name); + if (!obj) + return; + + entry = obj[name]; + if (!entry) + return; + + let callctx = ctx.clone(); + callctx.data.name = name; + callctx.data.edit = entry; + + call(type_info.node.show.call, type_info.node.show, ctx.model.scope, callctx, [], {}); + if (callctx.result.ok) + return callctx.result.data; +} + +export function object_show_call(ctx, argv, named) +{ + let info = this.object_info; + let type_name = info.type.name; + + if (argv[0]) { + let data = object_show_call_single(ctx, this, info.type, type_name, argv[0]); + if (!data) + return; + return ctx.table("Values", data); + } + + let ret = {}; + for (let name in object_values(ctx, this, type_name)) { + let data = object_show_call_single(ctx, this, info.type, type_name, name); + if (!data) + continue; + ret[type_name + " " + name] = data; + } + + return ctx.multi_table(type_name + " list", ret); }; export function edit_create_destroy(info, node) { - let type_arg = { - name: "type", - help: "Type", - type: "enum", - required: true, - value: keys(info.types), - }; + let type_arg = []; + if (info.types) + type_arg = [{ + name: "type", + help: "Type", + type: "enum", + required: true, + value: keys(info.types), + }]; + let name_arg = { name: "name", help: "Name", @@ -460,31 +534,41 @@ export function edit_create_destroy(info, node) return object_values(ctx, this, argv[0]); } }; + let show_name_arg = { + ...delete_name_arg, + required: false, + }; let create_params = {}; - for (let name, val in info.types) - create_params[name] = object_create_params(val.node); + if (info.types) { + for (let name, val in info.types) + create_params[name] = object_create_params(val.node); + } else { + create_params = object_create_params(info.type.node); + } - let types_info = " (" + join(", ", keys(info.types)) + ")"; + let types_info = info.types ? "(" + join(", ", keys(info.types)) + ")" : info.type.name; let cmds = { destroy: { object_info: info, - help: "Delete object" + types_info, - args: [ type_arg, delete_name_arg ], + help: "Delete " + types_info, + args: [ ...type_arg, delete_name_arg ], call: object_destroy_call, }, list: { object_info: info, - help: "List objects" + types_info, - args: [ type_arg ], + help: "List " + types_info, + args: [ ...type_arg ], call: object_list_call, }, create: { object_info: info, - help: "Create object" + types_info, - args: [ type_arg, name_arg ], + help: "Create " + types_info, + args: [ ...type_arg, name_arg ], type_params: create_params, named_args: function(ctx, argv) { + if (!this.object_info.types) + return this.type_params; if (!argv[0]) return; return this.type_params[argv[0]]; @@ -493,8 +577,22 @@ export function edit_create_destroy(info, node) }, }; - for (let name, val in info.types) { - cmds[name] = { + + let info_types = info.types; + if (!info_types) { + info_types = {}; + info_types[info.type.name] = info.type; + cmds.show = { + object_info: info, + help: "Show " + types_info, + args: [ show_name_arg ], + call: object_show_call, + }; + } + + for (let name, val in info_types) { + let cmd_name = info.types ? name : "edit"; + cmds[cmd_name] = { object_name: name, object_info: info, help: "Edit " + name, @@ -527,8 +625,6 @@ export function edit_create_destroy(info, node) return; } - let info = this.object_info; - let type_info = info.types[this.object_name]; return ctx.set(`${this.object_name} "${name}"`, { name, edit: entry, From 795337640073d0f15f6f60a91048c8b2295b9994 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 26 Feb 2025 10:35:02 +0100 Subject: [PATCH 05/12] cli: use model scope for hook calls Make the scope consistent with other callbacks Signed-off-by: Felix Fietkau --- package/network/services/unetd/files/unet.uc | 6 +++--- package/utils/cli/files/usr/share/ucode/cli/datamodel.uc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/unetd/files/unet.uc b/package/network/services/unetd/files/unet.uc index b884e23f60..023ea3e6b8 100644 --- a/package/network/services/unetd/files/unet.uc +++ b/package/network/services/unetd/files/unet.uc @@ -151,7 +151,7 @@ function network_sign_data(ctx, name, network, pw_file, upload) return true; } -function network_create_uci(name, iface) +function network_create_uci(model, name, iface) { let cur = uci.cursor(); cur.set("network", name, "interface"); @@ -344,7 +344,7 @@ function network_create(ctx, argv, named) { if (!network_sign_data(ctx, named.network, network, pw_file)) return; - network_create_uci(named.network, { + network_create_uci(ctx.model, named.network, { proto: "unet", metric: named.metric, zone: named.zone, @@ -580,7 +580,7 @@ function network_join_peer_update(model, ctx, msg) if (joinreq.connect) iface.connect = joinreq.connect; - network_create_uci(name, iface); + network_create_uci(model, name, iface); model.status_msg("Configuration added for interface " + name); diff --git a/package/utils/cli/files/usr/share/ucode/cli/datamodel.uc b/package/utils/cli/files/usr/share/ucode/cli/datamodel.uc index bc78a7b12b..f6d9454dd7 100644 --- a/package/utils/cli/files/usr/share/ucode/cli/datamodel.uc +++ b/package/utils/cli/files/usr/share/ucode/cli/datamodel.uc @@ -122,7 +122,7 @@ function run_hook(name, ...args) return; for (let hook in hooks) - call(hook, this, {}, ...args); + call(hook, this, this.scope, ...args); } function init() From 8835ecf29b0610dc00bdd6e15578ec52699184c2 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 27 Feb 2025 11:21:22 +0100 Subject: [PATCH 06/12] ucode-mod-uline: add support for querying window size from terminal if ioctl fails This is useful for running the cli on a serial console Signed-off-by: Felix Fietkau --- package/utils/ucode-mod-uline/src/private.h | 14 +++++- package/utils/ucode-mod-uline/src/uline.c | 43 ++++++++++++----- package/utils/ucode-mod-uline/src/uline.h | 3 +- package/utils/ucode-mod-uline/src/vt100.c | 51 +++++++++++++-------- 4 files changed, 78 insertions(+), 33 deletions(-) diff --git a/package/utils/ucode-mod-uline/src/private.h b/package/utils/ucode-mod-uline/src/private.h index fa38d06737..e53ec22e03 100644 --- a/package/utils/ucode-mod-uline/src/private.h +++ b/package/utils/ucode-mod-uline/src/private.h @@ -52,6 +52,7 @@ enum vt100_escape { VT100_CURSOR_WORD_LEFT, VT100_CURSOR_RIGHT, VT100_CURSOR_WORD_RIGHT, + VT100_CURSOR_POS, VT100_HOME, VT100_END, VT100_INSERT, @@ -63,7 +64,7 @@ enum vt100_escape { }; ssize_t utf8_nsyms(const char *str, size_t len); -enum vt100_escape vt100_esc_decode(const char *str); +enum vt100_escape vt100_esc_decode(const char *str, uint32_t *data); // helpers: void __vt100_csi_num(FILE *out, int num, char code); @@ -191,4 +192,15 @@ static inline void vt100_ding(FILE *out) fflush(out); } +static inline void vt100_request_window_size(FILE *out) +{ + fputs( + "\e7" /* save cursor position */ + "\e[r" /* reset margins */ + "\e[999;999H" /* move cursor to bottom right */ + "\e[6n" /* report cursor position */ + "\e8", /* restore cursor position */ + out); +} + #endif diff --git a/package/utils/ucode-mod-uline/src/uline.c b/package/utils/ucode-mod-uline/src/uline.c index 26cea6fa24..17d1d69bc2 100644 --- a/package/utils/ucode-mod-uline/src/uline.c +++ b/package/utils/ucode-mod-uline/src/uline.c @@ -101,13 +101,16 @@ update_window_size(struct uline_state *s, bool init) #ifdef TIOCGWINSZ struct winsize ws = {}; - if (!ioctl(fileno(s->output), TIOCGWINSZ, &ws)) { - if (ws.ws_col) - cols = ws.ws_col; - if (ws.ws_row) - rows = ws.ws_row; - } + if (s->ioctl_winsize && + !ioctl(fileno(s->output), TIOCGWINSZ, &ws) && + ws.ws_col && ws.ws_row) { + cols = ws.ws_col; + rows = ws.ws_row; + } else #endif + { + s->ioctl_winsize = false; + } s->sigwinch_count = sigwinch_count; if (s->cols == cols && s->rows == rows) @@ -534,7 +537,7 @@ move_word_right(struct uline_state *s, struct linebuf *line) } static bool -process_esc(struct uline_state *s, enum vt100_escape esc) +process_esc(struct uline_state *s, enum vt100_escape esc, uint32_t data) { struct linebuf *line = &s->line; @@ -552,6 +555,15 @@ process_esc(struct uline_state *s, enum vt100_escape esc) return move_right(s, line); case VT100_CURSOR_WORD_RIGHT: return move_word_right(s, line); + case VT100_CURSOR_POS: + if (s->rows == (data & 0xffff) && + s->cols == data >> 16) + return false; + s->rows = data & 0xffff; + s->cols = data >> 16; + s->full_update = true; + s->cb->event(s, EDITLINE_EV_WINDOW_CHANGED); + return true; case VT100_HOME: line->pos = 0; return true; @@ -682,9 +694,9 @@ process_ctrl(struct uline_state *s, char c) linebuf_reset(line); return true; case KEY_SOH: - return process_esc(s, VT100_HOME); + return process_esc(s, VT100_HOME, 0); case KEY_ENQ: - return process_esc(s, VT100_END); + return process_esc(s, VT100_END, 0); case KEY_VT: // TODO: kill return false; @@ -718,18 +730,19 @@ static void process_char(struct uline_state *s, char c) { enum vt100_escape esc; + uint32_t data = 0; check_key_repeat(s, c); if (s->esc_idx >= 0) { s->esc_seq[s->esc_idx++] = c; s->esc_seq[s->esc_idx] = 0; - esc = vt100_esc_decode(s->esc_seq); + esc = vt100_esc_decode(s->esc_seq, &data); if (esc == VT100_INCOMPLETE && s->esc_idx < (int)sizeof(s->esc_seq) - 1) return; s->esc_idx = -1; - if (!process_esc(s, esc)) + if (!process_esc(s, esc, data)) return; } else if (s->cb->key_input && !check_utf8(s, (unsigned char )c) && @@ -901,7 +914,7 @@ void uline_init(struct uline_state *s, const struct uline_cb *cb, s->utf8 = utf8; s->input = in_fd; s->output = out_stream; - update_window_size(s, true); + s->ioctl_winsize = true; reset_input_state(s); #ifdef USE_SYSTEM_WCHAR @@ -916,6 +929,12 @@ void uline_init(struct uline_state *s, const struct uline_cb *cb, s->has_termios = true; termios_set_native_mode(s); } + + update_window_size(s, true); + if (!s->ioctl_winsize) { + vt100_request_window_size(s->output); + fflush(s->output); + } } void uline_free(struct uline_state *s) diff --git a/package/utils/ucode-mod-uline/src/uline.h b/package/utils/ucode-mod-uline/src/uline.h index 6f7b75542f..514675e799 100644 --- a/package/utils/ucode-mod-uline/src/uline.h +++ b/package/utils/ucode-mod-uline/src/uline.h @@ -82,12 +82,13 @@ struct uline_state { unsigned int rows, cols; struct pos cursor_pos; struct pos end_pos; + bool ioctl_winsize; bool full_update; bool stop; bool utf8; - char esc_seq[8]; + char esc_seq[32]; int8_t esc_idx; uint8_t utf8_cont; }; diff --git a/package/utils/ucode-mod-uline/src/vt100.c b/package/utils/ucode-mod-uline/src/vt100.c index b13e6a6722..f81b11d3ad 100644 --- a/package/utils/ucode-mod-uline/src/vt100.c +++ b/package/utils/ucode-mod-uline/src/vt100.c @@ -7,10 +7,10 @@ #include "uline.h" #include "private.h" -enum vt100_escape vt100_esc_decode(const char *str) +enum vt100_escape vt100_esc_decode(const char *str, uint32_t *data) { - unsigned long code; - size_t idx; + unsigned long code, code2; + char *err; switch (*(str++)) { case 0: @@ -45,23 +45,36 @@ enum vt100_escape vt100_esc_decode(const char *str) case '0' ... '4': case '6' ... '9': str--; - idx = strspn(str, "0123456789"); - if (!str[idx]) + code = strtoul(str, &err, 10); + switch (*err) { + case 0: return VT100_INCOMPLETE; - if (str[idx] != '~') - return VT100_UNKNOWN; - code = strtoul(str, NULL, 10); - switch (code) { - case 1: - return VT100_HOME; - case 3: - return VT100_DELETE; - case 4: - return VT100_END; - case 200: - case 201: - // paste start/end - return VT100_IGNORE; + case '~': + switch (code) { + case 1: + return VT100_HOME; + case 3: + return VT100_DELETE; + case 4: + return VT100_END; + case 200: + case 201: + // paste start/end + return VT100_IGNORE; + default: + return VT100_UNKNOWN; + } + case ';': + code2 = strtoul(err + 1, &err, 10); + switch (*err) { + case 0: + return VT100_INCOMPLETE; + case 'R': + *data = (code2 << 16) | (code & 0xffff); + return VT100_CURSOR_POS; + default: + return VT100_UNKNOWN; + } default: return VT100_UNKNOWN; } From ce68f61cb67a4701a108f838f510e72ca63ed78e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 28 Feb 2025 16:27:36 +0100 Subject: [PATCH 07/12] unetd: update to Git HEAD (2025-02-28) 75a236be122a service: add missing null pointer check f5341f327539 ubus: add api for generating and validating security tokens 3fab99eab4d5 add udebug support 28d86bd30e97 pex: only respond to update requests when we have network data 8e6f37cc361e pex-msg: ignore no-data responses if version is zero 12e6cf7f63e1 pex: create pex host from update responses edc8fdae463a ubus: show the local addresses in network status Signed-off-by: Felix Fietkau --- package/network/services/unetd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/unetd/Makefile b/package/network/services/unetd/Makefile index 94ae13dc48..64b3b63421 100644 --- a/package/network/services/unetd/Makefile +++ b/package/network/services/unetd/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=unetd PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/unetd.git -PKG_SOURCE_DATE:=2025-01-29 -PKG_SOURCE_VERSION:=082b5482b97f20dc4745bc3d645e33b584cc28e4 -PKG_MIRROR_HASH:=090e7dab3b9a3358706dcee4f1889b7a1f0bdf535f2d6a0580f4160e23ccf9cb +PKG_SOURCE_DATE:=2025-02-28 +PKG_SOURCE_VERSION:=edc8fdae463ad7ce9bfb876af0c653ab1da197df +PKG_MIRROR_HASH:=2f0ce439b9e4815b3f20b9aaf4378e3aac114f429bb8bfd06739df118b3da9c8 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau @@ -32,7 +32,7 @@ define Package/unetd SECTION:=net CATEGORY:=Network TITLE:=WireGuard based VPN connection manager for OpenWrt - DEPENDS:=+libubox +libubus +libblobmsg-json +libnl-tiny +kmod-wireguard +UNETD_VXLAN_SUPPORT:libbpf + DEPENDS:=+libubox +libubus +libudebug +libblobmsg-json +libnl-tiny +kmod-wireguard +UNETD_VXLAN_SUPPORT:libbpf endef define Package/unetd/config From d50d51d74e93a057c607c9a4081ff3f29cbab38f Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Mon, 17 Feb 2025 19:25:02 +0100 Subject: [PATCH 08/12] mediatek: filogic: migrate Zyxel NWA50AX Pro to upstream PHY LED control This commit switches the control of the leds connected to the Maxlinear GPY211C PHY to an upstream solution. There should be no functional changes. Signed-off-by: Aleksander Jan Bajkowski --- .../mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts | 18 ++++++++++++++++-- .../filogic/base-files/etc/board.d/01_leds | 4 ++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts index 95247eba9d..ef72ca4ba3 100644 --- a/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-zyxel-nwa50ax-pro.dts @@ -85,8 +85,22 @@ reg = <5>; compatible = "ethernet-phy-ieee802.3-c45"; - /* LED0: Amber ; LED1: nc ; LED2: nc ; LED3: Green */ - mxl,led-config = <0x3b0 0x0 0x0 0x3c0>; + leds { + #address-cells = <1>; + #size-cells = <0>; + + led-0 { + reg = <0>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led-3 { + reg = <3>; + color = ; + function = LED_FUNCTION_WAN; + }; + }; }; }; 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 4e1d10a4dc..3287cfe29b 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 @@ -150,6 +150,10 @@ zyxel,ex5601-t0-ubootmod) ucidef_set_led_netdev "wifi-24g" "WIFI-2.4G" "green:wifi24g" "phy0-ap0" "link tx rx" ucidef_set_led_netdev "wifi-5g" "WIFI-5G" "green:wifi5g" "phy1-ap0" "link tx rx" ;; +zyxel,nwa50ax-pro) + ucidef_set_led_netdev "uplink" "UPLINK" "mdio-bus:05:amber:wan" "eth0" "link_10 link_100 link_2500 tx rx" + ucidef_set_led_netdev "uplink" "UPLINK" "mdio-bus:05:green:wan" "eth0" "link_1000 link_2500 tx rx" + ;; esac board_config_flush From 25ea7ff393a17d7bb3e037e9536143d9707e7d7a Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sun, 16 Feb 2025 23:23:17 +0100 Subject: [PATCH 09/12] mediatek: filogic: migrate Acer W6/W6d to upstream PHY LED control This commit switches the control of the leds connected to the Maxlinear GPY211C PHY to an upstream solution. There should be no functional changes. Signed-off-by: Aleksander Jan Bajkowski --- .../mediatek/dts/mt7986a-acer-predator-w6.dts | 19 +++++++++++++++++-- .../dts/mt7986a-acer-predator-w6d.dts | 19 +++++++++++++++++-- .../filogic/base-files/etc/board.d/01_leds | 5 +++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts index 5002326d70..2fcbf3aa96 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts @@ -186,8 +186,23 @@ reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; reset-assert-us = <10000>; reset-deassert-us = <10000>; - /* LED0: nc ; LED1: nc ; LED2: amber ; LED3: green */ - mxl,led-config = <0x0 0x0 0x370 0x380>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led-2 { + reg = <2>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led-3 { + reg = <3>; + color = ; + function = LED_FUNCTION_WAN; + }; + }; }; }; diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts index b2c35a6197..275f4134de 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts @@ -172,8 +172,23 @@ reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; reset-assert-us = <10000>; reset-deassert-us = <10000>; - /* LED0: nc ; LED1: nc ; LED2: amber ; LED3: green */ - mxl,led-config = <0x0 0x0 0x370 0x380>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led-2 { + reg = <2>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led-3 { + reg = <3>; + color = ; + function = LED_FUNCTION_WAN; + }; + }; }; }; 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 3287cfe29b..53a0e1ad6f 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 @@ -11,6 +11,11 @@ abt,asr3000) ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan-2ghz" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wlan-5ghz" "phy1-ap0" ;; +acer,predator-w6|\ +acer,predator-w6d) + ucidef_set_led_netdev "internet" "INTERNET" "mdio-bus:06:amber:wan" "eth1" "link_10 link_100 link_1000 tx rx" + ucidef_set_led_netdev "internet" "INTERNET" "mdio-bus:06:green:wan" "eth1" "link_2500 tx rx" + ;; asus,tuf-ax4200) ucidef_set_led_netdev "wan" "WAN" "mdio-bus:06:white:wan" "eth1" "link tx rx" ;; From 7560af7647d12ac41d4fb2d179f1940ad13196fe Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Wed, 12 Feb 2025 22:12:28 +0100 Subject: [PATCH 10/12] mediatek: filogic: migrate ASUS TUF AX6000 to upstream PHY LED control This commit switches the control of the leds connected to the Maxlinear GPY211C PHY to an upstream solution. There should be no functional changes. Signed-off-by: Aleksander Jan Bajkowski --- .../mediatek/dts/mt7986a-asus-tuf-ax6000.dts | 25 ++++++++++++++++--- .../filogic/base-files/etc/board.d/01_leds | 4 +++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts index 9a0f7594c9..5a615aa238 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts @@ -146,16 +146,33 @@ compatible = "ethernet-phy-ieee802.3-c45"; reg = <5>; - mxl,led-drive-vdd; - mxl,led-config = <0x03f0 0x0 0x0 0x0>; + leds { + #address-cells = <1>; + #size-cells = <0>; + + led-0 { + reg = <0>; + active-high; + color = ; + function = LED_FUNCTION_LAN; + }; + }; }; phy6: phy@6 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <6>; - /* LED0: CONN (WAN white) */ - mxl,led-config = <0x03f0 0x0 0x0 0x0>; + leds { + #address-cells = <1>; + #size-cells = <0>; + + led-0 { + reg = <0>; + color = ; + function = LED_FUNCTION_WAN; + }; + }; }; switch: switch@1f { 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 53a0e1ad6f..5f56685343 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 @@ -19,6 +19,10 @@ acer,predator-w6d) asus,tuf-ax4200) ucidef_set_led_netdev "wan" "WAN" "mdio-bus:06:white:wan" "eth1" "link tx rx" ;; +asus,tuf-ax6000) + ucidef_set_led_netdev "lan5" "LAN5" "mdio-bus:05:white:lan" "lan5" "link tx rx" + ucidef_set_led_netdev "wan" "WAN" "mdio-bus:06:white:wan" "eth1" "link tx rx" + ;; confiabits,mt7981) ucidef_set_led_netdev "lan1" "lan1" "blue:lan-1" "lan1" "link tx rx" ucidef_set_led_netdev "lan2" "lan2" "blue:lan-2" "lan2" "link tx rx" From 86fd00b0fb83300ed7bd39af137a495c61253713 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 27 Feb 2025 15:06:51 -0500 Subject: [PATCH 11/12] kernel: bump 6.6 to 6.6.80 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.80 Removed upstreamed: generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch[1] generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch[2] generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch[3] All other patches automatically rebased. 1. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.80&id=39dfc17a38f77b14f7cb2619bd3488a18d797d5d 2. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.80&id=276dae17ad9757c3813d9e736a0210f05ccdf8b7 3. https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.80&id=a0ee898a5024f12572e4ce45202df9b149dadc05 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/18140 Signed-off-by: Robert Marko --- include/kernel-6.6 | 4 +- .../900-unaligned_access_hacks.patch | 2 +- ...rs-remove-legacy_cursor_update-hacks.patch | 2 +- ...tional-threaded-NAPI-wakeup-based-on.patch | 6 +- ...-to-use-SMP-threads-for-backlog-NAPI.patch | 22 +-- ...klog-NAPI-to-clean-up-the-defer_list.patch | 4 +- ...-net-Rename-rps_lock-to-backlog_lock.patch | 18 +- ...-net-Make-USO-depend-on-CSUM-offload.patch | 6 +- ...64-if-device-if-driver-is-configured.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 8 +- ...t-introduce-napi_is_scheduled-helper.patch | 2 +- ...4-Revert-nvmem-add-new-config-option.patch | 6 +- ...mem_layout_get_container-in-another-.patch | 4 +- ...Create-a-header-for-internal-sharing.patch | 91 ---------- ...03-nvmem-Simplify-the-add_cells-hook.patch | 79 -------- ...vmem-Move-and-rename-fixup_cell_info.patch | 169 ------------------ ...1-nvmem-imx-ocotp-ele-support-i.MX95.patch | 2 +- ...et-free_netdev-exit-earlier-if-dummy.patch | 2 +- .../721-net-add-packet-mangeling.patch | 2 +- ...680-net-add-TCP-fraglist-GRO-support.patch | 2 +- ...are-qcom_scm-disable-SDI-if-required.patch | 2 +- ...qcom_scm-Clear-download-bit-during-r.patch | 2 +- ...are-qcom-scm-disable-SDI-if-required.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- 24 files changed, 51 insertions(+), 390 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch delete mode 100644 target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch delete mode 100644 target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 2e70a47f1d..1c34069947 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .79 -LINUX_KERNEL_HASH-6.6.79 = 07a6f904470da1a099aa1683e3025a999dd82f2438f78b006b80c6ae2e9dfe8d +LINUX_VERSION-6.6 = .80 +LINUX_KERNEL_HASH-6.6.80 = 6cf911d01324f45c9dd2f44cf06f55bda0ecf383bc498f132a0c549768531327 diff --git a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch index 51f4f542d8..91e39d7d24 100644 --- a/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.6/900-unaligned_access_hacks.patch @@ -751,7 +751,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4262,14 +4262,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4268,14 +4268,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch index 97bc25b565..4c3ff50b8c 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0025-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch @@ -89,7 +89,7 @@ Signed-off-by: Maxime Ripard commit->event = kzalloc(sizeof(*commit->event), --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c -@@ -7280,6 +7280,19 @@ int intel_atomic_commit(struct drm_devic +@@ -7298,6 +7298,19 @@ int intel_atomic_commit(struct drm_devic state->base.legacy_cursor_update = false; } diff --git a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch index a6164c8238..afaa5328ca 100644 --- a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch +++ b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch @@ -32,7 +32,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4483,13 +4483,7 @@ static inline void ____napi_schedule(str +@@ -4514,13 +4514,7 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -47,7 +47,7 @@ Signed-off-by: Paolo Abeni wake_up_process(thread); return; } -@@ -6645,8 +6639,6 @@ static int napi_poll(struct napi_struct +@@ -6676,8 +6670,6 @@ static int napi_poll(struct napi_struct static int napi_thread_wait(struct napi_struct *napi) { @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { -@@ -6655,15 +6647,13 @@ static int napi_thread_wait(struct napi_ +@@ -6686,15 +6678,13 @@ static int napi_thread_wait(struct napi_ * Testing SCHED bit is not enough because SCHED bit might be * set by some other busy poll thread or by napi_disable(). */ diff --git a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch index 3de258f953..98cd35ed84 100644 --- a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch +++ b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch @@ -108,7 +108,7 @@ Signed-off-by: Paolo Abeni static inline void rps_lock_irqsave(struct softnet_data *sd, unsigned long *flags) { -@@ -4451,6 +4477,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); +@@ -4482,6 +4508,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); /************************************************************************* * Receiver routines *************************************************************************/ @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni int netdev_max_backlog __read_mostly = 1000; EXPORT_SYMBOL(netdev_max_backlog); -@@ -4483,12 +4510,16 @@ static inline void ____napi_schedule(str +@@ -4514,12 +4541,16 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -133,7 +133,7 @@ Signed-off-by: Paolo Abeni list_add_tail(&napi->poll_list, &sd->poll_list); WRITE_ONCE(napi->list_owner, smp_processor_id()); /* If not called from net_rx_action() -@@ -4734,6 +4765,11 @@ static void napi_schedule_rps(struct sof +@@ -4765,6 +4796,11 @@ static void napi_schedule_rps(struct sof #ifdef CONFIG_RPS if (sd != mysd) { @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5957,7 +5993,7 @@ static void net_rps_action_and_irq_enabl +@@ -5988,7 +6024,7 @@ static void net_rps_action_and_irq_enabl #ifdef CONFIG_RPS struct softnet_data *remsd = sd->rps_ipi_list; @@ -154,7 +154,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_list = NULL; local_irq_enable(); -@@ -5972,7 +6008,7 @@ static void net_rps_action_and_irq_enabl +@@ -6003,7 +6039,7 @@ static void net_rps_action_and_irq_enabl static bool sd_has_rps_ipi_waiting(struct softnet_data *sd) { #ifdef CONFIG_RPS @@ -163,7 +163,7 @@ Signed-off-by: Paolo Abeni #else return false; #endif -@@ -6016,7 +6052,7 @@ static int process_backlog(struct napi_s +@@ -6047,7 +6083,7 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -172,7 +172,7 @@ Signed-off-by: Paolo Abeni again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6682,43 +6718,48 @@ static void skb_defer_free_flush(struct +@@ -6713,43 +6749,48 @@ static void skb_defer_free_flush(struct } } @@ -250,7 +250,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -11303,7 +11344,7 @@ static int dev_cpu_dead(unsigned int old +@@ -11334,7 +11375,7 @@ static int dev_cpu_dead(unsigned int old list_del_init(&napi->poll_list); if (napi->poll == process_backlog) @@ -259,7 +259,7 @@ Signed-off-by: Paolo Abeni else ____napi_schedule(sd, napi); } -@@ -11311,12 +11352,14 @@ static int dev_cpu_dead(unsigned int old +@@ -11342,12 +11383,14 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -278,7 +278,7 @@ Signed-off-by: Paolo Abeni /* Process offline CPU's input_pkt_queue */ while ((skb = __skb_dequeue(&oldsd->process_queue))) { -@@ -11579,6 +11622,38 @@ static struct pernet_operations __net_in +@@ -11610,6 +11653,38 @@ static struct pernet_operations __net_in * */ @@ -317,7 +317,7 @@ Signed-off-by: Paolo Abeni /* * This is called single threaded during boot, so no need * to take the rtnl semaphore. -@@ -11629,7 +11704,10 @@ static int __init net_dev_init(void) +@@ -11660,7 +11735,10 @@ static int __init net_dev_init(void) init_gro_hash(&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index 9af345002a..d38231684d 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -36,7 +36,7 @@ Signed-off-by: Paolo Abeni --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -3306,6 +3306,7 @@ static inline void dev_xmit_recursion_de +@@ -3308,6 +3308,7 @@ static inline void dev_xmit_recursion_de __this_cpu_dec(softnet_data.xmit.recursion); } @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni spin_unlock_irq(&sd->input_pkt_queue.lock); else if (!IS_ENABLED(CONFIG_PREEMPT_RT)) local_irq_enable(); -@@ -4784,6 +4784,23 @@ static void napi_schedule_rps(struct sof +@@ -4815,6 +4815,23 @@ static void napi_schedule_rps(struct sof __napi_schedule_irqoff(&mysd->backlog); } diff --git a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch index a6199cd250..33ebe5d2a6 100644 --- a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch +++ b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch @@ -67,7 +67,7 @@ Signed-off-by: Paolo Abeni { if (IS_ENABLED(CONFIG_RPS) || use_backlog_threads()) spin_unlock_irq(&sd->input_pkt_queue.lock); -@@ -4789,12 +4789,12 @@ void kick_defer_list_purge(struct softne +@@ -4820,12 +4820,12 @@ void kick_defer_list_purge(struct softne unsigned long flags; if (use_backlog_threads()) { @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni } else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) { smp_call_function_single_async(cpu, &sd->defer_csd); -@@ -4856,7 +4856,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4887,7 +4887,7 @@ static int enqueue_to_backlog(struct sk_ reason = SKB_DROP_REASON_NOT_SPECIFIED; sd = &per_cpu(softnet_data, cpu); @@ -91,7 +91,7 @@ Signed-off-by: Paolo Abeni if (!netif_running(skb->dev)) goto drop; qlen = skb_queue_len(&sd->input_pkt_queue); -@@ -4865,7 +4865,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4896,7 +4896,7 @@ static int enqueue_to_backlog(struct sk_ enqueue: __skb_queue_tail(&sd->input_pkt_queue, skb); input_queue_tail_incr_save(sd, qtail); @@ -100,7 +100,7 @@ Signed-off-by: Paolo Abeni return NET_RX_SUCCESS; } -@@ -4880,7 +4880,7 @@ enqueue: +@@ -4911,7 +4911,7 @@ enqueue: drop: sd->dropped++; @@ -109,7 +109,7 @@ Signed-off-by: Paolo Abeni dev_core_stats_rx_dropped_inc(skb->dev); kfree_skb_reason(skb, reason); -@@ -5911,7 +5911,7 @@ static void flush_backlog(struct work_st +@@ -5942,7 +5942,7 @@ static void flush_backlog(struct work_st local_bh_disable(); sd = this_cpu_ptr(&softnet_data); @@ -118,7 +118,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->input_pkt_queue); -@@ -5919,7 +5919,7 @@ static void flush_backlog(struct work_st +@@ -5950,7 +5950,7 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { -@@ -5937,14 +5937,14 @@ static bool flush_required(int cpu) +@@ -5968,14 +5968,14 @@ static bool flush_required(int cpu) struct softnet_data *sd = &per_cpu(softnet_data, cpu); bool do_flush; @@ -144,7 +144,7 @@ Signed-off-by: Paolo Abeni return do_flush; #endif -@@ -6059,7 +6059,7 @@ static int process_backlog(struct napi_s +@@ -6090,7 +6090,7 @@ static int process_backlog(struct napi_s } @@ -153,7 +153,7 @@ Signed-off-by: Paolo Abeni if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6075,7 +6075,7 @@ static int process_backlog(struct napi_s +@@ -6106,7 +6106,7 @@ static int process_backlog(struct napi_s skb_queue_splice_tail_init(&sd->input_pkt_queue, &sd->process_queue); } diff --git a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch index 6cd162ff1c..0ccf0e30d6 100644 --- a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch +++ b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -9765,6 +9765,15 @@ static void netdev_sync_lower_features(s +@@ -9796,6 +9796,15 @@ static void netdev_sync_lower_features(s } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static netdev_features_t netdev_fix_features(struct net_device *dev, netdev_features_t features) { -@@ -9846,15 +9855,9 @@ static netdev_features_t netdev_fix_feat +@@ -9877,15 +9886,9 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_LRO; } @@ -55,7 +55,7 @@ Signed-off-by: Jakub Kicinski } if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { -@@ -9862,6 +9865,11 @@ static netdev_features_t netdev_fix_feat +@@ -9893,6 +9896,11 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_HW_TLS_RX; } diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch index 21ba0acc5b..c27ccc1942 100644 --- a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch +++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10672,6 +10672,8 @@ struct rtnl_link_stats64 *dev_get_stats( +@@ -10703,6 +10703,8 @@ struct rtnl_link_stats64 *dev_get_stats( ops->ndo_get_stats64(dev, storage); } else if (ops->ndo_get_stats) { netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index 8b562a0f61..dd0640e2ee 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -4567,6 +4567,9 @@ static inline void netif_addr_unlock_bh( +@@ -4569,6 +4569,9 @@ static inline void netif_addr_unlock_bh( void ether_setup(struct net_device *dev); @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller unsigned char name_assign_type, --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10359,25 +10359,12 @@ err_free_name: +@@ -10390,25 +10390,12 @@ err_free_name: } EXPORT_SYMBOL(register_netdevice); @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /* make sure we BUG if trying to hit standard * register/unregister code path */ -@@ -10397,12 +10384,32 @@ int init_dummy_netdev(struct net_device +@@ -10428,12 +10415,32 @@ int init_dummy_netdev(struct net_device * because users of this 'device' dont need to change * its refcount. */ @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller /** * register_netdev - register a network device * @dev: device to register -@@ -10996,6 +11003,19 @@ void free_netdev(struct net_device *dev) +@@ -11027,6 +11034,19 @@ void free_netdev(struct net_device *dev) EXPORT_SYMBOL(free_netdev); /** diff --git a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch index 2bf136e18a..319bc3e47b 100644 --- a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch +++ b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni /** --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6612,7 +6612,7 @@ static int __napi_poll(struct napi_struc +@@ -6643,7 +6643,7 @@ static int __napi_poll(struct napi_struc * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; diff --git a/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch b/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch index 36d15248b8..9c22568f72 100644 --- a/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch +++ b/target/linux/generic/backport-6.6/816-v6.7-0004-Revert-nvmem-add-new-config-option.patch @@ -48,7 +48,7 @@ Signed-off-by: Greg Kroah-Hartman mtd->nvmem = nvmem_register(&config); --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -940,7 +940,7 @@ struct nvmem_device *nvmem_register(cons +@@ -918,7 +918,7 @@ struct nvmem_device *nvmem_register(cons nvmem->nkeepout = config->nkeepout; if (config->of_node) nvmem->dev.of_node = config->of_node; @@ -59,7 +59,7 @@ Signed-off-by: Greg Kroah-Hartman switch (config->id) { --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h -@@ -89,7 +89,6 @@ struct nvmem_cell_info { +@@ -91,7 +91,6 @@ struct nvmem_cell_info { * @read_only: Device is read-only. * @root_only: Device is accessibly to root only. * @of_node: If given, this will be used instead of the parent's of_node. @@ -67,7 +67,7 @@ Signed-off-by: Greg Kroah-Hartman * @reg_read: Callback to read data. * @reg_write: Callback to write data. * @size: Device size. -@@ -122,7 +121,6 @@ struct nvmem_config { +@@ -126,7 +125,6 @@ struct nvmem_config { bool ignore_wp; struct nvmem_layout *layout; struct device_node *of_node; diff --git a/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch b/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch index 0290d64898..c1f5ecf665 100644 --- a/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch +++ b/target/linux/generic/backport-6.6/819-v6.8-0001-nvmem-Move-of_nvmem_layout_get_container-in-another-.patch @@ -25,7 +25,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -846,14 +846,6 @@ static int nvmem_add_cells_from_layout(s +@@ -823,14 +823,6 @@ static int nvmem_add_cells_from_layout(s } #if IS_ENABLED(CONFIG_OF) @@ -65,7 +65,7 @@ Signed-off-by: Greg Kroah-Hartman #endif /* ifndef _LINUX_NVMEM_CONSUMER_H */ --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h -@@ -244,6 +244,27 @@ nvmem_layout_get_match_data(struct nvmem +@@ -241,6 +241,27 @@ nvmem_layout_get_match_data(struct nvmem #endif /* CONFIG_NVMEM */ diff --git a/target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch b/target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch deleted file mode 100644 index b03ce68092..0000000000 --- a/target/linux/generic/backport-6.6/819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch +++ /dev/null @@ -1,91 +0,0 @@ -From ec9c08a1cb8dc5e8e003f95f5f62de41dde235bb Mon Sep 17 00:00:00 2001 -From: Miquel Raynal -Date: Fri, 15 Dec 2023 11:15:29 +0000 -Subject: [PATCH] nvmem: Create a header for internal sharing - -Before adding all the NVMEM layout bus infrastructure to the core, let's -move the main nvmem_device structure in an internal header, only -available to the core. This way all the additional code can be added in -a dedicated file in order to keep the current core file tidy. - -Signed-off-by: Miquel Raynal -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231215111536.316972-4-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/core.c | 24 +----------------------- - drivers/nvmem/internals.h | 35 +++++++++++++++++++++++++++++++++++ - 2 files changed, 36 insertions(+), 23 deletions(-) - create mode 100644 drivers/nvmem/internals.h - ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -19,29 +19,7 @@ - #include - #include - --struct nvmem_device { -- struct module *owner; -- struct device dev; -- int stride; -- int word_size; -- int id; -- struct kref refcnt; -- size_t size; -- bool read_only; -- bool root_only; -- int flags; -- enum nvmem_type type; -- struct bin_attribute eeprom; -- struct device *base_dev; -- struct list_head cells; -- const struct nvmem_keepout *keepout; -- unsigned int nkeepout; -- nvmem_reg_read_t reg_read; -- nvmem_reg_write_t reg_write; -- struct gpio_desc *wp_gpio; -- struct nvmem_layout *layout; -- void *priv; --}; -+#include "internals.h" - - #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev) - ---- /dev/null -+++ b/drivers/nvmem/internals.h -@@ -0,0 +1,35 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+ -+#ifndef _LINUX_NVMEM_INTERNALS_H -+#define _LINUX_NVMEM_INTERNALS_H -+ -+#include -+#include -+#include -+ -+struct nvmem_device { -+ struct module *owner; -+ struct device dev; -+ struct list_head node; -+ int stride; -+ int word_size; -+ int id; -+ struct kref refcnt; -+ size_t size; -+ bool read_only; -+ bool root_only; -+ int flags; -+ enum nvmem_type type; -+ struct bin_attribute eeprom; -+ struct device *base_dev; -+ struct list_head cells; -+ const struct nvmem_keepout *keepout; -+ unsigned int nkeepout; -+ nvmem_reg_read_t reg_read; -+ nvmem_reg_write_t reg_write; -+ struct gpio_desc *wp_gpio; -+ struct nvmem_layout *layout; -+ void *priv; -+}; -+ -+#endif /* ifndef _LINUX_NVMEM_INTERNALS_H */ diff --git a/target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch b/target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch deleted file mode 100644 index dac691e117..0000000000 --- a/target/linux/generic/backport-6.6/819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 1b7c298a4ecbc28cc6ee94005734bff55eb83d22 Mon Sep 17 00:00:00 2001 -From: Miquel Raynal -Date: Fri, 15 Dec 2023 11:15:30 +0000 -Subject: [PATCH] nvmem: Simplify the ->add_cells() hook - -The layout entry is not used and will anyway be made useless by the new -layout bus infrastructure coming next, so drop it. While at it, clarify -the kdoc entry. - -Signed-off-by: Miquel Raynal -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231215111536.316972-5-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/core.c | 2 +- - drivers/nvmem/layouts/onie-tlv.c | 3 +-- - drivers/nvmem/layouts/sl28vpd.c | 3 +-- - include/linux/nvmem-provider.h | 8 +++----- - 4 files changed, 6 insertions(+), 10 deletions(-) - ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -815,7 +815,7 @@ static int nvmem_add_cells_from_layout(s - int ret; - - if (layout && layout->add_cells) { -- ret = layout->add_cells(&nvmem->dev, nvmem, layout); -+ ret = layout->add_cells(&nvmem->dev, nvmem); - if (ret) - return ret; - } ---- a/drivers/nvmem/layouts/onie-tlv.c -+++ b/drivers/nvmem/layouts/onie-tlv.c -@@ -182,8 +182,7 @@ static bool onie_tlv_crc_is_valid(struct - return true; - } - --static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem, -- struct nvmem_layout *layout) -+static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem) - { - struct onie_tlv_hdr hdr; - size_t table_len, data_len, hdr_len; ---- a/drivers/nvmem/layouts/sl28vpd.c -+++ b/drivers/nvmem/layouts/sl28vpd.c -@@ -80,8 +80,7 @@ static int sl28vpd_v1_check_crc(struct d - return 0; - } - --static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem, -- struct nvmem_layout *layout) -+static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem) - { - const struct nvmem_cell_info *pinfo; - struct nvmem_cell_info info = {0}; ---- a/include/linux/nvmem-provider.h -+++ b/include/linux/nvmem-provider.h -@@ -156,9 +156,8 @@ struct nvmem_cell_table { - * - * @name: Layout name. - * @of_match_table: Open firmware match table. -- * @add_cells: Will be called if a nvmem device is found which -- * has this layout. The function will add layout -- * specific cells with nvmem_add_one_cell(). -+ * @add_cells: Called to populate the layout using -+ * nvmem_add_one_cell(). - * @fixup_cell_info: Will be called before a cell is added. Can be - * used to modify the nvmem_cell_info. - * @owner: Pointer to struct module. -@@ -172,8 +171,7 @@ struct nvmem_cell_table { - struct nvmem_layout { - const char *name; - const struct of_device_id *of_match_table; -- int (*add_cells)(struct device *dev, struct nvmem_device *nvmem, -- struct nvmem_layout *layout); -+ int (*add_cells)(struct device *dev, struct nvmem_device *nvmem); - void (*fixup_cell_info)(struct nvmem_device *nvmem, - struct nvmem_layout *layout, - struct nvmem_cell_info *cell); diff --git a/target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch b/target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch deleted file mode 100644 index 0a614fc13d..0000000000 --- a/target/linux/generic/backport-6.6/819-v6.8-0004-nvmem-Move-and-rename-fixup_cell_info.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 1172460e716784ac7e1049a537bdca8edbf97360 Mon Sep 17 00:00:00 2001 -From: Miquel Raynal -Date: Fri, 15 Dec 2023 11:15:31 +0000 -Subject: [PATCH] nvmem: Move and rename ->fixup_cell_info() - -This hook is meant to be used by any provider and instantiating a layout -just for this is useless. Let's instead move this hook to the nvmem -device and add it to the config structure to be easily shared by the -providers. - -While at moving this hook, rename it ->fixup_dt_cell_info() to clarify -its main intended purpose. - -Signed-off-by: Miquel Raynal -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20231215111536.316972-6-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/core.c | 6 +++--- - drivers/nvmem/imx-ocotp.c | 11 +++-------- - drivers/nvmem/internals.h | 2 ++ - drivers/nvmem/mtk-efuse.c | 11 +++-------- - include/linux/nvmem-provider.h | 9 ++++----- - 5 files changed, 15 insertions(+), 24 deletions(-) - ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -674,7 +674,6 @@ static int nvmem_validate_keepouts(struc - - static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) - { -- struct nvmem_layout *layout = nvmem->layout; - struct device *dev = &nvmem->dev; - struct device_node *child; - const __be32 *addr; -@@ -704,8 +703,8 @@ static int nvmem_add_cells_from_dt(struc - - info.np = of_node_get(child); - -- if (layout && layout->fixup_cell_info) -- layout->fixup_cell_info(nvmem, layout, &info); -+ if (nvmem->fixup_dt_cell_info) -+ nvmem->fixup_dt_cell_info(nvmem, &info); - - ret = nvmem_add_one_cell(nvmem, &info); - kfree(info.name); -@@ -894,6 +893,7 @@ struct nvmem_device *nvmem_register(cons - - kref_init(&nvmem->refcnt); - INIT_LIST_HEAD(&nvmem->cells); -+ nvmem->fixup_dt_cell_info = config->fixup_dt_cell_info; - - nvmem->owner = config->owner; - if (!nvmem->owner && config->dev->driver) ---- a/drivers/nvmem/imx-ocotp.c -+++ b/drivers/nvmem/imx-ocotp.c -@@ -583,17 +583,12 @@ static const struct of_device_id imx_oco - }; - MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids); - --static void imx_ocotp_fixup_cell_info(struct nvmem_device *nvmem, -- struct nvmem_layout *layout, -- struct nvmem_cell_info *cell) -+static void imx_ocotp_fixup_dt_cell_info(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell) - { - cell->read_post_process = imx_ocotp_cell_pp; - } - --static struct nvmem_layout imx_ocotp_layout = { -- .fixup_cell_info = imx_ocotp_fixup_cell_info, --}; -- - static int imx_ocotp_probe(struct platform_device *pdev) - { - struct device *dev = &pdev->dev; -@@ -619,7 +614,7 @@ static int imx_ocotp_probe(struct platfo - imx_ocotp_nvmem_config.size = 4 * priv->params->nregs; - imx_ocotp_nvmem_config.dev = dev; - imx_ocotp_nvmem_config.priv = priv; -- imx_ocotp_nvmem_config.layout = &imx_ocotp_layout; -+ imx_ocotp_nvmem_config.fixup_dt_cell_info = &imx_ocotp_fixup_dt_cell_info; - - priv->config = &imx_ocotp_nvmem_config; - ---- a/drivers/nvmem/internals.h -+++ b/drivers/nvmem/internals.h -@@ -23,6 +23,8 @@ struct nvmem_device { - struct bin_attribute eeprom; - struct device *base_dev; - struct list_head cells; -+ void (*fixup_dt_cell_info)(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell); - const struct nvmem_keepout *keepout; - unsigned int nkeepout; - nvmem_reg_read_t reg_read; ---- a/drivers/nvmem/mtk-efuse.c -+++ b/drivers/nvmem/mtk-efuse.c -@@ -45,9 +45,8 @@ static int mtk_efuse_gpu_speedbin_pp(voi - return 0; - } - --static void mtk_efuse_fixup_cell_info(struct nvmem_device *nvmem, -- struct nvmem_layout *layout, -- struct nvmem_cell_info *cell) -+static void mtk_efuse_fixup_dt_cell_info(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell) - { - size_t sz = strlen(cell->name); - -@@ -61,10 +60,6 @@ static void mtk_efuse_fixup_cell_info(st - cell->read_post_process = mtk_efuse_gpu_speedbin_pp; - } - --static struct nvmem_layout mtk_efuse_layout = { -- .fixup_cell_info = mtk_efuse_fixup_cell_info, --}; -- - static int mtk_efuse_probe(struct platform_device *pdev) - { - struct device *dev = &pdev->dev; -@@ -91,7 +86,7 @@ static int mtk_efuse_probe(struct platfo - econfig.priv = priv; - econfig.dev = dev; - if (pdata->uses_post_processing) -- econfig.layout = &mtk_efuse_layout; -+ econfig.fixup_dt_cell_info = &mtk_efuse_fixup_dt_cell_info; - nvmem = devm_nvmem_register(dev, &econfig); - - return PTR_ERR_OR_ZERO(nvmem); ---- a/include/linux/nvmem-provider.h -+++ b/include/linux/nvmem-provider.h -@@ -83,6 +83,8 @@ struct nvmem_cell_info { - * @cells: Optional array of pre-defined NVMEM cells. - * @ncells: Number of elements in cells. - * @add_legacy_fixed_of_cells: Read fixed NVMEM cells from old OF syntax. -+ * @fixup_dt_cell_info: Will be called before a cell is added. Can be -+ * used to modify the nvmem_cell_info. - * @keepout: Optional array of keepout ranges (sorted ascending by start). - * @nkeepout: Number of elements in the keepout array. - * @type: Type of the nvmem storage -@@ -113,6 +115,8 @@ struct nvmem_config { - const struct nvmem_cell_info *cells; - int ncells; - bool add_legacy_fixed_of_cells; -+ void (*fixup_dt_cell_info)(struct nvmem_device *nvmem, -+ struct nvmem_cell_info *cell); - const struct nvmem_keepout *keepout; - unsigned int nkeepout; - enum nvmem_type type; -@@ -158,8 +162,6 @@ struct nvmem_cell_table { - * @of_match_table: Open firmware match table. - * @add_cells: Called to populate the layout using - * nvmem_add_one_cell(). -- * @fixup_cell_info: Will be called before a cell is added. Can be -- * used to modify the nvmem_cell_info. - * @owner: Pointer to struct module. - * @node: List node. - * -@@ -172,9 +174,6 @@ struct nvmem_layout { - const char *name; - const struct of_device_id *of_match_table; - int (*add_cells)(struct device *dev, struct nvmem_device *nvmem); -- void (*fixup_cell_info)(struct nvmem_device *nvmem, -- struct nvmem_layout *layout, -- struct nvmem_cell_info *cell); - - /* private */ - struct module *owner; diff --git a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch index b96134e315..de965e1ccd 100644 --- a/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch +++ b/target/linux/generic/backport-6.6/823-v6.12-0001-nvmem-imx-ocotp-ele-support-i.MX95.patch @@ -40,7 +40,7 @@ Signed-off-by: Greg Kroah-Hartman } memcpy(val, ((u8 *)p) + skipbytes, bytes); -@@ -157,8 +161,30 @@ static const struct ocotp_devtype_data i +@@ -179,8 +183,30 @@ static const struct ocotp_devtype_data i }, }; diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch index b3a592f078..8f63a7a0df 100644 --- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch +++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10989,7 +10989,8 @@ void free_netdev(struct net_device *dev) +@@ -11020,7 +11020,8 @@ void free_netdev(struct net_device *dev) dev->xdp_bulkq = NULL; /* Compatibility with error handling in drivers */ diff --git a/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch index e1d4367a8f..0935a0b9c0 100644 --- a/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-6.6/721-net-add-packet-mangeling.patch @@ -105,7 +105,7 @@ Signed-off-by: Felix Fietkau help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3597,6 +3597,11 @@ static int xmit_one(struct sk_buff *skb, +@@ -3628,6 +3628,11 @@ static int xmit_one(struct sk_buff *skb, if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); diff --git a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch index b810e7ec91..ca7c624447 100644 --- a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch +++ b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch @@ -31,7 +31,7 @@ Signe-off-by: Felix Fietkau static inline void gro_normal_list(struct napi_struct *napi) --- a/include/net/tcp.h +++ b/include/net/tcp.h -@@ -2084,7 +2084,10 @@ void tcp_v4_destroy_sock(struct sock *sk +@@ -2101,7 +2101,10 @@ void tcp_v4_destroy_sock(struct sock *sk struct sk_buff *tcp_gso_segment(struct sk_buff *skb, netdev_features_t features); diff --git a/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch b/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch index 9df758ae1b..747ba7f285 100644 --- a/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch +++ b/target/linux/ipq40xx/patches-6.6/004-v6.7-firmware-qcom_scm-disable-SDI-if-required.patch @@ -57,7 +57,7 @@ Signed-off-by: Bjorn Andersson static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) { struct qcom_scm_desc desc = { -@@ -1473,6 +1496,13 @@ static int qcom_scm_probe(struct platfor +@@ -1474,6 +1497,13 @@ static int qcom_scm_probe(struct platfor __get_convention(); diff --git a/target/linux/ipq40xx/patches-6.6/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch b/target/linux/ipq40xx/patches-6.6/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch index 26cd0e0309..ab56c24a4d 100644 --- a/target/linux/ipq40xx/patches-6.6/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch +++ b/target/linux/ipq40xx/patches-6.6/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch @@ -15,7 +15,7 @@ Signed-off-by: Robert Marko --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c -@@ -1528,7 +1528,8 @@ static int qcom_scm_probe(struct platfor +@@ -1529,7 +1529,8 @@ static int qcom_scm_probe(struct platfor static void qcom_scm_shutdown(struct platform_device *pdev) { /* Clean shutdown, disable download mode to allow normal restart */ diff --git a/target/linux/qualcommax/patches-6.6/0067-v6.7-firmware-qcom-scm-disable-SDI-if-required.patch b/target/linux/qualcommax/patches-6.6/0067-v6.7-firmware-qcom-scm-disable-SDI-if-required.patch index 9df758ae1b..747ba7f285 100644 --- a/target/linux/qualcommax/patches-6.6/0067-v6.7-firmware-qcom-scm-disable-SDI-if-required.patch +++ b/target/linux/qualcommax/patches-6.6/0067-v6.7-firmware-qcom-scm-disable-SDI-if-required.patch @@ -57,7 +57,7 @@ Signed-off-by: Bjorn Andersson static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) { struct qcom_scm_desc desc = { -@@ -1473,6 +1496,13 @@ static int qcom_scm_probe(struct platfor +@@ -1474,6 +1497,13 @@ static int qcom_scm_probe(struct platfor __get_convention(); diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index 56b638aa36..916f08ac5d 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch @@ -234,7 +234,7 @@ Signed-off-by: John Crispin /* Format flags */ #define UVC_FMT_FLAG_COMPRESSED 0x00000001 -@@ -587,6 +589,7 @@ struct uvc_device { +@@ -591,6 +593,7 @@ struct uvc_device { struct input_dev *input; char input_phys[64]; From 9a7192c08e5a480ed93ee689bc4a71ac2379c7fe Mon Sep 17 00:00:00 2001 From: George Moussalem Date: Thu, 13 Feb 2025 09:54:44 +0400 Subject: [PATCH 12/12] qualcommax: ipq50xx: Add support for Linksys MR5500 Add support for Linksys MR5500 (Hydra 6 Pro). Speficiations: * SoC: Qualcomm IPQ5018 (64-bit dual-core ARM Cortex-A53 @ 1.0Ghz) * Memory: Kingston D2516ECMDXGJD (512 MiB) * Serial Port: 3v3 TTL 115200n8 * Wi-Fi: IPQ5018 (2x2 2.4 Ghz 802.11b/g/n/ax) QCN9024 (4x4:4 5 Ghz 802.11an/ac/ax) * Ethernet: IPQ5018 integrated virtual switch connected to an external QCA8337 switch (4 Ports 10/100/1000 GBASE-T) * Flash: Gigadevice GD5F2GQ5REYIH (256 MiB) * LEDs: 1x multi-color PWM LED 1x blue led for USB (GPIO 19 Active High) * Buttons: 1x WPS (GPIO 27 Active Low) 1x Reset (GPIO 28 Acive Low) 5x ethernet port LEDs (amber for activity & green for link up) * Peripherals: 1x USB2 (powered by GPIO 17 Active Low) support for USB3 will be added in a separate PR * FCC ID: 2AYRA-03734 Flash instructions: 1. On OEM firmware, login to the device (typically at http://192.168.1.1) and click 'CA' in the bottom right corner -> Connectivity -> Manual Upgrade. Alternatively, browse to http:///fwupdate.html. Upgrade firmware using openwrt-qualcommax-ipq50xx-linksys_mr5500-squashfs-factory.bin image. Optionally install on second partition, after first boot check actual partition: fw_printenv -n boot_part and install firmware on second partition using command in case of 2: mtd -r -e kernel -n write openwrt-qualcommax-ipq50xx-linksys_mr5500-squashfs-factory.bin kernel and in case of 1: mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq50xx-linksys_mr5500-squashfs-factory.bin alt_kernel 2. Installation using serial connection from OEM firmware (default login: root, password: admin): fw_printenv -n boot_part In case of 2: flash_erase /dev/mtd12 0 0 nandwrite -p /dev/mtd12 openwrt-qualcommax-ipq50xx-linksys_mr5500-squashfs-factory.bin or in case of 1: flash_erase /dev/mtd14 0 0 nandwrite -p /dev/mtd14 openwrt-qualcommax-ipq50xx-linksys_mr5500-squashfs-factory.bin After first boot install firmware on second partition: mtd -r -e kernel -n write openwrt-qualcommax-ipq50xx-linksys_mr5500-squashfs-factory.bin kernel or: mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq50xx-linksys_mr5500-squashfs-factory.bin alt_kernel 3. Back to the OEM firmware. Download firmware from OEM website: MR5500: https://support.linksys.com/kb/article/207-en/ From serial or SSH: fw_printenv boot_part in case of 1: mtd -r -e alt_kernel -n write FW_MR5500_1.1.2.209598_prod.img alt_kernel else in case of 2: mtd -r -e kernel -n write FW_MR5500_1.1.2.209598_prod.img kernel 4. Boot from USB This allows you loading an OpenWrt image into RAM and is meant for recovery scenarios only. Enable loading image from USB in u-boot. From serial or SSH: fw_setenv bootusb 'usb start && usbboot &loadaddr && bootm $loadaddr' fw_setenv bootcmd 'run bootusb; if test $auto_recovery = no; then bootipq; elif test $boot_part = 1; then run bootpart1; else run bootpart2; fi' Copy OpenWrt initramfs image to USB: dd bs=1M if=openwrt-qualcommax-ipq50xx-linksys_mr5500-initramfs-uImage.itb of=/dev/sda Signed-off-by: George Moussalem Link: https://github.com/openwrt/openwrt/pull/17958 Signed-off-by: Robert Marko --- .../uboot-envtools/files/qualcommax_ipq50xx | 1 + package/firmware/ipq-wifi/Makefile | 2 + .../arm64/boot/dts/qcom/ipq5018-mr5500.dts | 387 ++++++++++++++++++ target/linux/qualcommax/image/ipq50xx.mk | 11 + .../ipq50xx/base-files/etc/board.d/01_leds | 28 ++ .../ipq50xx/base-files/etc/board.d/02_network | 3 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 2 + .../ipq50xx/base-files/etc/init.d/bootcount | 1 + .../base-files/lib/upgrade/platform.sh | 1 + .../linux/qualcommax/ipq50xx/config-default | 1 + 10 files changed, 437 insertions(+) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mr5500.dts create mode 100644 target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq50xx b/package/boot/uboot-envtools/files/qualcommax_ipq50xx index b63451d627..8c3d2f55be 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq50xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq50xx @@ -8,6 +8,7 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in +linksys,mr5500|\ linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index deeda4955e..07d5c90c44 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -39,6 +39,7 @@ ALLWIFIBOARDS:= \ edgecore_eap102 \ edimax_cax1800 \ linksys_homewrk \ + linksys_mr5500 \ linksys_mr7350 \ linksys_mx2000 \ linksys_mx4200 \ @@ -179,6 +180,7 @@ $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) $(eval $(call generate-ipq-wifi-package,linksys_homewrk,Linksys HomeWRK)) +$(eval $(call generate-ipq-wifi-package,linksys_mr5500,Linksys MR5500)) $(eval $(call generate-ipq-wifi-package,linksys_mr7350,Linksys MR7350)) $(eval $(call generate-ipq-wifi-package,linksys_mx2000,Linksys MX2000)) $(eval $(call generate-ipq-wifi-package,linksys_mx4200,Linksys MX4200)) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mr5500.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mr5500.dts new file mode 100644 index 0000000000..6550e22729 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mr5500.dts @@ -0,0 +1,387 @@ +/dts-v1/; + +#include "ipq5018.dtsi" +#include "ipq5018-mx-base.dtsi" + +/ { + model = "Linksys MR5500"; + compatible = "linksys,mr5500", "qcom,ipq5018"; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + color = ; + function = LED_FUNCTION_USB; + gpios = <&tlmm 19 GPIO_ACTIVE_HIGH>; + trigger-sources = <&usb_port1>; + linux,default-trigger = "usbport"; + }; + }; + + regulator_fixed_5p0: regulator-s0500 { + compatible = "regulator-fixed"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <500000>; + regulator-name = "fixed_5p0"; + gpio = <&tlmm 17 GPIO_ACTIVE_LOW>; + }; +}; + +/* + * =============================================================== + * _______________________ _______________________ + * | IPQ5018 | | QCA8337 | + * | +------+ +--------+ | | +--------+ +------+ | + * | | MAC0 |---| GE Phy | | | | Phy0 |---| MAC1 | | + * | +------+ +--------+ | | +--------+ +------+ | + * | +------+ +--------+ | | +--------+ +------+ | + * | | MAC1 |---| Uniphy |-+-SGMII-+-| SerDes |---| MAC6 | | + * | +------+ +--------+ | | +--------+ +------+ | + * |_______________________| |_______________________| + * + * =============================================================== + */ + +&switch { + status = "okay"; + + switch_mac_mode = ; + + qcom,port_phyinfo { + // MAC0 -> GE Phy + port@0 { + port_id = <1>; + mdiobus = <&mdio0>; + phy_address = <7>; + }; + + // MAC1 ---SGMII---> QCA8337 SerDes + port@1 { + port_id = <2>; + forced-speed = <1000>; + forced-duplex = <1>; + }; + }; +}; + +// MAC1 ---SGMII---> QCA8337 SerDes +&dp2 { + status = "okay"; + + nvmem-cells = <&hw_mac_addr 0>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&mdio0 { + status = "okay"; +}; + +&mdio1 { + status = "okay"; + + pinctrl-0 = <&mdio1_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>; + + switch1: ethernet-switch@17 { + compatible = "qca,qca8337"; + reg = <17>; + #address-cells = <1>; + #size-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan1"; + phy-handle = <&qca8337_0>; + phy-mode = "internal"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + }; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-handle = <&qca8337_1>; + phy-mode = "internal"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + }; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-handle = <&qca8337_2>; + phy-mode = "internal"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + }; + }; + + port@4 { + reg = <4>; + label = "lan4"; + phy-handle = <&qca8337_3>; + phy-mode = "internal"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "keep"; + }; + }; + }; + + port@5 { + reg = <5>; + label = "wan"; + phy-handle = <&qca8337_4>; + phy-mode = "internal"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_WAN; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_WAN; + default-state = "keep"; + }; + }; + }; + + port@6 { + reg = <6>; + label = "cpu"; + phy-mode = "sgmii"; + ethernet = <&dp2>; + qca,sgmii-enable-pll; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + // QCA8337 Phy0 -> LAN1 + qca8337_0: ethernet-phy@0 { + reg = <0>; + }; + + // QCA8337 Phy1 -> LAN2 + qca8337_1: ethernet-phy@1 { + reg = <1>; + }; + + // QCA8337 Phy2 -> LAN3 + qca8337_2: ethernet-phy@2 { + reg = <2>; + }; + + // QCA8337 Phy3 -> LAN4 + qca8337_3: ethernet-phy@3 { + reg = <3>; + }; + + // QCA8337 Phy4 -> WAN + qca8337_4: ethernet-phy@4 { + reg = <4>; + }; + }; + }; +}; + +&usbphy0 { + status = "okay"; + + vdd-supply = <®ulator_fixed_5p0>; +}; + +&usb { + status = "okay"; + + vbus-supply = <®ulator_fixed_5p0>; +}; + +&usb_dwc { + address-cells = <1>; + #size-cells = <0>; + dr_mode = "host"; + + usb_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&pcie0_phy { + status = "okay"; +}; + +&pcie0 { + status = "okay"; + + perst-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi@1,0 { + status = "okay"; + + /* QCN9074: ath11k lacks DT compatible for PCI cards */ + compatible = "pci17cb,1104"; + reg = <0x00010000 0 0 0 0>; + + qcom,ath11k-calibration-variant = "Linksys-MR5500"; + }; + }; +}; + +&q6v5_wcss { + status = "okay"; + + memory-region = <&q6_mem_regions>; + firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt", + "ath11k/IPQ5018/hw1.0/m3_fw.mdt"; + + // IPQ5018 + q6_wcss_pd1: pd-1 { + firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt"; + + resets = + <&gcc GCC_WCSSAON_RESET>, + <&gcc GCC_WCSS_BCR>, + <&gcc GCC_CE_BCR>; + reset-names = + "wcss_aon_reset", + "wcss_reset", + "ce_reset"; + + clocks = + <&gcc GCC_WCSS_AHB_S_CLK>, + <&gcc GCC_WCSS_ACMT_CLK>, + <&gcc GCC_WCSS_AXI_M_CLK>; + clock-names = + "gcc_wcss_ahb_s_clk", + "gcc_wcss_acmt_clk", + "gcc_wcss_axi_m_clk"; + + interrupts-extended = + <&wcss_smp2p_in 8 0>, + <&wcss_smp2p_in 9 0>, + <&wcss_smp2p_in 12 0>, + <&wcss_smp2p_in 11 0>; + interrupt-names = + "fatal", + "ready", + "spawn-ack", + "stop-ack"; + + qcom,smem-states = + <&wcss_smp2p_out 8>, + <&wcss_smp2p_out 9>, + <&wcss_smp2p_out 10>; + qcom,smem-state-names = + "shutdown", + "stop", + "spawn"; + }; +}; + +&wifi0 { + // IPQ5018 + qcom,rproc = <&q6_wcss_pd1>; + qcom,ath11k-calibration-variant = "Linksys-MR5500"; + qcom,ath11k-fw-memory-mode = <2>; + qcom,bdf-addr = <0x4c400000>; + + status = "okay"; +}; diff --git a/target/linux/qualcommax/image/ipq50xx.mk b/target/linux/qualcommax/image/ipq50xx.mk index cf404d49cd..d6e71f1729 100644 --- a/target/linux/qualcommax/image/ipq50xx.mk +++ b/target/linux/qualcommax/image/ipq50xx.mk @@ -11,6 +11,17 @@ define Device/linksys_ipq50xx_mx_base IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=$$$$(DEVICE_MODEL) endef +define Device/linksys_mr5500 + $(call Device/linksys_ipq50xx_mx_base) + DEVICE_MODEL := MR5500 + DEVICE_DTS_CONFIG := config@mp03.1 + DEVICE_PACKAGES := kmod-ath11k-pci \ + ath11k-firmware-qcn9074 \ + ipq-wifi-linksys_mr5500 \ + kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += linksys_mr5500 + define Device/linksys_mx2000 $(call Device/linksys_ipq50xx_mx_base) DEVICE_MODEL := MX2000 diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds new file mode 100644 index 0000000000..3969f233ab --- /dev/null +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/01_leds @@ -0,0 +1,28 @@ +# +# Copyright (C) 2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +linksys,mr5500) + ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "qca8k-0.0:00:green:lan" "lan1" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan1-port-activity" "LAN1-PORT-ACTIVITY" "qca8k-0.0:00:amber:lan" "lan1" "tx rx" + ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "qca8k-0.0:01:green:lan" "lan2" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan2-port-activity" "LAN2-PORT-ACTIVITY" "qca8k-0.0:01:amber:lan" "lan2" "tx rx" + ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "qca8k-0.0:02:green:lan" "lan3" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan3-port-activity" "LAN3-PORT-ACTIVITY" "qca8k-0.0:02:amber:lan" "lan3" "tx rx" + ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "qca8k-0.0:03:green:lan" "lan4" "link_10 link_100 link_1000" + ucidef_set_led_netdev "lan4-port-activity" "LAN4-PORT-ACTIVITY" "qca8k-0.0:03:amber:lan" "lan4" "tx rx" + ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "qca8k-0.0:04:green:wan" "wan" "link_10 link_100 link_1000" + ucidef_set_led_netdev "wan-port-activity" "WAN-PORT-ACTIVITY" "qca8k-0.0:04:amber:wan" "wan" "tx rx" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network index 6c8574c474..5679fd93f6 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network @@ -7,6 +7,9 @@ ipq50xx_setup_interfaces() { local board="$1" case $board in + linksys,mr5500) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" + ;; linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 4da2f2809e..3aa0aa1c30 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -9,6 +9,7 @@ board=$(board_name) case "$FIRMWARE" in "ath11k/IPQ5018/hw1.0/cal-ahb-c000000.wifi.bin") case "$board" in + linksys,mr5500|\ linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) @@ -33,6 +34,7 @@ case "$FIRMWARE" in ;; "ath11k/QCN9074/hw1.0/cal-pci-0001:01:00.0.bin") case "$board" in + linksys,mr5500|\ linksys,mx5500|\ linksys,spnmx56) caldata_extract "0:ART" 0x26800 0x20000 diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/init.d/bootcount b/target/linux/qualcommax/ipq50xx/base-files/etc/init.d/bootcount index c49ad8472d..0e573a1407 100755 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/init.d/bootcount +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/init.d/bootcount @@ -4,6 +4,7 @@ START=99 boot() { case $(board_name) in + linksys,mr5500|\ linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) diff --git a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh index aa71b8992e..3933027114 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh @@ -71,6 +71,7 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in + linksys,mr5500|\ linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) diff --git a/target/linux/qualcommax/ipq50xx/config-default b/target/linux/qualcommax/ipq50xx/config-default index cc06f0f41f..f920cc9c98 100644 --- a/target/linux/qualcommax/ipq50xx/config-default +++ b/target/linux/qualcommax/ipq50xx/config-default @@ -7,6 +7,7 @@ CONFIG_MTD_SPI_NAND=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_QCA8K=y +CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT=y CONFIG_NET_DSA_TAG_QCA=y CONFIG_PHYLINK=y CONFIG_PHY_QCOM_M31_USB=y