[OpenWrt-Devel] [PATCH 00/12] uci: fix issues caused by newly-added multiline option value support.
This patch set mainly tries to - Add test more cases with multiline option value and quotes in mind. - Fix issues of uci show, revert, add_list, del_list, batch commands. My previous patch set for adding support for multiline option value support to UCI parser was not complete causing many unexpected problems which I was only aware of when doing a fresh installation. It's very wise of Felix for keeping that update only to uci.git repository at the moment, thus giving me the chance to discover those flaws and fix them at my best. Yousong Zhou (12): Fix a few style issues. tests: remove straying echo in 020_get. tests: add more test coverage for `uci show' command. tests: add test coverage for `uci batch' command. tests: add test coverage for `uci revert' command. tests: add test coverage for uci list related commands. cli: fix printing option values occupying multiple lines. delta: add a simple duplication check when adding delta path. delta: preprocess delta line with uci_parse_argument(). delta: use a table for converting between UCI_CMD_XXX and prefixes. delta: fix outputing of delta entries occupying multiple lines. uci_internal: use comma expression for UCI_INTERNAL() call. .gitignore |2 - cli.c | 40 +++-- delta.c| 166 +--- file.c | 11 +- test/references/add_list_changes.result|4 + test/references/add_list_config.result |6 + test/references/add_list_show.result |3 + test/references/batch_set.result |9 ++ test/references/del_list_config.result |5 + test/references/del_list_multiline_config.result |4 + test/references/revert_option.result |3 + test/references/revert_option_multiline.result |2 + test/references/show_parsing_multiline.data| 20 +++ .../show_parsing_multiline_option.result | 12 ++ .../show_parsing_multiline_package.result | 18 +++ .../show_parsing_multiline_section.result | 16 ++ test/tests.d/020_get |1 - test/tests.d/050_show | 31 test/tests.d/060_batch | 17 ++ test/tests.d/070_revert| 28 test/tests.d/080_list | 50 ++ uci.h |8 + uci_internal.h |8 +- 23 files changed, 350 insertions(+), 114 deletions(-) create mode 100644 test/references/add_list_changes.result create mode 100644 test/references/add_list_config.result create mode 100644 test/references/add_list_show.result create mode 100644 test/references/batch_set.result create mode 100644 test/references/del_list_config.result create mode 100644 test/references/del_list_multiline_config.result create mode 100644 test/references/revert_option.result create mode 100644 test/references/revert_option_multiline.result create mode 100644 test/references/revert_section.result create mode 100644 test/references/show_parsing_multiline.data create mode 100644 test/references/show_parsing_multiline_option.result create mode 100644 test/references/show_parsing_multiline_package.result create mode 100644 test/references/show_parsing_multiline_section.result create mode 100644 test/tests.d/060_batch create mode 100644 test/tests.d/070_revert create mode 100644 test/tests.d/080_list -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 03/12] tests: add more test coverage for `uci show' command.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/show_parsing_multiline.data| 20 + .../show_parsing_multiline_option.result | 12 .../show_parsing_multiline_package.result | 18 .../show_parsing_multiline_section.result | 16 ++ test/tests.d/050_show | 31 5 files changed, 97 insertions(+) create mode 100644 test/references/show_parsing_multiline.data create mode 100644 test/references/show_parsing_multiline_option.result create mode 100644 test/references/show_parsing_multiline_package.result create mode 100644 test/references/show_parsing_multiline_section.result diff --git a/test/references/show_parsing_multiline.data b/test/references/show_parsing_multiline.data new file mode 100644 index 000..670e809 --- /dev/null +++ b/test/references/show_parsing_multiline.data @@ -0,0 +1,20 @@ +config main +option version 1.4.1 + +config sockd 'instance0' +option enabled 1 +list internal_network vpn +list external_network wan + +option extra_config ' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/references/show_parsing_multiline_option.result b/test/references/show_parsing_multiline_option.result new file mode 100644 index 000..6f7aacf --- /dev/null +++ b/test/references/show_parsing_multiline_option.result @@ -0,0 +1,12 @@ +sockd.instance0.extra_config=' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/references/show_parsing_multiline_package.result b/test/references/show_parsing_multiline_package.result new file mode 100644 index 000..218082d --- /dev/null +++ b/test/references/show_parsing_multiline_package.result @@ -0,0 +1,18 @@ +sockd.@main[0]=main +sockd.@main[0].version='1.4.1' +sockd.instance0=sockd +sockd.instance0.enabled='1' +sockd.instance0.internal_network='vpn' +sockd.instance0.external_network='wan' +sockd.instance0.extra_config=' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/references/show_parsing_multiline_section.result b/test/references/show_parsing_multiline_section.result new file mode 100644 index 000..0506ac3 --- /dev/null +++ b/test/references/show_parsing_multiline_section.result @@ -0,0 +1,16 @@ +sockd.instance0=sockd +sockd.instance0.enabled='1' +sockd.instance0.internal_network='vpn' +sockd.instance0.external_network='wan' +sockd.instance0.extra_config=' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/tests.d/050_show b/test/tests.d/050_show index 7d7e160..ce0eafc 100644 --- a/test/tests.d/050_show +++ b/test/tests.d/050_show @@ -9,3 +9,34 @@ test_get_parsing() assertFailWithNoReturn ${UCI_Q} show test.section.opt.val.qsdf.qsd assertFailWithNoReturn ${UCI_Q} show test.section.opt.valqsqsd } + +prepare_get_parsing_multiline() { + cp ${REF_DIR}/show_parsing_multiline.data ${CONFIG_DIR}/sockd +} + +test_get_parsing_multiline_package() +{ + prepare_get_parsing_multiline + + value=$(${UCI_Q} show sockd) + value_ref=$(cat ${REF_DIR}/show_parsing_multiline_package.result) + assertEquals $value_ref $value +} + +test_get_parsing_multiline_section() +{ + prepare_get_parsing_multiline + + value=$(${UCI_Q} show sockd.instance0) + value_ref=$(cat ${REF_DIR}/show_parsing_multiline_section.result) + assertEquals $value_ref $value +} + +test_get_parsing_multiline_option() +{ + prepare_get_parsing_multiline + + value=$(${UCI_Q} show sockd.instance0.extra_config) + value_ref=$(cat ${REF_DIR}/show_parsing_multiline_option.result) + assertEquals $value_ref $value +} -- 1.7.10.4
[OpenWrt-Devel] [PATCH 04/12] tests: add test coverage for `uci batch' command.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/batch_set.result |9 + test/tests.d/060_batch | 17 + 2 files changed, 26 insertions(+) create mode 100644 test/references/batch_set.result create mode 100644 test/tests.d/060_batch diff --git a/test/references/batch_set.result b/test/references/batch_set.result new file mode 100644 index 000..c726bad --- /dev/null +++ b/test/references/batch_set.result @@ -0,0 +1,9 @@ + +config section 'SEC0' + option option0 'value0' + option option1 'Hello, + World' + +config section 'SEC1' + option option0 'value1' + diff --git a/test/tests.d/060_batch b/test/tests.d/060_batch new file mode 100644 index 000..49d15e4 --- /dev/null +++ b/test/tests.d/060_batch @@ -0,0 +1,17 @@ +test_batch_set() +{ + touch ${CONFIG_DIR}/batch_set + +${UCI} batch EOF +set batch_set.SEC0='section' +set batch_set.SEC0.option0='value0' +set batch_set.SEC0.option1='Hello, +' World\ +set batch_set.SEC1='section' +set batch_set.SEC1.option0=value1 + +EOF + ${UCI} commit + assertSameFile ${REF_DIR}/batch_set.result ${CONFIG_DIR}/batch_set +} + -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 02/12] tests: remove straying echo in 020_get.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/tests.d/020_get |1 - 1 file changed, 1 deletion(-) diff --git a/test/tests.d/020_get b/test/tests.d/020_get index 7fd30ba..630d84d 100644 --- a/test/tests.d/020_get +++ b/test/tests.d/020_get @@ -35,7 +35,6 @@ test_get_option_multiline() { cp ${REF_DIR}/get_multiline.data ${CONFIG_DIR}/test value=$($UCI get test.section.opt) - echo $value assertEquals 'Hello, World. '\''' $value } -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 05/12] tests: add test coverage for `uci revert' command.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/revert_option.result |3 +++ test/references/revert_option_multiline.result |2 ++ test/tests.d/070_revert| 28 3 files changed, 33 insertions(+) create mode 100644 test/references/revert_option.result create mode 100644 test/references/revert_option_multiline.result create mode 100644 test/references/revert_section.result create mode 100644 test/tests.d/070_revert diff --git a/test/references/revert_option.result b/test/references/revert_option.result new file mode 100644 index 000..c45a19c --- /dev/null +++ b/test/references/revert_option.result @@ -0,0 +1,3 @@ +revert.SEC0='section' +revert.SEC0.option1='Hello, + World' diff --git a/test/references/revert_option_multiline.result b/test/references/revert_option_multiline.result new file mode 100644 index 000..9982d25 --- /dev/null +++ b/test/references/revert_option_multiline.result @@ -0,0 +1,2 @@ +revert.SEC0='section' +revert.SEC0.option0='value0' diff --git a/test/references/revert_section.result b/test/references/revert_section.result new file mode 100644 index 000..e69de29 diff --git a/test/tests.d/070_revert b/test/tests.d/070_revert new file mode 100644 index 000..6035f6f --- /dev/null +++ b/test/tests.d/070_revert @@ -0,0 +1,28 @@ +revert_test_prepare() { + touch ${CONFIG_DIR}/revert + ${UCI} set revert.SEC0=section + ${UCI} set revert.SEC0.option0=value0 + ${UCI} set revert.SEC0.option1='Hello, +' World\ +} + +test_revert_section() +{ + revert_test_prepare + ${UCI} revert revert.SEC0 + assertSameFile ${REF_DIR}/revert_section.result $CHANGES_DIR/revert +} + +test_revert_option() +{ + revert_test_prepare + ${UCI} revert revert.SEC0.option0 + assertSameFile ${REF_DIR}/revert_option.result $CHANGES_DIR/revert +} + +test_revert_option_multiline() +{ + revert_test_prepare + ${UCI} revert revert.SEC0.option1 + assertSameFile ${REF_DIR}/revert_option_multiline.result $CHANGES_DIR/revert +} -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 06/12] tests: add test coverage for uci list related commands.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/add_list_changes.result |4 ++ test/references/add_list_config.result |6 +++ test/references/add_list_show.result |3 ++ test/references/del_list_config.result |5 +++ test/references/del_list_multiline_config.result |4 ++ test/tests.d/080_list| 50 ++ 6 files changed, 72 insertions(+) create mode 100644 test/references/add_list_changes.result create mode 100644 test/references/add_list_config.result create mode 100644 test/references/add_list_show.result create mode 100644 test/references/del_list_config.result create mode 100644 test/references/del_list_multiline_config.result create mode 100644 test/tests.d/080_list diff --git a/test/references/add_list_changes.result b/test/references/add_list_changes.result new file mode 100644 index 000..78e78b6 --- /dev/null +++ b/test/references/add_list_changes.result @@ -0,0 +1,4 @@ +list_test_config.SEC0='section' +list_test_config.SEC0.list0+='value0' +list_test_config.SEC0.list0+='Hello +, world' diff --git a/test/references/add_list_config.result b/test/references/add_list_config.result new file mode 100644 index 000..679 --- /dev/null +++ b/test/references/add_list_config.result @@ -0,0 +1,6 @@ + +config section 'SEC0' + list list0 'value0' + list list0 'Hello +, world' + diff --git a/test/references/add_list_show.result b/test/references/add_list_show.result new file mode 100644 index 000..3dd83cd --- /dev/null +++ b/test/references/add_list_show.result @@ -0,0 +1,3 @@ +list_test_config.SEC0=section +list_test_config.SEC0.list0='value0' 'Hello +, world' diff --git a/test/references/del_list_config.result b/test/references/del_list_config.result new file mode 100644 index 000..8e66bbb --- /dev/null +++ b/test/references/del_list_config.result @@ -0,0 +1,5 @@ + +config section 'SEC0' + list list0 'Hello +, world' + diff --git a/test/references/del_list_multiline_config.result b/test/references/del_list_multiline_config.result new file mode 100644 index 000..fe67784 --- /dev/null +++ b/test/references/del_list_multiline_config.result @@ -0,0 +1,4 @@ + +config section 'SEC0' + list list0 'value0' + diff --git a/test/tests.d/080_list b/test/tests.d/080_list new file mode 100644 index 000..7d25b26 --- /dev/null +++ b/test/tests.d/080_list @@ -0,0 +1,50 @@ +prepare_list_test() { + touch ${CONFIG_DIR}/list_test_config + ${UCI} set list_test_config.SEC0=section + ${UCI} add_list list_test_config.SEC0.list0=value0 + ${UCI} add_list list_test_config.SEC0.list0='Hello +,' world\ +} +test_add_list_config() { + prepare_list_test + ${UCI} commit + assertSameFile ${REF_DIR}/add_list_config.result $CONFIG_DIR/list_test_config +} + +test_add_list_get() { + prepare_list_test + value_list_get=$(${UCI} get list_test_config.SEC0.list0) + assertEquals $value_list_get 'value0' '\Hello +, world\' +} + +test_add_list_show() { + prepare_list_test + value_list_show=$(${UCI} show list_test_config) + value_list_show_ref=$(cat $REF_DIR/add_list_show.result) + assertEquals $value_list_show $value_list_show_ref +} + +test_add_list_changes() { + prepare_list_test + value_list_changes=$(${UCI} changes) + value_list_changes_ref=$(cat $REF_DIR/add_list_changes.result) + assertEquals $value_list_changes $value_list_changes_ref +} + +test_del_list() { + prepare_list_test + ${UCI} commit + ${UCI} del_list list_test_config.SEC0.list0=value0 + ${UCI} commit + assertSameFile ${REF_DIR}/del_list_config.result $CONFIG_DIR/list_test_config +} + +test_del_list_multiline() { + prepare_list_test + ${UCI} commit + ${UCI} del_list list_test_config.SEC0.list0='Hello +,'' world' + ${UCI} commit + assertSameFile ${REF_DIR}/del_list_multiline_config.result $CONFIG_DIR/list_test_config +} -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 07/12] cli: fix printing option values occupying multiple lines.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- cli.c | 40 ++-- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/cli.c b/cli.c index 6fbbfe9..85a24d8 100644 --- a/cli.c +++ b/cli.c @@ -168,18 +168,36 @@ static void cli_perror(void) uci_perror(ctx, appname); } -static void uci_show_value(struct uci_option *o) +static void uci_print_value(FILE *f, const char *v) +{ + fprintf(f, '); + while (*v) { + if (*v != '\'') + fputc(*v, f); + else + fprintf(f, '\\''); + v++; + } + fprintf(f, '); +} + +static void uci_show_value(struct uci_option *o, bool quote) { struct uci_element *e; bool sep = false; switch(o-type) { case UCI_TYPE_STRING: - printf(%s\n, o-v.string); + if (quote) + uci_print_value(stdout, o-v.string); + else + printf(%s, o-v.string); + printf(\n); break; case UCI_TYPE_LIST: uci_foreach_element(o-v.list, e) { - printf(%s%s, (sep ? delimiter : ), e-name); + printf(%s, (sep ? delimiter : )); + uci_print_value(stdout, e-name); sep = true; } printf(\n); @@ -190,13 +208,13 @@ static void uci_show_value(struct uci_option *o) } } -static void uci_show_option(struct uci_option *o) +static void uci_show_option(struct uci_option *o, bool quote) { printf(%s.%s.%s=, o-section-package-e.name, (cur_section_ref ? cur_section_ref : o-section-e.name), o-e.name); - uci_show_value(o); + uci_show_value(o, quote); } static void uci_show_section(struct uci_section *s) @@ -209,7 +227,7 @@ static void uci_show_section(struct uci_section *s) sname = (cur_section_ref ? cur_section_ref : s-e.name); printf(%s.%s=%s\n, cname, sname, s-type); uci_foreach_element(s-options, e) { - uci_show_option(uci_to_option(e)); + uci_show_option(uci_to_option(e), true); } } @@ -251,8 +269,10 @@ static void uci_show_changes(struct uci_package *p) printf(%s%s.%s, prefix, p-e.name, h-section); if (e-name) printf(.%s, e-name); - if (h-cmd != UCI_CMD_REMOVE) - printf(%s%s, op, h-value); + if (h-cmd != UCI_CMD_REMOVE) { + printf(%s, op); + uci_print_value(stdout, h-value); + } printf(\n); } } @@ -298,7 +318,7 @@ static int package_cmd(int cmd, char *tuple) uci_show_section(ptr.s); break; case UCI_TYPE_OPTION: - uci_show_option(ptr.o); + uci_show_option(ptr.o, true); break; default: /* should not happen */ @@ -440,7 +460,7 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv) printf(%s\n, ptr.s-type); break; case UCI_TYPE_OPTION: - uci_show_value(ptr.o); + uci_show_value(ptr.o, false); break; default: break; -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 09/12] delta: preprocess delta line with uci_parse_argument().
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- delta.c | 25 ++--- file.c |9 +++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/delta.c b/delta.c index b56df5b..2eb2ae7 100644 --- a/delta.c +++ b/delta.c @@ -95,11 +95,14 @@ int uci_add_delta_path(struct uci_context *ctx, const char *dir) return 0; } -static inline int uci_parse_delta_tuple(struct uci_context *ctx, char **buf, struct uci_ptr *ptr) +static inline int uci_parse_delta_tuple(struct uci_context *ctx, struct uci_ptr *ptr) { + struct uci_parse_context *pctx = ctx-pctx; + char *str = pctx_cur_str(pctx), *arg; int c = UCI_CMD_CHANGE; - switch(**buf) { + UCI_INTERNAL(uci_parse_argument, ctx, ctx-pctx-file, str, arg); + switch(*arg) { case '^': c = UCI_CMD_REORDER; break; @@ -122,9 +125,9 @@ static inline int uci_parse_delta_tuple(struct uci_context *ctx, char **buf, str } if (c != UCI_CMD_CHANGE) - *buf += 1; + arg += 1; - UCI_INTERNAL(uci_parse_ptr, ctx, ptr, *buf); + UCI_INTERNAL(uci_parse_ptr, ctx, ptr, arg); if (!ptr-section) goto error; @@ -155,13 +158,13 @@ error: return 0; } -static void uci_parse_delta_line(struct uci_context *ctx, struct uci_package *p, char *buf) +static void uci_parse_delta_line(struct uci_context *ctx, struct uci_package *p) { struct uci_element *e = NULL; struct uci_ptr ptr; int cmd; - cmd = uci_parse_delta_tuple(ctx, buf, ptr); + cmd = uci_parse_delta_tuple(ctx, ptr); if (strcmp(ptr.package, p-e.name) != 0) goto error; @@ -214,6 +217,7 @@ static int uci_parse_delta(struct uci_context *ctx, FILE *stream, struct uci_pac pctx-file = stream; while (!feof(pctx-file)) { + pctx-pos = 0; uci_getln(ctx, 0); if (!pctx-buf[0]) continue; @@ -223,7 +227,7 @@ static int uci_parse_delta(struct uci_context *ctx, FILE *stream, struct uci_pac * delta as possible */ UCI_TRAP_SAVE(ctx, error); - uci_parse_delta_line(ctx, p, pctx-buf); + uci_parse_delta_line(ctx, p); UCI_TRAP_RESTORE(ctx); changes++; error: @@ -311,11 +315,10 @@ static void uci_filter_delta(struct uci_context *ctx, const char *name, const ch pctx-file = f; while (!feof(f)) { struct uci_element *e; - char *buf; + pctx-pos = 0; uci_getln(ctx, 0); - buf = pctx-buf; - if (!buf[0]) + if (!pctx-buf[0]) continue; /* NB: need to allocate the element before the call to @@ -324,7 +327,7 @@ static void uci_filter_delta(struct uci_context *ctx, const char *name, const ch e = uci_alloc_generic(ctx, UCI_TYPE_DELTA, pctx-buf, sizeof(struct uci_element)); uci_list_add(list, e-list); - uci_parse_delta_tuple(ctx, buf, ptr); + uci_parse_delta_tuple(ctx, ptr); if (section) { if (!ptr.section || (strcmp(section, ptr.section) != 0)) continue; diff --git a/file.c b/file.c index 63ca919..177cee6 100644 --- a/file.c +++ b/file.c @@ -278,15 +278,12 @@ int uci_parse_argument(struct uci_context *ctx, FILE *stream, char **str, char * uci_alloc_parse_context(ctx); ctx-pctx-file = stream; - - if (!*str) { + if (!*str) uci_getln(ctx, 0); - *str = ctx-pctx-buf; - } else { - UCI_ASSERT(ctx, ctx-pctx-pos == *str - ctx-pctx-buf); - } + /*FIXME do we need to skip empty lines? */ *result = next_arg(ctx, false, false); + *str = pctx_cur_str(ctx-pctx); return 0; } -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 12/12] uci_internal: use comma expression for UCI_INTERNAL() call.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- uci_internal.h |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uci_internal.h b/uci_internal.h index 89863f1..cb8f86c 100644 --- a/uci_internal.h +++ b/uci_internal.h @@ -227,10 +227,10 @@ struct uci_backend _var = { \ * Sets Exception handling to passthrough mode. * Allows API functions to change behavior compared to public use */ -#define UCI_INTERNAL(func, ctx, ...) do { \ - ctx-internal = true; \ - func(ctx, __VA_ARGS__); \ -} while (0) +#define UCI_INTERNAL(func, ctx, ...) ( \ + ctx-internal = true, \ + func(ctx, __VA_ARGS__) \ +) /** * UCI_NESTED: Do an normal nested call of a public API function -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v4 4/4] kernel: 3.18: Strip off all the useless options
On Sat, Dec 13, 2014 at 07:50:52PM +0100, Jonas Gorski wrote: Ok, I think most of it is because of options enabled by default. I wonder why that happens, but I also wonder why it hasn't been picked up by my tests. I already somewhat expected that. So make savedefconfig then likely dropped any non-generic non-arm config symbols regardless whether they are at their default or non-default values, causing these discrepancies on non-arm targets. The safest would be to create the reduced config-* as the union of all target's savedefconfig results, but only using one for each ARCH might also suffice. I don't think the latter is supported right now, so the first one would be the easiest path to follow (and that doesn't prevent from adding later those arch defconfig fragments, that makes a lot of sense too). What configuration are you using? Do you have any modifications of some sort (beside the switch to 3.18?) All I did was switch to 3.18, then did a make target/linux/compile (so it generated and cleaned up the .config in build_dir/target-*/linux-*/). I might have a few non-default values in the openwrt-buildroot config, but I did not have any local patches applied. Ok. One other thing I just noticed: this currently makes make kernel_*config unusable. make kernel_oldconfig will ask about about everything that is at its defaultvalue, while finishing any *config will result all default values to be added to the config-* in target/linux/target/. This might be easily fixable by running make savedefconfig first before the openwrt scripts create the difference from the generic config-* and the new .config for the new target config-* Hmmm, indeed. I'll fix that. Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v4 4/4] kernel: 3.18: Strip off all the useless options
On Mon, Dec 15, 2014 at 11:09 AM, Maxime Ripard wrote: On Sat, Dec 13, 2014 at 07:50:52PM +0100, Jonas Gorski wrote: One other thing I just noticed: this currently makes make kernel_*config unusable. make kernel_oldconfig will ask about about everything that is at its defaultvalue, while finishing any *config will result all default values to be added to the config-* in target/linux/target/. This might be easily fixable by running make savedefconfig first before the openwrt scripts create the difference from the generic config-* and the new .config for the new target config-* Hmmm, indeed. I'll fix that. Don't get too hung up on the kernel_oldconfig asking about everything part. I currently don't see a way to fix that with reduced configs, as the information required for that is exactly what you are trying to lose. So I won't expect the impossible ;-) Jonas ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] add preinit_regular diag.sh set_state argument
On 14 December 2014 at 23:00, Rafał Miłecki zaj...@gmail.com wrote: This new argument is used right after starting regular preinit (which happens if failsafe wasn't triggered). The main purpose of preinit argument is to indicate that failsafe can be triggered, however we were missing a way to inform user that we don't wait for a trigger anymore. With this change it's clear when failsafe mode can be triggered. https://dev.openwrt.org/changeset/43715 Thanks John! ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH RFC] brcm47xx: support for flashing CHK and CyberTAN images
This will allow simple sysupgrade-s including simpler reverting to the original firmware. Signed-off-by: Rafał Miłecki zaj...@gmail.com --- .../brcm47xx/base-files/lib/upgrade/platform.sh| 33 ++ 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh index 1cb11b5..be7d02a 100644 --- a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh @@ -41,14 +41,12 @@ platform_check_image() { local board_id_len=$(($header_len - 40)) local board_id=$(dd if=$1 skip=40 bs=1 count=$board_id_len 2/dev/null | hexdump -v -e '1/1 %c') echo Found CHK image with device board_id $board_id - echo Flashing CHK images in unsupported. Please use only .trx files. - return 1 + return 0 ;; cybertan) local magic=$(dd if=$1 bs=1 count=4 2/dev/null | hexdump -v -e '1/1 %c') echo Found CyberTAN image with device magic: $magic - echo Flashing CyberTAN images in unsupported. Please use only .trx files. - return 1 + return 0 ;; trx) return 0 @@ -60,4 +58,29 @@ platform_check_image() { esac } -# use default for platform_do_upgrade() +platform_do_upgrade_chk() { + local header_len=$((0x$(get_magic_long_at $1 4))) + local trx=/tmp/$1.trx + + dd if=$1 of=$trx bs=$header_len skip=1 + shift + default_do_upgrade $trx $@ +} + +platform_do_upgrade_cybertan() { + local trx=/tmp/$1.trx + + dd if=$1 of=$trx bs=32 skip=1 + shift + default_do_upgrade $trx $@ +} + +platform_do_upgrade() { + local file_type=$(brcm47xx_identify $1) + + case $file_type in + chk) platform_do_upgrade_chk $ARGV;; + cybertan) platform_do_upgrade_cybertan $ARGV;; + *) default_do_upgrade $ARGV;; + esac +} -- 1.8.4.5 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v4 4/4] kernel: 3.18: Strip off all the useless options
On Sat, Dec 13, 2014 at 07:50:52PM +0100, Jonas Gorski wrote: Ok, I think most of it is because of options enabled by default. I wonder why that happens, but I also wonder why it hasn't been picked up by my tests. I already somewhat expected that. So make savedefconfig then likely dropped any non-generic non-arm config symbols regardless whether they are at their default or non-default values, causing these discrepancies on non-arm targets. The safest would be to create the reduced config-* as the union of all target's savedefconfig results, but only using one for each ARCH might also suffice. So, I just gave the union of all the config symbol a try, and while it fixes some issues, it also shows up something unexpected (logic, actually, but I didn't think of that). The differences that we have now are for the options that we enable through another way than the config-version file itself (like the target configuration, or the openwrt makefiles directly), that in turn have options that depends on them with a default to yes, and that we don't want to enable. In short, something like config FOO bool 'Some option' config BAR bool 'Some other option' depends on FOO default y If FOO is not enabled, the defconfig won't have any information on BAR, which means that if FOO gets enabled somehow, BAR will be set to y. I guess that in such a case, it should be up to the one that enables the FOO option to also enforce a BAR value if the default is not ok. That would be easy to do for the target configuration files, but not that much whenever it's a package that enables that option for example. And putting it in the global configuration kind of defeats the original purpose of this patch set. So I guess we should define a policy on this. What do you think? Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] UCI usage table missing entries for del_list and reorder
Yes, it's a wiki but I'll let someone higher up the food chain fix this: http://wiki.openwrt.org/doc/uci#usage wherein neither the command usage output nor the table of UCI subcommands mentions either del_list or reorder. rday ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 1/4] brcm63xx: add bcm6345-gpio driver
Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com --- v2: use vendor for DT properties. diff --git a/target/linux/brcm63xx/config-3.14 b/target/linux/brcm63xx/config-3.14 index dd27f47..f94c567 100644 --- a/target/linux/brcm63xx/config-3.14 +++ b/target/linux/brcm63xx/config-3.14 @@ -76,6 +76,7 @@ CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GPIOLIB=y +CONFIG_GPIO_BCM6345=y CONFIG_GPIO_DEVRES=y CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set diff --git a/target/linux/brcm63xx/config-3.18 b/target/linux/brcm63xx/config-3.18 index e3cf020..7957d02 100644 --- a/target/linux/brcm63xx/config-3.18 +++ b/target/linux/brcm63xx/config-3.18 @@ -80,6 +80,7 @@ CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GPIOLIB=y +CONFIG_GPIO_BCM6345=y CONFIG_GPIO_DEVRES=y CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set diff --git a/target/linux/brcm63xx/patches-3.14/374-GPIO-add-bcm6345-driver.patch b/target/linux/brcm63xx/patches-3.14/374-GPIO-add-bcm6345-driver.patch new file mode 100644 index 000..847933b --- /dev/null +++ b/target/linux/brcm63xx/patches-3.14/374-GPIO-add-bcm6345-driver.patch @@ -0,0 +1,244 @@ +--- /dev/null b/drivers/gpio/gpio-bcm6345.c +@@ -0,0 +1,216 @@ ++/* ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive ++ * for more details. ++ * ++ * Copyright (C) 2008 Maxime Bizon mbi...@freebox.fr ++ * Copyright (C) 2008-2011 Florian Fainelli flor...@openwrt.org ++ * Copyright (C) 2014 Álvaro Fernández Rojas nolt...@gmail.com ++ */ ++ ++#include linux/kernel.h ++#include linux/module.h ++#include linux/spinlock.h ++#include linux/platform_device.h ++#include linux/gpio.h ++ ++enum bcm6345_gpio_reg { ++ GPIO_REG_CTL_HI = 0, ++ GPIO_REG_CTL_LO, ++ GPIO_REG_DATA_HI, ++ GPIO_REG_DATA_LO, ++ GPIO_REG_MAX ++}; ++ ++struct bcm6345_gpio_chip { ++ struct gpio_chip chip; ++ u8 regs[GPIO_REG_MAX]; ++ ++ spinlock_t lock; ++ void __iomem *membase; ++}; ++ ++static inline struct bcm6345_gpio_chip *to_bcm6345_gpio(struct gpio_chip *chip) ++{ ++ struct bcm6345_gpio_chip *bg; ++ ++ bg = container_of(chip, struct bcm6345_gpio_chip, chip); ++ ++ return bg; ++} ++ ++static inline u32 bc_gpio_r32(struct bcm6345_gpio_chip *bg, u8 reg) ++{ ++ return ioread32be(bg-membase + bg-regs[reg]); ++} ++ ++static inline void bc_gpio_w32(struct bcm6345_gpio_chip *bg, u8 reg, u32 val) ++{ ++ iowrite32be(val, bg-membase + bg-regs[reg]); ++} ++ ++static void bcm6345_gpio_set(struct gpio_chip *chip, unsigned gpio, int value) ++{ ++ struct bcm6345_gpio_chip *bg = to_bcm6345_gpio(chip); ++ unsigned long flags; ++ u32 mask, val; ++ u8 reg; ++ ++ if (gpio 32) { ++ reg = GPIO_REG_DATA_LO; ++ mask = BIT(gpio); ++ } else { ++ reg = GPIO_REG_DATA_HI; ++ mask = BIT(gpio - 32); ++ } ++ ++ spin_lock_irqsave(bg-lock, flags); ++ val = bc_gpio_r32(bg, reg); ++ if (value) ++ val |= mask; ++ else ++ val = ~mask; ++ bc_gpio_w32(bg, reg, val); ++ spin_unlock_irqrestore(bg-lock, flags); ++} ++ ++static int bcm6345_gpio_get(struct gpio_chip *chip, unsigned gpio) ++{ ++ struct bcm6345_gpio_chip *bg = to_bcm6345_gpio(chip); ++ u32 mask; ++ u8 reg; ++ ++ if (gpio 32) { ++ reg = GPIO_REG_DATA_LO; ++ mask = BIT(gpio); ++ } else { ++ reg = GPIO_REG_DATA_HI; ++ mask = BIT(gpio - 32); ++ } ++ ++ return !!(bc_gpio_r32(bg, reg) mask); ++} ++ ++static int bcm6345_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) ++{ ++ struct bcm6345_gpio_chip *bg = to_bcm6345_gpio(chip); ++ unsigned long flags; ++ u32 mask, val; ++ u8 reg; ++ ++ if (gpio 32) { ++ reg = GPIO_REG_CTL_LO; ++ mask = BIT(gpio); ++ } else { ++ reg = GPIO_REG_CTL_HI; ++ mask = BIT(gpio - 32); ++ } ++ ++ spin_lock_irqsave(bg-lock, flags); ++ val = bc_gpio_r32(bg, reg) ~mask; ++ bc_gpio_w32(bg, reg, val); ++ spin_unlock_irqrestore(bg-lock, flags); ++ ++ return 0; ++} ++ ++static int bcm6345_gpio_direction_output(struct gpio_chip *chip, unsigned gpio) ++{ ++ struct bcm6345_gpio_chip *bg = to_bcm6345_gpio(chip); ++ unsigned long flags; ++ u32 mask, val; ++ u8 reg; ++ ++ if (gpio 32) { ++ reg = GPIO_REG_CTL_LO; ++ mask = BIT(gpio); ++ } else { ++ reg = GPIO_REG_CTL_HI; ++ mask = BIT(gpio - 32); ++ } ++ ++ spin_lock_irqsave(bg-lock, flags); ++ val = bc_gpio_r32(bg, reg) | mask; ++ bc_gpio_w32(bg, reg, val); ++ spin_unlock_irqrestore(bg-lock, flags); ++ ++ return 0; ++}
[OpenWrt-Devel] [PATCH v2 2/4] brcm63xx: use bcm6345-gpio over legacy
Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com --- v2: keep changes minimal as suggested by Jonas diff --git a/target/linux/brcm63xx/patches-3.14/375-DT-GPIO-over-legacy.patch b/target/linux/brcm63xx/patches-3.14/375-DT-GPIO-over-legacy.patch new file mode 100644 index 000..8c9bfc8 --- /dev/null +++ b/target/linux/brcm63xx/patches-3.14/375-DT-GPIO-over-legacy.patch @@ -0,0 +1,45 @@ +diff -uprN a/arch/mips/bcm63xx/boards/board_common.c b/arch/mips/bcm63xx/boards/board_common.c +--- a/arch/mips/bcm63xx/boards/board_common.c 2014-12-10 13:14:58.299519952 +0100 b/arch/mips/bcm63xx/boards/board_common.c 2014-12-13 02:24:59.308489309 +0100 +@@ -222,6 +222,10 @@ int __init board_register_devices(void) + } + #endif + ++ if (!board_of_device_present(gpio0)) { ++ bcm63xx_gpio_init(); ++ } ++ + if (board.has_uart0) + bcm63xx_uart_register(0); + +@@ -287,7 +291,7 @@ int __init board_register_devices(void) + while (led_count ARRAY_SIZE(board.leds) board.leds[led_count].name) + led_count++; + +- if (led_count) { ++ if (led_count !board_of_device_present(gpio0)) { + bcm63xx_led_data.num_leds = led_count; + bcm63xx_led_data.leds = board.leds; + +@@ -302,7 +306,7 @@ int __init board_register_devices(void) + while (button_count ARRAY_SIZE(board.buttons) board.buttons[button_count].desc) + button_count++; + +- if (button_count) { ++ if (button_count !board_of_device_present(gpio0)) { + bcm63xx_gpio_keys_data.nbuttons = button_count; + bcm63xx_gpio_keys_data.buttons = board.buttons; + +diff -uprN a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c +--- a/arch/mips/bcm63xx/prom.c 2014-12-10 13:14:58.299519952 +0100 b/arch/mips/bcm63xx/prom.c 2014-12-10 13:16:13.879516528 +0100 +@@ -54,9 +54,6 @@ void __init prom_init(void) + reg = ~mask; + bcm_perf_writel(reg, PERF_CKCTL_REG); + +- /* register gpiochip */ +- bcm63xx_gpio_init(); +- + /* detect and setup flash access */ + bcm63xx_flash_detect(); + diff --git a/target/linux/brcm63xx/patches-3.18/375-DT-GPIO-over-legacy.patch b/target/linux/brcm63xx/patches-3.18/375-DT-GPIO-over-legacy.patch new file mode 100644 index 000..8c9bfc8 --- /dev/null +++ b/target/linux/brcm63xx/patches-3.18/375-DT-GPIO-over-legacy.patch @@ -0,0 +1,45 @@ +diff -uprN a/arch/mips/bcm63xx/boards/board_common.c b/arch/mips/bcm63xx/boards/board_common.c +--- a/arch/mips/bcm63xx/boards/board_common.c 2014-12-10 13:14:58.299519952 +0100 b/arch/mips/bcm63xx/boards/board_common.c 2014-12-13 02:24:59.308489309 +0100 +@@ -222,6 +222,10 @@ int __init board_register_devices(void) + } + #endif + ++ if (!board_of_device_present(gpio0)) { ++ bcm63xx_gpio_init(); ++ } ++ + if (board.has_uart0) + bcm63xx_uart_register(0); + +@@ -287,7 +291,7 @@ int __init board_register_devices(void) + while (led_count ARRAY_SIZE(board.leds) board.leds[led_count].name) + led_count++; + +- if (led_count) { ++ if (led_count !board_of_device_present(gpio0)) { + bcm63xx_led_data.num_leds = led_count; + bcm63xx_led_data.leds = board.leds; + +@@ -302,7 +306,7 @@ int __init board_register_devices(void) + while (button_count ARRAY_SIZE(board.buttons) board.buttons[button_count].desc) + button_count++; + +- if (button_count) { ++ if (button_count !board_of_device_present(gpio0)) { + bcm63xx_gpio_keys_data.nbuttons = button_count; + bcm63xx_gpio_keys_data.buttons = board.buttons; + +diff -uprN a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c +--- a/arch/mips/bcm63xx/prom.c 2014-12-10 13:14:58.299519952 +0100 b/arch/mips/bcm63xx/prom.c 2014-12-10 13:16:13.879516528 +0100 +@@ -54,9 +54,6 @@ void __init prom_init(void) + reg = ~mask; + bcm_perf_writel(reg, PERF_CKCTL_REG); + +- /* register gpiochip */ +- bcm63xx_gpio_init(); +- + /* detect and setup flash access */ + bcm63xx_flash_detect(); + ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 3/4] brcm63xx: backport spi-gpio no cs
Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com --- diff --git a/target/linux/brcm63xx/patches-3.14/376-DT-SPI-GPIO-no-cs-backport.patch b/target/linux/brcm63xx/patches-3.14/376-DT-SPI-GPIO-no-cs-backport.patch new file mode 100644 index 000..b289d5c --- /dev/null +++ b/target/linux/brcm63xx/patches-3.14/376-DT-SPI-GPIO-no-cs-backport.patch @@ -0,0 +1,78 @@ +diff --git a/Documentation/devicetree/bindings/spi/spi-gpio.txt b/Documentation/devicetree/bindings/spi/spi-gpio.txt +index 8a824be..a95603b 100644 +--- a/Documentation/devicetree/bindings/spi/spi-gpio.txt b/Documentation/devicetree/bindings/spi/spi-gpio.txt +@@ -8,8 +8,10 @@ Required properties: + - gpio-sck: GPIO spec for the SCK line to use + - gpio-miso: GPIO spec for the MISO line to use + - gpio-mosi: GPIO spec for the MOSI line to use +- - cs-gpios: GPIOs to use for chipselect lines +- - num-chipselects: number of chipselect lines ++ - cs-gpios: GPIOs to use for chipselect lines. ++ Not needed if num-chipselects = 0. ++ - num-chipselects: Number of chipselect lines. Should be 0 if a single device ++with no chip select is connected. + + Example: + +diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c +index 9f59553..f0492c9 100644 +--- a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c +@@ -413,6 +413,7 @@ static int spi_gpio_probe(struct platform_device *pdev) + struct spi_gpio_platform_data *pdata; + u16 master_flags = 0; + bool use_of = 0; ++ int num_devices; + + status = spi_gpio_probe_dt(pdev); + if (status 0) +@@ -422,16 +423,21 @@ static int spi_gpio_probe(struct platform_device *pdev) + + pdata = dev_get_platdata(pdev-dev); + #ifdef GENERIC_BITBANG +- if (!pdata || !pdata-num_chipselect) ++ if (!pdata || (!use_of !pdata-num_chipselect)) + return -ENODEV; + #endif + ++ if (use_of !SPI_N_CHIPSEL) ++ num_devices = 1; ++ else ++ num_devices = SPI_N_CHIPSEL; ++ + status = spi_gpio_request(pdata, dev_name(pdev-dev), master_flags); + if (status 0) + return status; + + master = spi_alloc_master(pdev-dev, sizeof(*spi_gpio) + +- (sizeof(int) * SPI_N_CHIPSEL)); ++ (sizeof(int) * num_devices)); + if (!master) { + status = -ENOMEM; + goto gpio_free; +@@ -446,7 +452,7 @@ static int spi_gpio_probe(struct platform_device *pdev) + master-bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32); + master-flags = master_flags; + master-bus_num = pdev-id; +- master-num_chipselect = SPI_N_CHIPSEL; ++ master-num_chipselect = num_devices; + master-setup = spi_gpio_setup; + master-cleanup = spi_gpio_cleanup; + #ifdef CONFIG_OF +@@ -461,9 +467,12 @@ static int spi_gpio_probe(struct platform_device *pdev) +* property of the node. +*/ + +- for (i = 0; i SPI_N_CHIPSEL; i++) +- spi_gpio-cs_gpios[i] = +- of_get_named_gpio(np, cs-gpios, i); ++ if (!SPI_N_CHIPSEL) ++ spi_gpio-cs_gpios[0] = SPI_GPIO_NO_CHIPSELECT; ++ else ++ for (i = 0; i SPI_N_CHIPSEL; i++) ++ spi_gpio-cs_gpios[i] = ++ of_get_named_gpio(np, cs-gpios, i); + } + #endif + diff --git a/target/linux/brcm63xx/patches-3.18/376-DT-SPI-GPIO-no-cs-backport.patch b/target/linux/brcm63xx/patches-3.18/376-DT-SPI-GPIO-no-cs-backport.patch new file mode 100644 index 000..b289d5c --- /dev/null +++ b/target/linux/brcm63xx/patches-3.18/376-DT-SPI-GPIO-no-cs-backport.patch @@ -0,0 +1,78 @@ +diff --git a/Documentation/devicetree/bindings/spi/spi-gpio.txt b/Documentation/devicetree/bindings/spi/spi-gpio.txt +index 8a824be..a95603b 100644 +--- a/Documentation/devicetree/bindings/spi/spi-gpio.txt b/Documentation/devicetree/bindings/spi/spi-gpio.txt +@@ -8,8 +8,10 @@ Required properties: + - gpio-sck: GPIO spec for the SCK line to use + - gpio-miso: GPIO spec for the MISO line to use + - gpio-mosi: GPIO spec for the MOSI line to use +- - cs-gpios: GPIOs to use for chipselect lines +- - num-chipselects: number of chipselect lines ++ - cs-gpios: GPIOs to use for chipselect lines. ++ Not needed if num-chipselects = 0. ++ - num-chipselects: Number of chipselect lines. Should be 0 if a single device ++with no chip select is connected. + + Example: + +diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c +index 9f59553..f0492c9 100644 +--- a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c +@@ -413,6 +413,7 @@ static int spi_gpio_probe(struct platform_device *pdev) + struct spi_gpio_platform_data *pdata; + u16 master_flags = 0; + bool use_of = 0; ++ int num_devices; +
[OpenWrt-Devel] [PATCH v2 4/4] brcm63xx: add GPIOs to DT
Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com --- v2: remove dummy CS for devices with 74HC164 and fix HG520v inet LED diff --git a/target/linux/brcm63xx/dts/a226g.dts b/target/linux/brcm63xx/dts/a226g.dts index 9aff81b..0c26c7b 100644 --- a/target/linux/brcm63xx/dts/a226g.dts +++ b/target/linux/brcm63xx/dts/a226g.dts @@ -5,6 +5,83 @@ / { model = Pirelli A226G; compatible = pirelli,a226g, brcm,bcm6358; + + gpio-keys-polled { + compatible = gpio-keys-polled; + #address-cells = 1; + #size-cells = 0; + poll-interval = 20; + debounce-interval = 60; + + wps { + label = wps; + gpios = gpio0 34 1; + linux,code = 0x211; + }; + reset { + label = reset; + gpios = gpio0 37 1; + linux,code = 0x198; + }; + }; + + gpio-leds { + compatible = gpio-leds; + + voip_red { + label = DWV-S0:red:VoIP; + gpios = gpio0 0 1; + }; + eth_red { + label = DWV-S0:red:ethernet; + gpios = gpio0 1 1; + }; + dsl_green { + label = DWV-S0:green:ADSL; + gpios = gpio0 2 1; + }; + usb_green { + label = DWV-S0:green:USB; + gpios = gpio0 3 1; + }; + power_green { + label = DWV-S0:green:power; + gpios = gpio0 4 1; + default-state = on; + }; + power_red { + label = DWV-S0:red:power; + gpios = gpio0 5 1; + }; + inet_red { + label = DWV-S0:red:internet; + gpios = gpio0 6 1; + }; + inet_green { + label = DWV-S0:green:internet; + gpios = gpio0 7 1; + }; + eth_green { + label = DWV-S0:green:ethernet; + gpios = gpio0 8 1; + }; + voip_green { + label = DWV-S0:green:VoIP; + gpios = gpio0 9 1; + }; + wifi_red { + label = DWV-S0:red:wifi; + gpios = gpio0 10 1; + }; + usb_red { + label = DWV-S0:red:USB; + gpios = gpio0 11 1; + }; + dsl_red { + label = DWV-S0:red:ADSL; + gpios = gpio0 12 1; + }; + }; }; pflash { diff --git a/target/linux/brcm63xx/dts/a226m-fwb.dts b/target/linux/brcm63xx/dts/a226m-fwb.dts index 1abf870..4963c90 100644 --- a/target/linux/brcm63xx/dts/a226m-fwb.dts +++ b/target/linux/brcm63xx/dts/a226m-fwb.dts @@ -5,6 +5,83 @@ / { model = Pirelli A226M-FWB; compatible = pirelli,a226m-fwb, brcm,bcm6358; + + gpio-keys-polled { + compatible = gpio-keys-polled; + #address-cells = 1; + #size-cells = 0; + poll-interval = 20; + debounce-interval = 60; + + wps { + label = wps; + gpios = gpio0 34 1; + linux,code = 0x211; + }; + reset { + label = reset; + gpios = gpio0 37 1; + linux,code = 0x198; + }; + }; + + gpio-leds { + compatible = gpio-leds; + + voip_red { + label = DWV-S0:red:VoIP; + gpios = gpio0 0 1; + }; + eth_red { + label = DWV-S0:red:ethernet; + gpios = gpio0 1 1; + }; + dsl_green { + label = DWV-S0:green:ADSL; + gpios = gpio0 2 1; + }; + usb_green { + label = DWV-S0:green:USB; + gpios = gpio0 3 1; + }; + power_green { + label = DWV-S0:green:power; + gpios = gpio0 4 1; + default-state = on; + }; + power_red { + label = DWV-S0:red:power; + gpios = gpio0 5 1; + }; + inet_red { + label = DWV-S0:red:internet; + gpios = gpio0 6 1; + }; + inet_green { +
Re: [OpenWrt-Devel] [PATCH 1/3] brcm63xx: add bcm6345-gpio driver
2014-12-12 6:33 GMT-08:00 Jonas Gorski j...@openwrt.org: On Fri, Dec 12, 2014 at 3:17 PM, John Crispin blo...@openwrt.org wrote: On 12/12/2014 15:12, Jonas Gorski wrote: or the gpio-base problem, we should be able to register appropriate platform data for it as OF_DEV_AUXDATA() in of_platform_populate. e.g. struct bgpio_pdata gpio0_pdata = { .base = 0, }; struct bgpio_pdata gpio1_pdata = { .base = 32, }; tried it for ralink and lantiq and it got nak'ed by LinusW i keep that part of the code as a small patch inside owrt on top of the stuff i sent upstream. Wasn't the objection on putting the gpio base into the dts(i) file itself? I explicitly try to avoid that here, as gpio-base is something linux internal. Right that is typically the objection, but with the new gpio descriptor based API, we should not have that problem anymore, right? But It doesn't matter much for now as not even basic DT support is upstream, so these won't go anywhere soon. -- Florian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] kirkwood gcc/binutils woe?
On 2014-12-14 12:02, Harald Geyer wrote: nwf writes: $ gcc -v -o hello hello.c [...] /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux_eabi -o hello /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crt1.o /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crti.o /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crtbegin.o -L/usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3 -L/usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/../../.. /tmp/ccjOqw9X.o -lgcc_s -lc -lgcc_s /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crtend.o /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crtn.o /usr/bin/ld: cannot find -lgcc collect2: error: ld returned 1 exit status Well, yes, that's true... $ find / -name \*libgcc\* /lib/libgcc_s.so.1 /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc_s.so.1 /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc_s.so /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc.map /usr/lib/opkg/info/libgcc.list /usr/lib/opkg/info/libgcc.control Grepping about at random I find that /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc_s.so contains the directive GROUP ( libgcc_s.so.1 -lgcc ) Actually citing libgcc_s.so in full makes things a bit clearer: $ cat libgcc_s.so /* GNU ld script Use the shared library, but some functions are only in the static library. */ GROUP ( libgcc_s.so.1 -lgcc ) So I think the desire to save space expressed in feeds/packages/devel/gcc/README is well-intentioned but possibly stale, so maybe the following, too? Maybe we should be removing libgcc_pic.a but not libgcc.a? Seems reasonable. Since gcc seems to work for Christian as is, this might be architecture dependent. Christian, any insight on this? As far as binutils is concerned the patch below seems to work as expected, so I can now add my Signed-off-by: Harald Geyer har...@ccbib.org Felix, can you take this as is or should I resend the patch? Removing libgcc_pic.a and adding libgcc.a makes sense to me. You could remove libgcc_pic.a by removing 820-libgcc_pic.patch - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] kirkwood gcc/binutils woe?
On 15/12/2014 16:16, Felix Fietkau wrote: On 2014-12-14 12:02, Harald Geyer wrote: nwf writes: $ gcc -v -o hello hello.c [...] /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux_eabi -o hello /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crt1.o /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crti.o /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crtbegin.o -L/usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3 -L/usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/../../.. /tmp/ccjOqw9X.o -lgcc_s -lc -lgcc_s /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crtend.o /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/crtn.o /usr/bin/ld: cannot find -lgcc collect2: error: ld returned 1 exit status Well, yes, that's true... $ find / -name \*libgcc\* /lib/libgcc_s.so.1 /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc_s.so.1 /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc_s.so /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc.map /usr/lib/opkg/info/libgcc.list /usr/lib/opkg/info/libgcc.control Grepping about at random I find that /usr/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/libgcc_s.so contains the directive GROUP ( libgcc_s.so.1 -lgcc ) Actually citing libgcc_s.so in full makes things a bit clearer: $ cat libgcc_s.so /* GNU ld script Use the shared library, but some functions are only in the static library. */ GROUP ( libgcc_s.so.1 -lgcc ) So I think the desire to save space expressed in feeds/packages/devel/gcc/README is well-intentioned but possibly stale, so maybe the following, too? Maybe we should be removing libgcc_pic.a but not libgcc.a? Seems reasonable. Since gcc seems to work for Christian as is, this might be architecture dependent. Christian, any insight on this? As far as binutils is concerned the patch below seems to work as expected, so I can now add my Signed-off-by: Harald Geyer har...@ccbib.org Felix, can you take this as is or should I resend the patch? Removing libgcc_pic.a and adding libgcc.a makes sense to me. You could remove libgcc_pic.a by removing 820-libgcc_pic.patch - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel gcc is in a github feed so please send a PR or open an issue on github for this. we cannot merge it via the ML John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar8216: Use IGMP Join and Fast Leave functions
On 12 December 2014 at 16:16, Felix Fietkau n...@openwrt.org wrote: On 2014-12-05 15:36, Cristian Morales Vega wrote: Avoids flooding the network with multicast data. Signed-off-by: Cristian Morales Vega crist...@samknows.com --- Since I guess not all the switches support this... Good idea? Is some OpenWRT package expecting to receive the multicast packages? At the very least you lose the capacity of using iptables to play with the packets. I think this needs to be optional (and preferably disabled by default initially, until it has received more testing). Sure. I will send another patch. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] nftables development and support in openwrt
Hi Steven, afaik - and please correct me if I'm wrong - that works only for the iptables CLI command, however our firewall tool currently uses libiptables directly so I don't think it would work easily. You are right. I asked it in the netfilter-devel mailing list - libipct was never meant to be used as a public interface: http://www.netfilter.org/documentation/FAQ/netfilter-faq-4.html#ss4.5 Also at the moment its not very clear when the netfilter team will create a high-level library to interact with nftables which would probably be sort of a prerequisite for it depending on how this rewritten daemon will work. I'm not sure if such a high level library is planned by the netfilter team, but why isn't libnftnl sufficient for rewriting the openwrt firewall daemon? Back to original problem of adding iptables rules awareness to kernel modules - I think that until nftables is fully supported in openwrt, it is possible to either patch the firewall package or libipct to notify about rules changes. Can such a change be acceptable in formal release? Best Regards, Tomer On Mon, Dec 15, 2014 at 9:18 AM, Steven Barth cy...@openwrt.org wrote: Hi Tomer, Regarding the firewall package - its probably a dumb question, but isn't this the reason for nftables' compatibility layer? (http://git.netfilter.org/iptables-nftables/) afaik - and please correct me if I'm wrong - that works only for the iptables CLI command, however our firewall tool currently uses libiptables directly so I don't think it would work easily. Cheers, Steven Best Regards, Tomer On Dec 14, 2014 7:08 PM, Steven Barth cy...@openwrt.org wrote: Hi Tomer, I am currently working on a kernel module which offloads traffic from the Networking stack. This is part of a project which optimizes IP forwarding for low end routers that have weak CPU and low on memory. Sounds interesting. Other approaches of speeding up forwarding are btw. also investigated right now, see https://dev.openwrt.org/changeset/43587 I saw that nftables and libnftables are not yet supported in my openwrt codebase (I am working with attitude adjustment 14.07) there is no attitude adjustment 14.07. attitude adjustment is 12.09, barrier breaker is 14.07. - but saw that recently some nftables related patches were added to the master branch by you. Could you please share the current status of nftables support in openwrt? nftables is packaged, I added some patches so that it is a bit more embedded friendly (some of those are upstream, some of them aren't). I also packaged and reorganised the netfilter kernel packages. So you can select nftables in menuconfig and can play around with it. You can also get rid of iptables and use nftables only by deselecting the related packages. Known Issues * In general its not well tested. It might blow up here or there. Help and bugreports are appreciated. * We are aiming for kernel 3.14 for the next release which has somewhat reasonable nftables support but lacks some useful things e.g. devgroups, extended reject support among maybe other things iirc. So it will be there to play around / get a first look at it but thats it. I don't know how the following release will look but I wouldn't keep my hopes up all too high there for it to change that much. * Which brings us to the main issue, our firewall abstraction (the firewall package, all the /etc/config/firewall magic) is tied to iptables at the moment, so if you want to use nftables right now you get bare metal and have to write your own rulesets completely from scratch, cannot use /etc/config/firewall or a gui. Hopefully someone will put some effort into this next year and refactor our firewall daemon to use nftables but thats a major effort. Also at the moment its not very clear when the netfilter team will create a high-level library to interact with nftables which would probably be sort of a prerequisite for it depending on how this rewritten daemon will work. Regardless, I will be happy to participate with the development and testing of nftables if needed, just let me know if I can help, Feel free to play around with it and send me bugreports etc. If it looks like an nftables bug you should probably contact the netfilter guys directly. If it looks like I messed up a patch or a package definition then tell me. Cheers, Steven ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] nftables development and support in openwrt
You are right. I asked it in the netfilter-devel mailing list - libipct was never meant to be used as a public interface: http://www.netfilter.org/documentation/FAQ/netfilter-faq-4.html#ss4.5 Meh, absent of anything else it de-facto is anyway, see e.g. squid, miniupnpd and others using it as well. Also at the moment its not very clear when the netfilter team will create a high-level library to interact with nftables which would probably be sort of a prerequisite for it depending on how this rewritten daemon will work. I'm not sure if such a high level library is planned by the netfilter team, but why isn't libnftnl sufficient for rewriting the openwrt firewall daemon? I've seen a high-level library being mentioned in some nftables presentations, e.g. https://home.regit.org/wp-content/uploads/2014/09/2014_kernel_recipes_nftables.pdf The problem is this: libnftnl only allows manipulating nftables tables etc. but doesn't help with generating BPF-bytecode of the actual rules. This is done by the nftables-binary but not in a library. Generating that BPF-code is the actual hard part here and using libnftnl directly would mean we would have to do that on our own thus actually reimplementing the stuff that the nftables binary does. Another option would be to generate an nftables rule-file and applying this by calling the nftables binary, not exactly that trivial and / or clean either. Back to original problem of adding iptables rules awareness to kernel modules - I think that until nftables is fully supported in openwrt, it is possible to either patch the firewall package or libipct to notify about rules changes. Can such a change be acceptable in formal release? Notify whom? I mean we could probably notify someone or something when the high-level openwrt firewall is reloaded. In fact there is already a user-script hook. Cheers, Steven Best Regards, Tomer On Mon, Dec 15, 2014 at 9:18 AM, Steven Barth cy...@openwrt.org wrote: Hi Tomer, Regarding the firewall package - its probably a dumb question, but isn't this the reason for nftables' compatibility layer? (http://git.netfilter.org/iptables-nftables/) afaik - and please correct me if I'm wrong - that works only for the iptables CLI command, however our firewall tool currently uses libiptables directly so I don't think it would work easily. Cheers, Steven Best Regards, Tomer On Dec 14, 2014 7:08 PM, Steven Barth cy...@openwrt.org wrote: Hi Tomer, I am currently working on a kernel module which offloads traffic from the Networking stack. This is part of a project which optimizes IP forwarding for low end routers that have weak CPU and low on memory. Sounds interesting. Other approaches of speeding up forwarding are btw. also investigated right now, see https://dev.openwrt.org/changeset/43587 I saw that nftables and libnftables are not yet supported in my openwrt codebase (I am working with attitude adjustment 14.07) there is no attitude adjustment 14.07. attitude adjustment is 12.09, barrier breaker is 14.07. - but saw that recently some nftables related patches were added to the master branch by you. Could you please share the current status of nftables support in openwrt? nftables is packaged, I added some patches so that it is a bit more embedded friendly (some of those are upstream, some of them aren't). I also packaged and reorganised the netfilter kernel packages. So you can select nftables in menuconfig and can play around with it. You can also get rid of iptables and use nftables only by deselecting the related packages. Known Issues * In general its not well tested. It might blow up here or there. Help and bugreports are appreciated. * We are aiming for kernel 3.14 for the next release which has somewhat reasonable nftables support but lacks some useful things e.g. devgroups, extended reject support among maybe other things iirc. So it will be there to play around / get a first look at it but thats it. I don't know how the following release will look but I wouldn't keep my hopes up all too high there for it to change that much. * Which brings us to the main issue, our firewall abstraction (the firewall package, all the /etc/config/firewall magic) is tied to iptables at the moment, so if you want to use nftables right now you get bare metal and have to write your own rulesets completely from scratch, cannot use /etc/config/firewall or a gui. Hopefully someone will put some effort into this next year and refactor our firewall daemon to use nftables but thats a major effort. Also at the moment its not very clear when the netfilter team will create a high-level library to interact with nftables which would probably be sort of a prerequisite for it depending on how this rewritten daemon will work. Regardless, I will be happy to participate with the development and testing of nftables if needed, just let me know if I can help, Feel free to play around with it and send me bugreports etc.
[OpenWrt-Devel] Need to add kmod-usb2-pci to Intel ixp4xx and AMD Geode devices
Recent builds for NSLU2 and my Alix3d2 platforms did not have a USB controller recognized! Turns out the latest usb2 driver structure requires the addition of kmod-usb2-pci to be added to the target config. See patch below... I believe this issue exists for any platform that has a USB controller attached to a PCI bus as was the case of the alix2 target config in change-set #37835 (sha1: e7190ac69b9fbe2f7103b8d71ef1c214e065f3b2). This patch should probably be applied to several other device configs (geos, net5501, nas100d, etc.), but I cannot test them. /ted Example patch: diff --git a/target/linux/ixp4xx/generic/profiles/200-NSLU2.mk b/target/linux/ixp4xx/generic/profile index 1f5a4dd..f201535 100644 --- a/target/linux/ixp4xx/generic/profiles/200-NSLU2.mk +++ b/target/linux/ixp4xx/generic/profiles/200-NSLU2.mk @@ -8,7 +8,7 @@ define Profile/NSLU2 NAME:=Linksys NSLU2 PACKAGES:=-wpad-mini -kmod-ath5k kmod-scsi-core \ - kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage \ + kmod-usb-core kmod-usb-ohci kmod-usb2-pci kmod-usb2 kmod-usb-storage \ kmod-fs-ext4 endef ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [procd] How to redirect STDOUT/STDERR of a started service ?
Am 14.12.2014 um 19:42 schrieb John Crispin: On 14/12/2014 19:27, Christian Schoenebeck wrote: Hi, I provided privoxy 3.0.22 package with scripts using procd to run the service. When privoxy runs in foreground it never writes to logfile. So it's required to redirect stdout and/or stderr of this started service to a file. I asked the developers of privoxy how to fix this. I got a tip to create a patch for privoxy to fix this problem but it's not supported. I think there must be a chance to give parameters to procd to redirect STDOUT/STDERR. I tried procd_append_param command '/var/log/out.log' and procd_append_param command '2/var/log/error.log' without and with single and double quotes without success. The service did not start without any errors reported neither from the service nor from procd. If I redirect from the command line everything works fine. What did I wrong ? How to debug whats going on ? Thanks for support Christian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel Hi, that wont work i am afraid. logging to a file is a bit quirky as the log wont rotate and eventually fill up /tmp. i will look into this during the week and add an option to redirect stdout to the syslog. John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel Hi John, the logging problem of services like privoxy or dnsmasq and others exists also without procd. For this there is logrotate or self written scripts that do the truncate. My problems during testing was that there was no output from procd, why the process was not started. Something like syntax error or similar, either on console or inside syslog would help. I think it should be possible to redirect stdout and stderr of a by procd started process to file. This file could be /dev/null by default (like today), to /dev/stderr or /dev/stdout for console output, /var/log/file or other files or simply accept 2. as command line parameter. Then it's possible to 1:1 transfer a working command line to procd_set_param/procd_append_param command ... or if there are problems with handover via json procd_set_param stdout /dev/null(what is the default if nothing given) procd_set_param stderr /dev/null What do you think ? I don't know what is possible to code. From my point of view it's currently not mission critical I will publish a modified package for privoxy using the old scripts for the moment. Christian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH][modules] Add support for Realtek r8712 and RTL8192SU.
Add support for Realtek r8712 and RTL8192SU family. This patch adds support for Realtek r8712 and RTL8188SU/RTL8191SU/RTL8192SU family of fullmac usb wireless cards. The r8712u staging driver only supports WEXT but works with no problems in OpenWRT. Signed off by: José Vázquez Fernández ppvazquez...@gmail.com Index: package/kernel/linux/modules/wireless.mk === --- package/kernel/linux/modules/wireless.mk(revisión: 43720) +++ package/kernel/linux/modules/wireless.mk(copia de trabajo) @@ -126,3 +126,35 @@ $(eval $(call KernelPackage,net-rtl8188eu)) +define KernelPackage/net-rtl8192su + SUBMENU:=$(WIRELESS_MENU) + TITLE:=RTL8192SU support (staging) + DEPENDS:=@USB_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-usb-core + KCONFIG:=\ + CONFIG_STAGING=y \ + CONFIG_R8712U + FILES:=$(LINUX_DIR)/drivers/staging/rtl8712/r8712u.ko + AUTOLOAD:=$(call AutoProbe,r8712u) +endef + +define KernelPackage/net-rtl8192su/description + Kernel modules for RealTek RTL8712 and RTL81XXSU fullmac support. + +endef +# R8712 FullMAC firmware +R8712_FW:=rtl8712u.bin + +define Download/net-rtl8192su + FILE:=$(R8712_FW) + URL:=http://mirrors.arizona.edu/raspbmc/downloads/bin/lib/wifi/rtlwifi/ +# MD5SUM:=8bd4310971772a486b9784c77f8a6df9 +endef + +define KernelPackage/net-rtl8192su/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(DL_DIR)/$(R8712_FW) $(1)/lib/firmware/rtlwifi/ +endef + +$(eval $(call Download,net-rtl8192su)) +$(eval $(call KernelPackage,net-rtl8192su)) + ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [Fwd: [PATCH][modules][V2] Add support for Realtek r8712 and RTL8192SU.]
Add support for Realtek r8712 and RTL8192SU family. This patch adds support for Realtek r8712 and RTL8188SU/RTL8191SU/RTL8192SU family of fullmac usb wireless cards. The r8712u staging driver only supports WEXT but works with no problems in OpenWRT. V2: added md5sum and fixed the patch. Signed off by: José Vázquez Fernández ppvazquez...@gmail.com Index: package/kernel/linux/modules/wireless.mk === --- package/kernel/linux/modules/wireless.mk(revisión: 43720) +++ package/kernel/linux/modules/wireless.mk(copia de trabajo) @@ -126,3 +126,35 @@ $(eval $(call KernelPackage,net-rtl8188eu)) +define KernelPackage/net-rtl8192su + SUBMENU:=$(WIRELESS_MENU) + TITLE:=RTL8192SU support (staging) + DEPENDS:=@USB_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-usb-core + KCONFIG:=\ + CONFIG_STAGING=y \ + CONFIG_R8712U + FILES:=$(LINUX_DIR)/drivers/staging/rtl8712/r8712u.ko + AUTOLOAD:=$(call AutoProbe,r8712u) +endef + +define KernelPackage/net-rtl8192su/description + Kernel modules for RealTek RTL8712 and RTL81XXSU fullmac support. + +endef +# R8712 FullMAC firmware +R8712_FW:=rtl8712u.bin + +define Download/net-rtl8192su + FILE:=$(R8712_FW) + + URL:=http://mirrors.arizona.edu/raspbmc/downloads/bin/lib/wifi/rtlwifi/ + MD5SUM:=8e6396b5844a3e279ae8679555dec3f0 +endef + +define KernelPackage/net-rtl8192su/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(DL_DIR)/$(R8712_FW) $(1)/lib/firmware/rtlwifi/ +endef + +$(eval $(call Download,net-rtl8192su)) +$(eval $(call KernelPackage,net-rtl8192su)) + ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2] iproute2: add VLAN filtering + bridge control.
Made changes suggested by Felix. I'll try to put together a preliminary report on how much bloat this add to the kernel Though this might not be that needed for home use, I think it really adds to OpenWRT's usefulness as a set-and-forget network wonder-appliance. diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 8671df1..68ccc6c 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -86,7 +86,8 @@ define KernelPackage/bridge DEPENDS:=+kmod-stp KCONFIG:= \ CONFIG_BRIDGE \ - CONFIG_BRIDGE_IGMP_SNOOPING=y + CONFIG_BRIDGE_IGMP_SNOOPING=y \ + CONFIG_BRIDGE_VLAN_FILTERING=y FILES:=$(LINUX_DIR)/net/bridge/bridge.ko AUTOLOAD:=$(call AutoLoad,11,bridge) endef diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index f6d2801..95014c8 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -58,6 +58,11 @@ $(call Package/iproute2/Default) TITLE:=General netlink utility frontend endef +define Package/iproute2-bridge +$(call Package/iproute2/Default) + TITLE:=Bridge configuration utility +endef + define Package/ss $(call Package/iproute2/Default) TITLE:=Socket statistics utility @@ -130,6 +135,11 @@ define Package/genl/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/ endef +define Package/iproute2-bridge/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/ +endef + define Package/ss/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/ @@ -139,4 +149,5 @@ $(eval $(call BuildPackage,ip)) $(eval $(call BuildPackage,ip-full)) $(eval $(call BuildPackage,tc)) $(eval $(call BuildPackage,genl)) +$(eval $(call BuildPackage,iproute2-bridge)) $(eval $(call BuildPackage,ss)) diff --git a/target/linux/generic/config-3.10 b/target/linux/generic/config-3.10 index 5df8901..b4a4c80 100644 --- a/target/linux/generic/config-3.10 +++ b/target/linux/generic/config-3.10 @@ -441,7 +441,7 @@ CONFIG_BRIDGE=y CONFIG_BRIDGE_IGMP_SNOOPING=y # CONFIG_BRIDGE_NETFILTER is not set # CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_BRIDGE_VLAN_FILTERING=y # CONFIG_BROADCOM_PHY is not set CONFIG_BROKEN_ON_SMP=y # CONFIG_BSD_DISKLABEL is not set diff --git a/target/linux/generic/config-3.13 b/target/linux/generic/config-3.13 index 79261d8..ecf6ad7 100644 --- a/target/linux/generic/config-3.13 +++ b/target/linux/generic/config-3.13 @@ -474,7 +474,7 @@ CONFIG_BRIDGE=y CONFIG_BRIDGE_IGMP_SNOOPING=y # CONFIG_BRIDGE_NETFILTER is not set # CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_BRIDGE_VLAN_FILTERING=y # CONFIG_BROADCOM_PHY is not set CONFIG_BROKEN_ON_SMP=y # CONFIG_BSD_DISKLABEL is not set diff --git a/target/linux/generic/config-3.14 b/target/linux/generic/config-3.14 index 9485ea1..1510ffb 100644 --- a/target/linux/generic/config-3.14 +++ b/target/linux/generic/config-3.14 @@ -486,7 +486,7 @@ CONFIG_BRIDGE=y CONFIG_BRIDGE_IGMP_SNOOPING=y # CONFIG_BRIDGE_NETFILTER is not set # CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_BRIDGE_VLAN_FILTERING=y # CONFIG_BROADCOM_PHY is not set CONFIG_BROKEN_ON_SMP=y # CONFIG_BSD_DISKLABEL is not set diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 index e0e2a0b..20cfc06 100644 --- a/target/linux/generic/config-3.18 +++ b/target/linux/generic/config-3.18 @@ -510,7 +510,7 @@ CONFIG_BRIDGE=y CONFIG_BRIDGE_IGMP_SNOOPING=y # CONFIG_BRIDGE_NETFILTER is not set # CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_BRIDGE_VLAN_FILTERING=y # CONFIG_BROADCOM_PHY is not set CONFIG_BROKEN_ON_SMP=y # CONFIG_BSD_DISKLABEL is not set ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] rootfs_data on separated flash
On 15 December 2014 at 06:29, John Crispin blo...@openwrt.org wrote: On 14/12/2014 21:37, Rafał Miłecki wrote: 1) I've modified DT to create ubi MTD partition on NAND 2) Wrote a simple preinit_main script creating rootfs_data2 UBI volume 3) Modified fstools to prefer rootfs_data2 over rootfs_data if it exists i dont like that bit at all. its a work around for us not having come up with a real solution. i need a few more days to devise a better plan. spontaneously i would consider extroot or extroot_data an option Me too. That's why I called your idea nicer :) I was thinking about some simple solution. I think it would be enough to create extroot config (for this specific device) right after formatting JFFS2. Formatting is handled by /etc/init.d/done (START=95). So I could add script with START=96 that will preapre extroot and add fstab config entry. Does it sound sane clean enough to you? However: is there some way to tell OpenWrt to re-scan fstab other than reboot? -- Rafał ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Subject: [PATCH] [package] Check port state on new call to avoid previous call ending
Hello Roberto, thank you for your contribution. You seem to have swapped the original and modified source file while diffing it, but this is a not a big deal. I will test your change during this week and merge it if it works. Next time please create pull request against the github telephony repository located here https://github.com/openwrt/telephony Thank you, Jiri Dne 16.12.2014 v 01:35 Roberto Ruiz napsal(a): From: Roberto Ruiz robertoenla...@gmail.com mailto:robertoenla...@gmail.com When there is an Asterisk 1.8 VoIP conversation using a FXS port, and a second call is received, the first conversation turns imposible because the other person can´t hear you. The problem start when the Asterisk dialplan command Dial(TAPI/1TAPI/2,60) is executed. It calls function ast_lantiq_requester, defined on chan_lantiq.c, and this function creates a new channel without check if the port is in use. This patch modify the function to test if there is a call using the port and, if yes, a new channel won´t be created in that port. Signed-off-by: Roberto Ruiz robertoenla...@gmail.com mailto:robertoenla...@gmail.com --- --- trunk/feeds/telephony/net/asterisk-1.8.x/src-lantiq/channels/chan_lantiq.c.orig 2014-12-15 18:26:17.053726654 +0100 +++ trunk/feeds/telephony/net/asterisk-1.8.x/src-lantiq/channels/chan_lantiq.c 2014-12-15 18:31:16.529050559 +0100 @@ -758,16 +758,6 @@ static struct ast_channel * ast_lantiq_r */ port_id -= 1; -/* check if port is in use */ -struct lantiq_pvt *pvt = iflist[port_id]; -if (pvt-owner != NULL){ -ast_verbose(VERBOSE_PREFIX_3 Request to create new channel on port_id %i, but port is in use. Channel not created.\n, port_id); -ast_verbose(VERBOSE_PREFIX_3 Port state:%s.\n, state_string(pvt-channel_state)); -*cause = AST_CAUSE_USER_BUSY; -ast_mutex_unlock(iflock); -return NULL; -} - chan = lantiq_channel(AST_STATE_DOWN, port_id, NULL, NULL); ast_mutex_unlock(iflock); ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 0/5] ar8216: patch series with more smaller improvements
1/5 Remove unused function parameter in ar8327_led_register 2/5 Factor out chip-specific parameters from ar8xxx_probe_switch 3/5 Create helpers mii_read32 / mii_write32 for 32 bit MII ops. 4/5 Remove read/write/rmw member functions from ar8xxx_priv 5/5 Inline function ar8xxx_create_mii ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 1/5] ar8216: remove unused function parameter in ar8327_led_register
Remove unused function parameter in ar8327_led_register. Signed-off-by: Heiner Kallweit hkallwe...@gmail.com --- target/linux/generic/files/drivers/net/phy/ar8216.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 91e090a..fe3b366 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -1393,7 +1393,7 @@ static DEVICE_ATTR(enable_hw_mode, S_IRUGO | S_IWUSR, ar8327_led_enable_hw_mode_store); static int -ar8327_led_register(struct ar8xxx_priv *priv, struct ar8327_led *aled) +ar8327_led_register(struct ar8327_led *aled) { int ret; @@ -1467,7 +1467,7 @@ ar8327_led_create(struct ar8xxx_priv *priv, mutex_init(aled-mutex); INIT_WORK(aled-led_work, ar8327_led_work_func); - ret = ar8327_led_register(priv, aled); + ret = ar8327_led_register(aled); if (ret) goto err_free; -- 2.1.3 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 2/5] ar8216: Factor out chip-specific parameters from ar8xxx_probe_switch
Factor out chip-specific parameters from ar8xxx_probe_switch. Move the ar8xxx_chip definitions after the swops definitions. Signed-off-by: Heiner Kallweit hkallwe...@gmail.com --- .../linux/generic/files/drivers/net/phy/ar8216.c | 268 - 1 file changed, 151 insertions(+), 117 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index fe3b366..fbc5bf2 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -54,9 +54,6 @@ struct ar8xxx_priv; #define AR8XXX_NUM_PHYS5 -static void ar8216_set_mirror_regs(struct ar8xxx_priv *priv); -static void ar8327_set_mirror_regs(struct ar8xxx_priv *priv); - enum { AR8XXX_VER_AR8216 = 0x01, AR8XXX_VER_AR8236 = 0x03, @@ -83,6 +80,11 @@ struct ar8xxx_chip { int (*hw_init)(struct ar8xxx_priv *priv); void (*cleanup)(struct ar8xxx_priv *priv); + const char *name; + int vlans; + int ports; + const struct switch_dev_ops *swops; + void (*init_globals)(struct ar8xxx_priv *priv); void (*init_port)(struct ar8xxx_priv *priv, int port); void (*setup_port)(struct ar8xxx_priv *priv, int port, u32 members); @@ -881,27 +883,6 @@ ar8216_init_port(struct ar8xxx_priv *priv, int port) } } -static const struct ar8xxx_chip ar8216_chip = { - .caps = AR8XXX_CAP_MIB_COUNTERS, - - .reg_port_stats_start = 0x19000, - .reg_port_stats_length = 0xa0, - - .hw_init = ar8216_hw_init, - .init_globals = ar8216_init_globals, - .init_port = ar8216_init_port, - .setup_port = ar8216_setup_port, - .read_port_status = ar8216_read_port_status, - .atu_flush = ar8216_atu_flush, - .vtu_flush = ar8216_vtu_flush, - .vtu_load_vlan = ar8216_vtu_load_vlan, - .set_mirror_regs = ar8216_set_mirror_regs, - - .num_mibs = ARRAY_SIZE(ar8216_mibs), - .mib_decs = ar8216_mibs, - .mib_func = AR8216_REG_MIB_FUNC -}; - static void ar8236_setup_port(struct ar8xxx_priv *priv, int port, u32 members) { @@ -962,27 +943,6 @@ ar8236_init_globals(struct ar8xxx_priv *priv) AR8236_MIB_EN); } -static const struct ar8xxx_chip ar8236_chip = { - .caps = AR8XXX_CAP_MIB_COUNTERS, - - .reg_port_stats_start = 0x2, - .reg_port_stats_length = 0x100, - - .hw_init = ar8216_hw_init, - .init_globals = ar8236_init_globals, - .init_port = ar8216_init_port, - .setup_port = ar8236_setup_port, - .read_port_status = ar8216_read_port_status, - .atu_flush = ar8216_atu_flush, - .vtu_flush = ar8216_vtu_flush, - .vtu_load_vlan = ar8216_vtu_load_vlan, - .set_mirror_regs = ar8216_set_mirror_regs, - - .num_mibs = ARRAY_SIZE(ar8236_mibs), - .mib_decs = ar8236_mibs, - .mib_func = AR8216_REG_MIB_FUNC -}; - static int ar8316_hw_init(struct ar8xxx_priv *priv) { @@ -1051,27 +1011,6 @@ ar8316_init_globals(struct ar8xxx_priv *priv) AR8236_MIB_EN); } -static const struct ar8xxx_chip ar8316_chip = { - .caps = AR8XXX_CAP_GIGE | AR8XXX_CAP_MIB_COUNTERS, - - .reg_port_stats_start = 0x2, - .reg_port_stats_length = 0x100, - - .hw_init = ar8316_hw_init, - .init_globals = ar8316_init_globals, - .init_port = ar8216_init_port, - .setup_port = ar8216_setup_port, - .read_port_status = ar8216_read_port_status, - .atu_flush = ar8216_atu_flush, - .vtu_flush = ar8216_vtu_flush, - .vtu_load_vlan = ar8216_vtu_load_vlan, - .set_mirror_regs = ar8216_set_mirror_regs, - - .num_mibs = ARRAY_SIZE(ar8236_mibs), - .mib_decs = ar8236_mibs, - .mib_func = AR8216_REG_MIB_FUNC -}; - static u32 ar8327_get_pad_cfg(struct ar8327_pad_cfg *cfg) { @@ -1845,31 +1784,6 @@ ar8327_setup_port(struct ar8xxx_priv *priv, int port, u32 members) priv-write(priv, AR8327_REG_PORT_LOOKUP(port), t); } -static const struct ar8xxx_chip ar8327_chip = { - .caps = AR8XXX_CAP_GIGE | AR8XXX_CAP_MIB_COUNTERS, - .config_at_probe = true, - .mii_lo_first = true, - - .reg_port_stats_start = 0x1000, - .reg_port_stats_length = 0x100, - - .hw_init = ar8327_hw_init, - .cleanup = ar8327_cleanup, - .init_globals = ar8327_init_globals, - .init_port = ar8327_init_port, - .setup_port = ar8327_setup_port, - .read_port_status = ar8327_read_port_status, - .atu_flush = ar8327_atu_flush, - .vtu_flush = ar8327_vtu_flush, - .vtu_load_vlan = ar8327_vtu_load_vlan, - .phy_fixup = ar8327_phy_fixup, - .set_mirror_regs = ar8327_set_mirror_regs, - - .num_mibs = ARRAY_SIZE(ar8236_mibs), - .mib_decs = ar8236_mibs, - .mib_func = AR8327_REG_MIB_FUNC -}; - static int ar8xxx_sw_set_vlan(struct switch_dev *dev, const struct switch_attr *attr,
[OpenWrt-Devel] [PATCH 3/5] ar8216: Create helpers mii_read32 / mii_write32 for 32 bit MII ops
Create helpers mii_read32 / mii_write32 for 32 bit MII ops. Rename r3 variable to page in ar8xxx_mii_write to make it consistent with the other ar8xxx_mii_ functions. Signed-off-by: Heiner Kallweit hkallwe...@gmail.com --- .../linux/generic/files/drivers/net/phy/ar8216.c | 74 -- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index fbc5bf2..14627c1 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -399,11 +399,42 @@ ar8xxx_phy_init(struct ar8xxx_priv *priv) } static u32 +mii_read32(struct ar8xxx_priv *priv, int phy_id, int regnum) +{ + struct mii_bus *bus = priv-mii_bus; + u16 lo, hi; + + lo = bus-read(bus, phy_id, regnum); + hi = bus-read(bus, phy_id, regnum + 1); + + return (hi 16) | lo; +} + +static void +mii_write32(struct ar8xxx_priv *priv, int phy_id, int regnum, u32 val) +{ + struct mii_bus *bus = priv-mii_bus; + u16 lo, hi; + + lo = val 0x; + hi = (u16) (val 16); + + if (priv-chip-mii_lo_first) + { + bus-write(bus, phy_id, regnum, lo); + bus-write(bus, phy_id, regnum + 1, hi); + } else { + bus-write(bus, phy_id, regnum + 1, hi); + bus-write(bus, phy_id, regnum, lo); + } +} + +static u32 ar8xxx_mii_read(struct ar8xxx_priv *priv, int reg) { struct mii_bus *bus = priv-mii_bus; u16 r1, r2, page; - u16 lo, hi; + u32 val; split_addr((u32) reg, r1, r2, page); @@ -411,36 +442,26 @@ ar8xxx_mii_read(struct ar8xxx_priv *priv, int reg) bus-write(bus, 0x18, 0, page); usleep_range(1000, 2000); /* wait for the page switch to propagate */ - lo = bus-read(bus, 0x10 | r2, r1); - hi = bus-read(bus, 0x10 | r2, r1 + 1); + val = mii_read32(priv, 0x10 | r2, r1); mutex_unlock(bus-mdio_lock); - return (hi 16) | lo; + return val; } static void ar8xxx_mii_write(struct ar8xxx_priv *priv, int reg, u32 val) { struct mii_bus *bus = priv-mii_bus; - u16 r1, r2, r3; - u16 lo, hi; + u16 r1, r2, page; - split_addr((u32) reg, r1, r2, r3); - lo = val 0x; - hi = (u16) (val 16); + split_addr((u32) reg, r1, r2, page); mutex_lock(bus-mdio_lock); - bus-write(bus, 0x18, 0, r3); + bus-write(bus, 0x18, 0, page); usleep_range(1000, 2000); /* wait for the page switch to propagate */ - if (priv-chip-mii_lo_first) { - bus-write(bus, 0x10 | r2, r1, lo); - bus-write(bus, 0x10 | r2, r1 + 1, hi); - } else { - bus-write(bus, 0x10 | r2, r1 + 1, hi); - bus-write(bus, 0x10 | r2, r1, lo); - } + mii_write32(priv, 0x10 | r2, r1, val); mutex_unlock(bus-mdio_lock); } @@ -450,7 +471,6 @@ ar8xxx_mii_rmw(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val) { struct mii_bus *bus = priv-mii_bus; u16 r1, r2, page; - u16 lo, hi; u32 ret; split_addr((u32) reg, r1, r2, page); @@ -460,30 +480,16 @@ ar8xxx_mii_rmw(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val) bus-write(bus, 0x18, 0, page); usleep_range(1000, 2000); /* wait for the page switch to propagate */ - lo = bus-read(bus, 0x10 | r2, r1); - hi = bus-read(bus, 0x10 | r2, r1 + 1); - - ret = hi 16 | lo; + ret = mii_read32(priv, 0x10 | r2, r1); ret = ~mask; ret |= val; - - lo = ret 0x; - hi = (u16) (ret 16); - - if (priv-chip-mii_lo_first) { - bus-write(bus, 0x10 | r2, r1, lo); - bus-write(bus, 0x10 | r2, r1 + 1, hi); - } else { - bus-write(bus, 0x10 | r2, r1 + 1, hi); - bus-write(bus, 0x10 | r2, r1, lo); - } + mii_write32(priv, 0x10 | r2, r1, ret); mutex_unlock(bus-mdio_lock); return ret; } - static void ar8xxx_phy_dbg_write(struct ar8xxx_priv *priv, int phy_addr, u16 dbg_addr, u16 dbg_data) -- 2.1.3 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 4/5] ar8216: Remove read/write/rmw member functions from ar8xxx_priv
Remove read/write/rmw member functions from ar8xxx_priv There seems to be no real benefit of the ar8xxx_priv member functions read/write/rmw as one implementation exists for each of them only. Especially ar8xxx_mii_rmw is assigned to priv-rmw first and then mapped to ar8xxx_rmw. Rename the ar8xxx_mii_.. functions to ar8xxx_.. and use them directly. Signed-off-by: Heiner Kallweit hkallwe...@gmail.com --- .../linux/generic/files/drivers/net/phy/ar8216.c | 116 + 1 file changed, 51 insertions(+), 65 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 14627c1..b72eca0 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -141,10 +141,6 @@ struct ar8xxx_priv { struct mii_bus *mii_bus; struct phy_device *phy; - u32 (*read)(struct ar8xxx_priv *priv, int reg); - void (*write)(struct ar8xxx_priv *priv, int reg, u32 val); - u32 (*rmw)(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val); - int (*get_port_link)(unsigned port); const struct net_device_ops *ndo_old; @@ -430,7 +426,7 @@ mii_write32(struct ar8xxx_priv *priv, int phy_id, int regnum, u32 val) } static u32 -ar8xxx_mii_read(struct ar8xxx_priv *priv, int reg) +ar8xxx_read(struct ar8xxx_priv *priv, int reg) { struct mii_bus *bus = priv-mii_bus; u16 r1, r2, page; @@ -450,7 +446,7 @@ ar8xxx_mii_read(struct ar8xxx_priv *priv, int reg) } static void -ar8xxx_mii_write(struct ar8xxx_priv *priv, int reg, u32 val) +ar8xxx_write(struct ar8xxx_priv *priv, int reg, u32 val) { struct mii_bus *bus = priv-mii_bus; u16 r1, r2, page; @@ -467,7 +463,7 @@ ar8xxx_mii_write(struct ar8xxx_priv *priv, int reg, u32 val) } static u32 -ar8xxx_mii_rmw(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val) +ar8xxx_rmw(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val) { struct mii_bus *bus = priv-mii_bus; u16 r1, r2, page; @@ -513,16 +509,10 @@ ar8xxx_phy_mmd_write(struct ar8xxx_priv *priv, int phy_addr, u16 addr, u16 data) mutex_unlock(bus-mdio_lock); } -static inline u32 -ar8xxx_rmw(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val) -{ - return priv-rmw(priv, reg, mask, val); -} - static inline void ar8xxx_reg_set(struct ar8xxx_priv *priv, int reg, u32 val) { - priv-rmw(priv, reg, 0, val); + ar8xxx_rmw(priv, reg, 0, val); } static int @@ -534,7 +524,7 @@ ar8xxx_reg_wait(struct ar8xxx_priv *priv, u32 reg, u32 mask, u32 val, for (i = 0; i timeout; i++) { u32 t; - t = priv-read(priv, reg); + t = ar8xxx_read(priv, reg); if ((t mask) == val) return 0; @@ -598,11 +588,11 @@ ar8xxx_mib_fetch_port_stat(struct ar8xxx_priv *priv, int port, bool flush) u64 t; mib = priv-chip-mib_decs[i]; - t = priv-read(priv, base + mib-offset); + t = ar8xxx_read(priv, base + mib-offset); if (mib-size == 2) { u64 hi; - hi = priv-read(priv, base + mib-offset + 4); + hi = ar8xxx_read(priv, base + mib-offset + 4); t |= hi 32; } @@ -738,7 +728,7 @@ ar8216_wait_bit(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val) u32 t = 0; while (1) { - t = priv-read(priv, reg); + t = ar8xxx_read(priv, reg); if ((t mask) == val) return 0; @@ -761,10 +751,10 @@ ar8216_vtu_op(struct ar8xxx_priv *priv, u32 op, u32 val) if ((op AR8216_VTU_OP) == AR8216_VTU_OP_LOAD) { val = AR8216_VTUDATA_MEMBER; val |= AR8216_VTUDATA_VALID; - priv-write(priv, AR8216_REG_VTU_DATA, val); + ar8xxx_write(priv, AR8216_REG_VTU_DATA, val); } op |= AR8216_VTU_ACTIVE; - priv-write(priv, AR8216_REG_VTU, op); + ar8xxx_write(priv, AR8216_REG_VTU, op); } static void @@ -789,7 +779,7 @@ ar8216_atu_flush(struct ar8xxx_priv *priv) ret = ar8216_wait_bit(priv, AR8216_REG_ATU, AR8216_ATU_ACTIVE, 0); if (!ret) - priv-write(priv, AR8216_REG_ATU, AR8216_ATU_OP_FLUSH); + ar8xxx_write(priv, AR8216_REG_ATU, AR8216_ATU_OP_FLUSH); return ret; } @@ -797,7 +787,7 @@ ar8216_atu_flush(struct ar8xxx_priv *priv) static u32 ar8216_read_port_status(struct ar8xxx_priv *priv, int port) { - return priv-read(priv, AR8216_REG_PORT_STATUS(port)); + return ar8xxx_read(priv, AR8216_REG_PORT_STATUS(port)); } static void @@ -857,7 +847,7 @@ static void ar8216_init_globals(struct ar8xxx_priv *priv) { /* standard atheros magic */ - priv-write(priv, 0x38, 0xc50e); +
[OpenWrt-Devel] [PATCH 5/5] ar8216: Inline function ar8xxx_create_mii
Inline function ar8xxx_create_mii. Signed-off-by: Heiner Kallweit hkallwe...@gmail.com --- target/linux/generic/files/drivers/net/phy/ar8216.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index b72eca0..0dc55e8 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -2775,18 +2775,6 @@ ar8xxx_free(struct ar8xxx_priv *priv) kfree(priv); } -static struct ar8xxx_priv * -ar8xxx_create_mii(struct mii_bus *bus) -{ - struct ar8xxx_priv *priv; - - priv = ar8xxx_create(); - if (priv) - priv-mii_bus = bus; - - return priv; -} - static int ar8xxx_probe_switch(struct ar8xxx_priv *priv) { @@ -2990,12 +2978,14 @@ ar8xxx_phy_probe(struct phy_device *phydev) if (priv-mii_bus == phydev-bus) goto found; - priv = ar8xxx_create_mii(phydev-bus); + priv = ar8xxx_create(); if (priv == NULL) { ret = -ENOMEM; goto unlock; } + priv-mii_bus = phydev-bus; + ret = ar8xxx_probe_switch(priv); if (ret) goto free_priv; -- 2.1.3 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel