From 6fb08dd83576394943a378960b8093ac2e70293c Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Sat, 13 Jul 2019 22:14:19 +0200 Subject: dts/imx25: drop sram node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This node is in dts/src/arm/imx25.dtsi since 9313920df6d3 ("dts: update to v3.16-rc1"). Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- arch/arm/dts/imx25.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/arm/dts/imx25.dtsi b/arch/arm/dts/imx25.dtsi index 2e069e6f03..eb30461780 100644 --- a/arch/arm/dts/imx25.dtsi +++ b/arch/arm/dts/imx25.dtsi @@ -17,13 +17,6 @@ mmc0 = &esdhc1; mmc2 = &esdhc2; }; - - soc { - iram: sram@78000000 { - compatible = "mmio-sram"; - reg = <0x78000000 0x20000>; - }; - }; }; &usbmisc { -- cgit v1.2.3 From 7711eb0827fd2a82b4a4d35e4f47a798531ae95c Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 5 Aug 2019 11:13:15 +0200 Subject: console: return number of characters written in fops_write struct cdev_operations write() callback is supposed to return the number of characters written. Do this instead of returning 0 for the console device files. Signed-off-by: Sascha Hauer --- common/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/console.c b/common/console.c index 406722a1da..ee17a508ba 100644 --- a/common/console.c +++ b/common/console.c @@ -300,7 +300,7 @@ static ssize_t fops_write(struct cdev* dev, const void* buf, size_t count, priv->puts(priv, buf); - return 0; + return count; } int console_register(struct console_device *newcdev) -- cgit v1.2.3 From 1f5e9d331548ee02322511365a00a142bdf15f4d Mon Sep 17 00:00:00 2001 From: Jan Kundrát Date: Fri, 2 Aug 2019 16:12:59 +0200 Subject: docs: Use a proper name for AM335x defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 3067cd85d ("ARM: omap: am33xx_defconfig: Enable more boards and rename") Signed-off-by: Jan Kundrát Signed-off-by: Sascha Hauer --- Documentation/boards/am335x.rst | 2 +- Documentation/boards/am335x/phytec-som.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/boards/am335x.rst b/Documentation/boards/am335x.rst index 8d726e4a10..f54611428b 100644 --- a/Documentation/boards/am335x.rst +++ b/Documentation/boards/am335x.rst @@ -9,7 +9,7 @@ Building barebox ---------------- The TI AM335x boards in barebox are covered by the ``am335x_mlo_defconfig`` -for the MLO and ``am335x_defconfig`` for the regular barebox image. The +for the MLO and ``omap_defconfig`` for the regular barebox image. The resulting images will be placed under ``images/``: :: diff --git a/Documentation/boards/am335x/phytec-som.rst b/Documentation/boards/am335x/phytec-som.rst index 519448cddd..4c763650e5 100644 --- a/Documentation/boards/am335x/phytec-som.rst +++ b/Documentation/boards/am335x/phytec-som.rst @@ -32,4 +32,4 @@ Building phycore-som-am335x --------------------------- The phycore-som-am335x boards are covered by the ``am335x_mlo_defconfig`` -for the MLO and ``am335x_defconfig`` for the regular barebox image. +for the MLO and ``omap_defconfig`` for the regular barebox image. -- cgit v1.2.3 From 21e5652f989d2df9a1722698b2d5f9257c6c4c3b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 8 Aug 2019 01:06:48 +0900 Subject: kconfig: update to Linux 5.3-rc3 Recently, Linux merged some important fixes. Commit 8e2442a5f86e ("kconfig: fix missing choice values in auto.conf") Commit 0c5b6c28ed68 ("kconfig: Clear "written" flag to avoid data loss") Barebox must import them. Signed-off-by: Masahiro Yamada Signed-off-by: Sascha Hauer --- scripts/kconfig/Makefile | 10 +++--- scripts/kconfig/conf.c | 10 +++--- scripts/kconfig/confdata.c | 36 ++++++---------------- scripts/kconfig/expr.h | 1 + scripts/kconfig/lkc.h | 1 - scripts/kconfig/lkc_proto.h | 3 +- scripts/kconfig/mconf.c | 10 +++--- scripts/kconfig/nconf.c | 10 +++--- scripts/kconfig/preprocess.c | 3 +- scripts/kconfig/qconf.cc | 2 +- scripts/kconfig/symbol.c | 4 +-- .../tests/err_recursive_dep/expected_stderr | 14 ++++----- 12 files changed, 44 insertions(+), 60 deletions(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 3f327e21f6..7656e1137b 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -12,6 +12,10 @@ else Kconfig := Kconfig endif +ifndef KBUILD_DEFCONFIG +KBUILD_DEFCONFIG := defconfig +endif + ifeq ($(quiet),silent_) silent := -s endif @@ -74,9 +78,7 @@ savedefconfig: $(obj)/conf $< $(silent) --$@=defconfig $(Kconfig) defconfig: $(obj)/conf -ifeq ($(KBUILD_DEFCONFIG),) - $< $(silent) --defconfig $(Kconfig) -else ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),) +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),) @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) else @@ -92,7 +94,7 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c %.config: $(obj)/conf $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles) - +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig + $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig PHONY += kvmconfig kvmconfig: kvm_guest.config diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index ef3678c24b..40e16e871a 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -90,7 +90,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) line[0] = '\n'; line[1] = 0; - if (!sym_is_changable(sym)) { + if (!sym_is_changeable(sym)) { printf("%s\n", def); line[0] = '\n'; line[1] = 0; @@ -234,7 +234,7 @@ static int conf_choice(struct menu *menu) sym = menu->sym; is_new = !sym_has_value(sym); - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { conf_sym(menu); sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { @@ -418,7 +418,7 @@ static void check_conf(struct menu *menu) sym = menu->sym; if (sym && !sym_has_value(sym)) { - if (sym_is_changable(sym) || + if (sym_is_changeable(sym) || (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { if (input_mode == listnewconfig) { if (sym->name) { @@ -451,7 +451,7 @@ static struct option long_opts[] = { {"oldaskconfig", no_argument, NULL, oldaskconfig}, {"oldconfig", no_argument, NULL, oldconfig}, {"syncconfig", no_argument, NULL, syncconfig}, - {"defconfig", optional_argument, NULL, defconfig}, + {"defconfig", required_argument, NULL, defconfig}, {"savedefconfig", required_argument, NULL, savedefconfig}, {"allnoconfig", no_argument, NULL, allnoconfig}, {"allyesconfig", no_argument, NULL, allyesconfig}, @@ -562,8 +562,6 @@ int main(int ac, char **av) switch (input_mode) { case defconfig: - if (!defconfig_file) - defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { fprintf(stderr, "***\n" diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 6006154d36..3569d2dec3 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -177,8 +177,6 @@ static void conf_message(const char *fmt, ...) static const char *conf_filename; static int conf_lineno, conf_warnings; -const char conf_defname[] = "arch/$(ARCH)/defconfig"; - static void conf_warning(const char *fmt, ...) { va_list ap; @@ -233,21 +231,6 @@ static const char *conf_get_autoconfig_name(void) return name ? name : "include/config/auto.conf"; } -char *conf_get_default_confname(void) -{ - static char fullname[PATH_MAX+1]; - char *env, *name; - - name = expand_string(conf_defname); - env = getenv(SRCTREE); - if (env) { - snprintf(fullname, sizeof(fullname), "%s/%s", env, name); - if (is_present(fullname)) - return fullname; - } - return name; -} - static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) { char *p2; @@ -551,11 +534,9 @@ int conf_read(const char *name) switch (sym->type) { case S_BOOLEAN: case S_TRISTATE: - if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) - break; - if (!sym_is_choice(sym)) + if (sym->def[S_DEF_USER].tri == sym_get_tristate_value(sym)) continue; - /* fall through */ + break; default: if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) continue; @@ -813,7 +794,7 @@ int conf_write_defconfig(const char *filename) goto next_menu; sym->flags &= ~SYMBOL_WRITE; /* If we cannot change the symbol - skip */ - if (!sym_is_changable(sym)) + if (!sym_is_changeable(sym)) goto next_menu; /* If symbol equals to default value - skip */ if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0) @@ -867,6 +848,7 @@ int conf_write(const char *name) const char *str; char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1]; char *env; + int i; bool need_newline = false; if (!name) @@ -914,7 +896,8 @@ int conf_write(const char *name) "# %s\n" "#\n", str); need_newline = false; - } else if (!(sym->flags & SYMBOL_CHOICE)) { + } else if (!(sym->flags & SYMBOL_CHOICE) && + !(sym->flags & SYMBOL_WRITTEN)) { sym_calc_value(sym); if (!(sym->flags & SYMBOL_WRITE)) goto next; @@ -922,7 +905,7 @@ int conf_write(const char *name) fprintf(out, "\n"); need_newline = false; } - sym->flags &= ~SYMBOL_WRITE; + sym->flags |= SYMBOL_WRITTEN; conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); } @@ -948,6 +931,9 @@ next: } fclose(out); + for_all_symbols(i, sym) + sym->flags &= ~SYMBOL_WRITTEN; + if (*tmpname) { if (is_same(name, tmpname)) { conf_message("No change to %s", name); @@ -1082,8 +1068,6 @@ int conf_write_autoconf(int overwrite) if (!overwrite && is_present(autoconf_name)) return 0; - sym_clear_all_valid(); - conf_write_dep("include/config/auto.conf.cmd"); if (conf_touch_deps()) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 8dde65bc31..017843c9a4 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -141,6 +141,7 @@ struct symbol { #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ #define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */ #define SYMBOL_CHANGED 0x0400 /* ? */ +#define SYMBOL_WRITTEN 0x0800 /* track info to avoid double-write to .config */ #define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */ #define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ #define SYMBOL_WARNED 0x8000 /* warning has been issued */ diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index cbc7658ee2..4fb16f3166 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -49,7 +49,6 @@ const char *zconf_curname(void); /* confdata.c */ const char *conf_get_configname(void); -char *conf_get_default_confname(void); void sym_set_change_count(int count); void sym_add_change_count(int count); bool conf_set_all_new_symbols(enum conf_def_mode mode); diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 86c267540c..f9ab98238a 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -42,7 +42,7 @@ tristate sym_toggle_tristate_value(struct symbol *sym); bool sym_string_valid(struct symbol *sym, const char *newval); bool sym_string_within_range(struct symbol *sym, const char *str); bool sym_set_string_value(struct symbol *sym, const char *newval); -bool sym_is_changable(struct symbol *sym); +bool sym_is_changeable(struct symbol *sym); struct property * sym_get_choice_prop(struct symbol *sym); const char * sym_get_string_value(struct symbol *sym); @@ -58,7 +58,6 @@ void env_write_dep(FILE *f, const char *auto_conf_name); void variable_add(const char *name, const char *value, enum variable_flavor flavor); void variable_all_del(void); -char *expand_string(const char *in); char *expand_dollar(const char **str); char *expand_one_token(const char **str); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 694091f3ef..49c26ea9dd 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -536,7 +536,7 @@ static void build_conf(struct menu *menu) } val = sym_get_tristate_value(sym); - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { switch (type) { case S_BOOLEAN: item_make("[%c]", val == no ? ' ' : '*'); @@ -587,7 +587,7 @@ static void build_conf(struct menu *menu) } else { switch (type) { case S_BOOLEAN: - if (sym_is_changable(sym)) + if (sym_is_changeable(sym)) item_make("[%c]", val == no ? ' ' : '*'); else item_make("-%c-", val == no ? ' ' : '*'); @@ -600,7 +600,7 @@ static void build_conf(struct menu *menu) case mod: ch = 'M'; break; default: ch = ' '; break; } - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { if (sym->rev_dep.tri == mod) item_make("{%c}", ch); else @@ -617,7 +617,7 @@ static void build_conf(struct menu *menu) if (tmp < 0) tmp = 0; item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), - (sym_has_value(sym) || !sym_is_changable(sym)) ? + (sym_has_value(sym) || !sym_is_changeable(sym)) ? "" : " (NEW)"); item_set_tag('s'); item_set_data(menu); @@ -625,7 +625,7 @@ static void build_conf(struct menu *menu) } } item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), - (sym_has_value(sym) || !sym_is_changable(sym)) ? + (sym_has_value(sym) || !sym_is_changeable(sym)) ? "" : " (NEW)"); if (menu->prompt->type == P_MENU) { item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index cbafe3bf08..b7c1ef7571 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -803,7 +803,7 @@ static void build_conf(struct menu *menu) } val = sym_get_tristate_value(sym); - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { switch (type) { case S_BOOLEAN: item_make(menu, 't', "[%c]", @@ -857,7 +857,7 @@ static void build_conf(struct menu *menu) } else { switch (type) { case S_BOOLEAN: - if (sym_is_changable(sym)) + if (sym_is_changeable(sym)) item_make(menu, 't', "[%c]", val == no ? ' ' : '*'); else @@ -876,7 +876,7 @@ static void build_conf(struct menu *menu) ch = ' '; break; } - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { if (sym->rev_dep.tri == mod) item_make(menu, 't', "{%c}", ch); @@ -896,14 +896,14 @@ static void build_conf(struct menu *menu) item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), (sym_has_value(sym) || - !sym_is_changable(sym)) ? "" : + !sym_is_changeable(sym)) ? "" : " (NEW)"); goto conf_childs; } } item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), - (sym_has_value(sym) || !sym_is_changable(sym)) ? + (sym_has_value(sym) || !sym_is_changeable(sym)) ? "" : " (NEW)"); if (menu->prompt && menu->prompt->type == P_MENU) { item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c index 592dfbfa9f..0243086fb1 100644 --- a/scripts/kconfig/preprocess.c +++ b/scripts/kconfig/preprocess.c @@ -15,6 +15,7 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) static char *expand_string_with_args(const char *in, int argc, char *argv[]); +static char *expand_string(const char *in); static void __attribute__((noreturn)) pperror(const char *format, ...) { @@ -550,7 +551,7 @@ static char *expand_string_with_args(const char *in, int argc, char *argv[]) return __expand_string(&in, is_end_of_str, argc, argv); } -char *expand_string(const char *in) +static char *expand_string(const char *in) { return expand_string_with_args(in, 0, NULL); } diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index ce7fc87a49..82773cc35d 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -152,7 +152,7 @@ void ConfigItem::updateMenu(void) case S_TRISTATE: char ch; - if (!sym_is_changable(sym) && list->optMode == normalOpt) { + if (!sym_is_changeable(sym) && list->optMode == normalOpt) { setPixmap(promptColIdx, QIcon()); setText(noColIdx, QString::null); setText(modColIdx, QString::null); diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 1f9266dade..f56eec5ea4 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -785,7 +785,7 @@ const char *sym_get_string_value(struct symbol *sym) return (const char *)sym->curr.val; } -bool sym_is_changable(struct symbol *sym) +bool sym_is_changeable(struct symbol *sym) { return sym->visible > sym->rev_dep.tri; } @@ -1114,7 +1114,7 @@ static void sym_check_print_recursive(struct symbol *last_sym) } fprintf(stderr, - "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n" + "For a resolution refer to Documentation/kbuild/kconfig-language.rst\n" "subsection \"Kconfig recursive dependency limitations\"\n" "\n"); diff --git a/scripts/kconfig/tests/err_recursive_dep/expected_stderr b/scripts/kconfig/tests/err_recursive_dep/expected_stderr index 84679b1046..c9f4abf9a7 100644 --- a/scripts/kconfig/tests/err_recursive_dep/expected_stderr +++ b/scripts/kconfig/tests/err_recursive_dep/expected_stderr @@ -1,38 +1,38 @@ Kconfig:11:error: recursive dependency detected! Kconfig:11: symbol B is selected by B -For a resolution refer to Documentation/kbuild/kconfig-language.txt +For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Kconfig:5:error: recursive dependency detected! Kconfig:5: symbol A depends on A -For a resolution refer to Documentation/kbuild/kconfig-language.txt +For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Kconfig:17:error: recursive dependency detected! Kconfig:17: symbol C1 depends on C2 Kconfig:21: symbol C2 depends on C1 -For a resolution refer to Documentation/kbuild/kconfig-language.txt +For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Kconfig:32:error: recursive dependency detected! Kconfig:32: symbol D2 is selected by D1 Kconfig:27: symbol D1 depends on D2 -For a resolution refer to Documentation/kbuild/kconfig-language.txt +For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Kconfig:37:error: recursive dependency detected! Kconfig:37: symbol E1 depends on E2 Kconfig:42: symbol E2 is implied by E1 -For a resolution refer to Documentation/kbuild/kconfig-language.txt +For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Kconfig:60:error: recursive dependency detected! Kconfig:60: symbol G depends on G -For a resolution refer to Documentation/kbuild/kconfig-language.txt +For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Kconfig:51:error: recursive dependency detected! Kconfig:51: symbol F2 depends on F1 Kconfig:49: symbol F1 default value contains F2 -For a resolution refer to Documentation/kbuild/kconfig-language.txt +For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" -- cgit v1.2.3 From 384ff14253cc9c6be35deb18bca750d35101258e Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 8 Aug 2019 01:30:45 +0900 Subject: riscv: use generic bitsperlong.h Linux highly depends on the fact that the 'long' and the pointer have the same width, and so does barebox. So, we can always use include/asm-generic/bitsperlong.h, which determines BITS_PER_LONG depending on CONFIG_64BIT. This is what Linux does (at least in the kernel-space), and barebox can follow it. Currently, barebox only supports 32-bit riscv, but this should work when it supports 64-bit by adding CONFIG_64BIT to arch/riscv/Kconfig. Signed-off-by: Masahiro Yamada Signed-off-by: Sascha Hauer --- arch/riscv/include/asm/bitsperlong.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/arch/riscv/include/asm/bitsperlong.h b/arch/riscv/include/asm/bitsperlong.h index 4641e7e485..6dc0bb0c13 100644 --- a/arch/riscv/include/asm/bitsperlong.h +++ b/arch/riscv/include/asm/bitsperlong.h @@ -1,10 +1 @@ -#ifndef __ASM_BITSPERLONG_H -#define __ASM_BITSPERLONG_H - -#ifdef __riscv64 -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif - -#endif /* __ASM_BITSPERLONG_H */ +#include -- cgit v1.2.3 From 4bbc3bb207354d819c940298133a950d7f02ea46 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 8 Aug 2019 01:30:46 +0900 Subject: mips: use generic bitsperlong.h Linux highly depends on the fact that the 'long' and the pointer have the same width, and so does barebox. So, we can always use include/asm-generic/bitsperlong.h, which determines BITS_PER_LONG depending on CONFIG_64BIT. This is what Linux does (at least in the kernel-space), and barebox can follow it. It is true that MIPS Linux references _MIPS_SZLONG (arch/mips/include/uaspi/asm/bitsperlong.h), but this is bacause the user-space cannot reference CONFIG options. For the kernel-space, it uses the generic definition from include/asm-generic/bitsperlong.h. Signed-off-by: Masahiro Yamada Signed-off-by: Sascha Hauer --- arch/mips/include/asm/bitsperlong.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/mips/include/asm/bitsperlong.h b/arch/mips/include/asm/bitsperlong.h index 41712161bc..6dc0bb0c13 100644 --- a/arch/mips/include/asm/bitsperlong.h +++ b/arch/mips/include/asm/bitsperlong.h @@ -1,6 +1 @@ -#ifndef __ASM_MIPS_BITSPERLONG_H -#define __ASM_MIPS_BITSPERLONG_H - -#define BITS_PER_LONG _MIPS_SZLONG - -#endif /* __ASM_MIPS_BITSPERLONG_H */ +#include -- cgit v1.2.3 From ddba08c1d702f1933f9de4ed61467140af849912 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 8 Aug 2019 01:48:08 +0900 Subject: kbuild: use -fmacro-prefix-map to make __FILE__ a relative path Linux commit a73619a845d5625079cc1b3b820f44c899618388 The __FILE__ macro is used everywhere in the kernel to locate the file printing the log message, such as WARN_ON(), etc. If the kernel is built out of tree, this can be a long absolute path, like this: WARNING: CPU: 1 PID: 1 at /path/to/build/directory/arch/arm64/kernel/foo.c:... This is because Kbuild runs in the objtree instead of the srctree, then __FILE__ is expanded to a file path prefixed with $(srctree)/. Commit 9da0763bdd82 ("kbuild: Use relative path when building in a subdir of the source tree") improved this to some extent; $(srctree) becomes ".." if the objtree is a child of the srctree. For other cases of out-of-tree build, __FILE__ is still the absolute path. It also means the kernel image depends on where it was built. A brand-new option from GCC, -fmacro-prefix-map, solves this problem. If your compiler supports it, __FILE__ is the relative path from the srctree regardless of O= option. This provides more readable log and more reproducible builds. Please note __FILE__ is always an absolute path for external modules. Signed-off-by: Masahiro Yamada Signed-off-by: Sascha Hauer --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 08ca8e2dac..e817771b25 100644 --- a/Makefile +++ b/Makefile @@ -486,6 +486,9 @@ CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) # disable pointer signed / unsigned warnings in gcc 4.0 CFLAGS += $(call cc-option,-Wno-pointer-sign,) +# change __FILE__ to the relative path from the srctree +CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) + # KBUILD_IMAGE: Default barebox image to build # Depending on the architecture, this can be either compressed or not. # It will also include any necessary headers to be bootable. -- cgit v1.2.3 From ba36f09afcd51542712ebe62f3dea408a58eaf67 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 12 Aug 2019 13:19:11 -0700 Subject: nvmem: Use helper variable in nvmem_register_cdev() Add struct cdev * helper variable to nvmem_register_cdev() in order to avoid repeating &nvmem->cdev a bunch of times Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/nvmem/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6cf98f62af..092e3b4f4a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -90,16 +90,17 @@ static struct cdev_operations nvmem_chrdev_ops = { static int nvmem_register_cdev(struct nvmem_device *nvmem, const char *name) { struct device_d *dev = &nvmem->dev; + struct cdev *cdev = &nvmem->cdev; const char *alias; alias = of_alias_get(dev->device_node); - nvmem->cdev.name = xstrdup(alias ?: name); - nvmem->cdev.ops = &nvmem_chrdev_ops; - nvmem->cdev.dev = &nvmem->dev; - nvmem->cdev.size = nvmem->size; + cdev->name = xstrdup(alias ?: name); + cdev->ops = &nvmem_chrdev_ops; + cdev->dev = &nvmem->dev; + cdev->size = nvmem->size; - return devfs_create(&nvmem->cdev); + return devfs_create(cdev); } static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np) -- cgit v1.2.3 From f3a5f5cdf7d9bfe98e4d97d9f73ac986bb21cd6a Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 12 Aug 2019 13:19:12 -0700 Subject: nvmem: Use already existing dev pointer in nvmem_register_cdev() There's already a struct device_d * pointer variable. Use it. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/nvmem/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 092e3b4f4a..122aac5990 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -97,7 +97,7 @@ static int nvmem_register_cdev(struct nvmem_device *nvmem, const char *name) cdev->name = xstrdup(alias ?: name); cdev->ops = &nvmem_chrdev_ops; - cdev->dev = &nvmem->dev; + cdev->dev = dev; cdev->size = nvmem->size; return devfs_create(cdev); -- cgit v1.2.3 From e015a29fc9804afc0ce7baae4654dc1eee0c63a2 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 12 Aug 2019 13:19:13 -0700 Subject: nvmem: Parse partitions information Add code to parse partition information that might be specified as a part of the DT config. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/nvmem/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 122aac5990..25924872ef 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -92,6 +92,7 @@ static int nvmem_register_cdev(struct nvmem_device *nvmem, const char *name) struct device_d *dev = &nvmem->dev; struct cdev *cdev = &nvmem->cdev; const char *alias; + int ret; alias = of_alias_get(dev->device_node); @@ -100,7 +101,14 @@ static int nvmem_register_cdev(struct nvmem_device *nvmem, const char *name) cdev->dev = dev; cdev->size = nvmem->size; - return devfs_create(cdev); + ret = devfs_create(cdev); + if (ret) + return ret; + + of_parse_partitions(cdev, dev->device_node); + of_partitions_register_fixup(cdev); + + return 0; } static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np) -- cgit v1.2.3 From 9f56e43083195ad565dc1b81f3412b0f02dda988 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 12 Aug 2019 13:19:14 -0700 Subject: eeprom: at24: Drop at24_cdev_protect() Instead of exposing a dedictaed .protect() callback, mimic the behaviour of corresponding driver in Linux and adjust the value of WP pin in .write() callback as necessary. This is done in order to convert this driver to NVMEM subsytem. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/eeprom/at24.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c index 1fd4aeaba6..db452c1076 100644 --- a/drivers/eeprom/at24.c +++ b/drivers/eeprom/at24.c @@ -317,6 +317,19 @@ static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, return -ETIMEDOUT; } +static void at24_protect(struct at24_data *at24, bool prot) +{ + if (gpio_is_valid(at24->wp_gpio)) { + + if (at24->wp_active_low) + prot = !prot; + + gpio_set_value(at24->wp_gpio, prot); + + udelay(50); + } +} + static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, size_t count) { @@ -325,6 +338,8 @@ static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, if (unlikely(!count)) return count; + at24_protect(at24, false); + while (count) { ssize_t status; @@ -340,6 +355,8 @@ static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, retval += status; } + at24_protect(at24, true); + return retval; } @@ -351,25 +368,6 @@ static ssize_t at24_cdev_write(struct cdev *cdev, const void *buf, size_t count, return at24_write(at24, buf, off, count); } -static int at24_cdev_protect(struct cdev *cdev, size_t count, loff_t offset, - int prot) -{ - struct at24_data *at24 = cdev->priv; - - if (!gpio_is_valid(at24->wp_gpio)) - return -EOPNOTSUPP; - - prot = !!prot; - if (at24->wp_active_low) - prot = !prot; - - gpio_set_value(at24->wp_gpio, prot); - - udelay(50); - - return 0; -} - static int at24_probe(struct device_d *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -448,7 +446,6 @@ static int at24_probe(struct device_d *dev) at24->cdev.dev = dev; at24->cdev.ops = &at24->fops; at24->fops.read = at24_cdev_read, - at24->fops.protect = at24_cdev_protect, at24->cdev.size = chip.byte_len; writable = !(chip.flags & AT24_FLAG_READONLY); -- cgit v1.2.3 From 5bbe0ed00f25fa31dfcf2e405300e96210b1d9f1 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 12 Aug 2019 13:19:15 -0700 Subject: eeprom: at24: Convert the driver to NVMEM Convert AT24 driver to use NVMEM subsystem instead of explicitly creating a dedicated cdev. This way it becomes possible to access the contenst of EEPROM via NVMEM API, which could be usefull for things like MAC-addresses and such. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/eeprom/at24.c | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c index db452c1076..568aa02a4c 100644 --- a/drivers/eeprom/at24.c +++ b/drivers/eeprom/at24.c @@ -23,6 +23,8 @@ #include #include +#include + /* * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. * Differences between different vendor product lines (like Atmel AT24C or @@ -50,8 +52,8 @@ struct at24_data { struct at24_platform_data chip; - struct cdev cdev; - struct cdev_operations fops; + struct nvmem_config nvmem_config; + struct nvmem_device *nvmem; u8 *writebuf; unsigned write_max; @@ -242,10 +244,10 @@ static ssize_t at24_read(struct at24_data *at24, return retval; } -static ssize_t at24_cdev_read(struct cdev *cdev, void *buf, size_t count, - loff_t off, ulong flags) +static int at24_nvmem_read(struct device_d *dev, int off, + void *buf, int count) { - struct at24_data *at24 = cdev->priv; + struct at24_data *at24 = dev->parent->priv; return at24_read(at24, buf, off, count); } @@ -360,14 +362,19 @@ static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, return retval; } -static ssize_t at24_cdev_write(struct cdev *cdev, const void *buf, size_t count, - loff_t off, ulong flags) +static int at24_nvmem_write(struct device_d *dev, const int off, + const void *buf, int count) { - struct at24_data *at24 = cdev->priv; + struct at24_data *at24 = dev->parent->priv; return at24_write(at24, buf, off, count); } +static const struct nvmem_bus at24_nvmem_bus = { + .write = at24_nvmem_write, + .read = at24_nvmem_read, +}; + static int at24_probe(struct device_d *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -441,13 +448,6 @@ static int at24_probe(struct device_d *dev) devname = xasprintf("eeprom%d", err); } - at24->cdev.name = devname; - at24->cdev.priv = at24; - at24->cdev.dev = dev; - at24->cdev.ops = &at24->fops; - at24->fops.read = at24_cdev_read, - at24->cdev.size = chip.byte_len; - writable = !(chip.flags & AT24_FLAG_READONLY); if (of_get_property(dev->device_node, "read-only", NULL)) @@ -456,8 +456,6 @@ static int at24_probe(struct device_d *dev) if (writable) { unsigned write_max = chip.page_size; - at24->fops.write = at24_cdev_write; - if (write_max > io_limit) write_max = io_limit; at24->write_max = write_max; @@ -494,13 +492,21 @@ static int at24_probe(struct device_d *dev) } } - err = devfs_create(&at24->cdev); + at24->nvmem_config.name = devname; + at24->nvmem_config.dev = dev; + at24->nvmem_config.read_only = !writable; + at24->nvmem_config.bus = &at24_nvmem_bus; + at24->nvmem_config.stride = 1; + at24->nvmem_config.word_size = 1; + at24->nvmem_config.size = chip.byte_len; + + dev->priv = at24; + + at24->nvmem = nvmem_register(&at24->nvmem_config); + err = PTR_ERR_OR_ZERO(at24->nvmem); if (err) goto err_devfs_create; - of_parse_partitions(&at24->cdev, dev->device_node); - of_partitions_register_fixup(&at24->cdev); - return 0; err_devfs_create: -- cgit v1.2.3