From dc247478c67d663b6e3f5ce639e06b23b54e6aff Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 13 Mar 2017 12:05:23 +0100 Subject: poweroff: Allow to register poweroff handlers Allow to register handlers for poweroff. This allows to have multiple poweroff implementations in a single binary. The implementation is close to the restart handlers. Signed-off-by: Sascha Hauer Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- arch/arm/Kconfig | 2 - arch/arm/boards/mioa701/gpio0_poweroff.c | 3 +- arch/arm/mach-highbank/reset.c | 20 +++--- arch/arm/mach-pxa/pxa2xx.c | 15 +++- arch/arm/mach-pxa/pxa3xx.c | 13 +++- arch/mips/mach-xburst/Kconfig | 1 - arch/mips/mach-xburst/reset-jz4750.c | 13 +++- commands/Kconfig | 5 -- commands/poweroff.c | 3 +- common/Makefile | 1 + common/poweroff.c | 114 +++++++++++++++++++++++++++++++ include/common.h | 3 - include/poweroff.h | 21 ++++++ 13 files changed, 186 insertions(+), 28 deletions(-) create mode 100644 common/poweroff.c create mode 100644 include/poweroff.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4d952698fc..47b48308a6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -93,7 +93,6 @@ config ARCH_EP93XX config ARCH_HIGHBANK bool "Calxeda Highbank" select HAS_DEBUG_LL - select HAS_POWEROFF select ARCH_HAS_L2X0 select CPU_V7 select ARM_AMBA @@ -154,7 +153,6 @@ config ARCH_OMAP config ARCH_PXA bool "Intel/Marvell PXA based" select GENERIC_GPIO - select HAS_POWEROFF config ARCH_ROCKCHIP bool "Rockchip RX3xxx" diff --git a/arch/arm/boards/mioa701/gpio0_poweroff.c b/arch/arm/boards/mioa701/gpio0_poweroff.c index 2054548aa6..01a5d0cc6e 100644 --- a/arch/arm/boards/mioa701/gpio0_poweroff.c +++ b/arch/arm/boards/mioa701/gpio0_poweroff.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -45,7 +46,7 @@ static void try_poweroff(void) gpio_set_value(GPIO115_LED_nKeyboard, 0); mdelay(2000); - poweroff(); + poweroff_machine(); } static void gpio0_poller_fn(struct poller_struct *poller) diff --git a/arch/arm/mach-highbank/reset.c b/arch/arm/mach-highbank/reset.c index 929ded5951..b60f34452e 100644 --- a/arch/arm/mach-highbank/reset.c +++ b/arch/arm/mach-highbank/reset.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -20,15 +21,7 @@ static void __noreturn highbank_restart_soc(struct restart_handler *rst) hang(); } -static int restart_register_feature(void) -{ - restart_handler_register_fn(highbank_restart_soc); - - return 0; -} -coredevice_initcall(restart_register_feature); - -void __noreturn poweroff() +void __noreturn highbank_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -37,3 +30,12 @@ void __noreturn poweroff() while(1); } + +static int highbank_init(void) +{ + restart_handler_register_fn(highbank_restart_soc); + poweroff_handler_register_fn(highbank_poweroff); + + return 0; +} +coredevice_initcall(highbank_init); diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c index b712b388c8..e28378e6db 100644 --- a/arch/arm/mach-pxa/pxa2xx.c +++ b/arch/arm/mach-pxa/pxa2xx.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -46,9 +47,7 @@ void pxa_clear_reset_source(void) RCSR = RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR; } -device_initcall(pxa_detect_reset_source); - -void __noreturn poweroff(void) +static void __noreturn pxa2xx_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -57,3 +56,13 @@ void __noreturn poweroff(void) pxa_suspend(PWRMODE_DEEPSLEEP); unreachable(); } + +static int pxa2xx_init(void) +{ + poweroff_handler_register_fn(pxa2xx_poweroff); + + pxa_detect_reset_source(); + + return 0; +} +device_initcall(pxa2xx_init); diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 86ca63b160..ccfd952b5e 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -48,7 +49,7 @@ void pxa_clear_reset_source(void) device_initcall(pxa_detect_reset_source); -void __noreturn poweroff(void) +static void __noreturn pxa3xx_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -57,3 +58,13 @@ void __noreturn poweroff(void) pxa3xx_suspend(PXA3xx_PM_S3D4C4); unreachable(); } + +static int pxa3xx_init(void) +{ + poweroff_handler_register_fn(pxa3xx_poweroff); + + pxa_detect_reset_source(); + + return 0; +} +device_initcall(pxa3xx_init); diff --git a/arch/mips/mach-xburst/Kconfig b/arch/mips/mach-xburst/Kconfig index fd106fefe0..ee79ff6167 100644 --- a/arch/mips/mach-xburst/Kconfig +++ b/arch/mips/mach-xburst/Kconfig @@ -21,7 +21,6 @@ choice config BOARD_RZX50 bool "Ritmix RZX-50" - select HAS_POWEROFF select CPU_JZ4755 config BOARD_CI20 diff --git a/arch/mips/mach-xburst/reset-jz4750.c b/arch/mips/mach-xburst/reset-jz4750.c index 25830f130e..1fdcc7b8af 100644 --- a/arch/mips/mach-xburst/reset-jz4750.c +++ b/arch/mips/mach-xburst/reset-jz4750.c @@ -22,6 +22,8 @@ #include #include +#include +#include #include static void __noreturn jz4750d_halt(void) @@ -37,7 +39,7 @@ static void __noreturn jz4750d_halt(void) unreachable(); } -void __noreturn poweroff() +static void __noreturn jz4750_poweroff(struct poweroff_handler *handler) { u32 ctrl; @@ -50,4 +52,11 @@ void __noreturn poweroff() writel(RTC_HCR_PD, (u32 *)RTC_HCR); jz4750d_halt(); } -EXPORT_SYMBOL(poweroff); + +static int jz4750_init(void) +{ + poweroff_handler_register_fn(jz4750_poweroff); + + return 0; +} +coredevice_initcall(jz4750_init); diff --git a/commands/Kconfig b/commands/Kconfig index bc0885c69d..d4ccc299e9 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -6,10 +6,6 @@ config COMMAND_SUPPORT depends on !SHELL_NONE default y -config HAS_POWEROFF - bool - default n - if COMMAND_SUPPORT config COMPILE_HASH @@ -1848,7 +1844,6 @@ config CMD_NAND_BITFLIP config CMD_POWEROFF tristate - depends on HAS_POWEROFF prompt "poweroff" help Turn the power off. diff --git a/commands/poweroff.c b/commands/poweroff.c index e8c726a7f2..bbafa13bd0 100644 --- a/commands/poweroff.c +++ b/commands/poweroff.c @@ -19,10 +19,11 @@ #include #include +#include static int cmd_poweroff(int argc, char *argv[]) { - poweroff(); + poweroff_machine(); /* Not reached */ return 1; diff --git a/common/Makefile b/common/Makefile index 5f58c81d22..8cd0ab3001 100644 --- a/common/Makefile +++ b/common/Makefile @@ -9,6 +9,7 @@ obj-pbl-y += memsize.o obj-y += resource.o obj-y += bootsource.o obj-y += restart.o +obj-y += poweroff.o obj-$(CONFIG_AUTO_COMPLETE) += complete.o obj-$(CONFIG_BANNER) += version.o obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o diff --git a/common/poweroff.c b/common/poweroff.c new file mode 100644 index 0000000000..32a78280d3 --- /dev/null +++ b/common/poweroff.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2015 Sascha Hauer , Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#define pr_fmt(fmt) "poweroff: " fmt + +#include +#include +#include +#include + +static LIST_HEAD(poweroff_handler_list); + +/** + * poweroff_handler_register() - register a handler for poweroffing the system + * @rst: The handler struct + * + * This adds @rst to the list of registered poweroff handlers. + * + * return: 0 for success or negative error code + */ +int poweroff_handler_register(struct poweroff_handler *handler) +{ + if (!handler->name) + handler->name = POWEROFF_DEFAULT_NAME; + if (!handler->priority) + handler->priority = POWEROFF_DEFAULT_PRIORITY; + + list_add_tail(&handler->list, &poweroff_handler_list); + + pr_debug("registering poweroff handler \"%s\" with priority %d\n", + handler->name, handler->priority); + + return 0; +} + +/** + * poweroff_handler_register_fn() - register a handler function + * @poweroff_fn: The poweroff function + * + * convenience wrapper for poweroff_handler_register() to register a handler + * with given function and default values otherwise. + * + * return: 0 for success or negative error code + */ +int poweroff_handler_register_fn(void (*poweroff_fn)(struct poweroff_handler *)) +{ + struct poweroff_handler *handler; + int ret; + + handler = xzalloc(sizeof(*handler)); + + handler->poweroff = poweroff_fn; + + ret = poweroff_handler_register(handler); + + if (ret) + free(handler); + + return ret; +} + +/** + * poweroff_machine() - power off the machine + */ +void __noreturn poweroff_machine(void) +{ + struct poweroff_handler *handler = NULL, *tmp; + unsigned int priority = 0; + + list_for_each_entry(tmp, &poweroff_handler_list, list) { + if (tmp->priority > priority) { + priority = tmp->priority; + handler = tmp; + } + } + + if (handler) { + pr_debug("using poweroff handler %s\n", handler->name); + console_flush(); + handler->poweroff(handler); + } else { + pr_err("No poweroff handler found!\n"); + } + + hang(); +} + +/** + * of_get_poweroff_priority() - get the desired poweroff priority from device tree + * @node: The device_node to read the property from + * + * return: The priority + */ +unsigned int of_get_poweroff_priority(struct device_node *node) +{ + unsigned int priority = POWEROFF_DEFAULT_PRIORITY; + + of_property_read_u32(node, "poweroff-priority", &priority); + + return priority; +} diff --git a/include/common.h b/include/common.h index 680a0affb6..dd7445e9b6 100644 --- a/include/common.h +++ b/include/common.h @@ -66,9 +66,6 @@ int readline (const char *prompt, char *buf, int len); /* common/memsize.c */ long get_ram_size (volatile long *, long); -/* $(CPU)/cpu.c */ -void __noreturn poweroff(void); - /* common/console.c */ int ctrlc (void); diff --git a/include/poweroff.h b/include/poweroff.h new file mode 100644 index 0000000000..ae9557db5d --- /dev/null +++ b/include/poweroff.h @@ -0,0 +1,21 @@ +#ifndef __INCLUDE_POWEROFF_H +#define __INCLUDE_POWEROFF_H + +void __noreturn poweroff_machine(void); + +struct poweroff_handler { + void (*poweroff)(struct poweroff_handler *); + int priority; + const char *name; + struct list_head list; +}; + +int poweroff_handler_register(struct poweroff_handler *); +int poweroff_handler_register_fn(void (*poweroff_fn)(struct poweroff_handler *)); + +#define POWEROFF_DEFAULT_PRIORITY 100 +#define POWEROFF_DEFAULT_NAME "default" + +unsigned int of_get_poweroff_priority(struct device_node *node); + +#endif /* __INCLUDE_POWEROFF_H */ -- cgit v1.2.3 From 6b16f5961f17c9e61f719e0e6f6d34c5485d73fa Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 14 Mar 2017 08:37:35 -0700 Subject: clk: No-op CLK_OF_DECLARE if not enabled Instead of wrapping each defenition of CLK_OF_DECLARE hook with preprocessor guards, change the definition of CLK_OF_DECLARE to expand into no-op if COMMON_CLK_OF_PROVIDER is not enabled. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/clk/clk-fixed-factor.c | 2 -- drivers/clk/clk-fixed.c | 2 -- include/linux/clk.h | 31 +++++++++++++++++++++++++------ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index a3dbf334a8..0be48558e6 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -93,7 +93,6 @@ struct clk *clk_fixed_factor(const char *name, return &f->clk; } -#if defined(CONFIG_COMMON_CLK_OF_PROVIDER) /** * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock */ @@ -127,4 +126,3 @@ static int of_fixed_factor_clk_setup(struct device_node *node) } CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock", of_fixed_factor_clk_setup); -#endif diff --git a/drivers/clk/clk-fixed.c b/drivers/clk/clk-fixed.c index f0f7fbaed5..57bf36b39e 100644 --- a/drivers/clk/clk-fixed.c +++ b/drivers/clk/clk-fixed.c @@ -55,7 +55,6 @@ struct clk *clk_fixed(const char *name, int rate) return &fix->clk; } -#if defined(CONFIG_COMMON_CLK_OF_PROVIDER) /** * of_fixed_clk_setup() - Setup function for simple fixed rate clock */ @@ -76,4 +75,3 @@ static int of_fixed_clk_setup(struct device_node *node) return of_clk_add_provider(node, of_clk_src_simple_get, clk); } CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup); -#endif diff --git a/include/linux/clk.h b/include/linux/clk.h index a061398555..081a859729 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -324,16 +324,13 @@ struct clk *clk_register_composite(const char *name, struct device_node; struct of_phandle_args; +#if defined(CONFIG_COMMON_CLK_OF_PROVIDER) + #define CLK_OF_DECLARE(name, compat, fn) \ const struct of_device_id __clk_of_table_##name \ __attribute__ ((unused,section (".__clk_of_table"))) \ = { .compatible = compat, .data = fn } -#if defined(CONFIG_COMMON_CLK_OF_PROVIDER) -int of_clk_add_provider(struct device_node *np, - struct clk *(*clk_src_get)(struct of_phandle_args *args, - void *data), - void *data); void of_clk_del_provider(struct device_node *np); typedef int (*of_clk_init_cb_t)(struct device_node *); @@ -349,11 +346,27 @@ struct clk *of_clk_get(struct device_node *np, int index); struct clk *of_clk_get_by_name(struct device_node *np, const char *name); struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec); unsigned int of_clk_get_parent_count(struct device_node *np); -char *of_clk_get_parent_name(struct device_node *np, unsigned int index); int of_clk_parent_fill(struct device_node *np, const char **parents, unsigned int size); int of_clk_init(struct device_node *root, const struct of_device_id *matches); #else + + +/* + * Create a dummy variable to avoid 'unused function' + * warnings. Compiler should be smart enough to throw it out. + */ +#define CLK_OF_DECLARE(name, compat, fn) \ +static const struct of_device_id __clk_of_table_##name \ +__attribute__ ((unused)) = { .data = fn } + + +static inline struct clk * +of_clk_src_simple_get(struct of_phandle_args *clkspec, void *data) +{ + return ERR_PTR(-ENOENT); +} + static inline struct clk *of_clk_get(struct device_node *np, int index) { return ERR_PTR(-ENOENT); @@ -374,4 +387,10 @@ struct string_list; int clk_name_complete(struct string_list *sl, char *instr); +int of_clk_add_provider(struct device_node *np, + struct clk *(*clk_src_get)(struct of_phandle_args *args, + void *data), + void *data); +char *of_clk_get_parent_name(struct device_node *np, unsigned int index); + #endif -- cgit v1.2.3 From c7455beaa13dce5be30280f8f4eda413c8e42b6d Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 17 Mar 2017 09:08:53 +0100 Subject: ARM: mvebu: remove obsolete select MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a user choice now and has been removed for all other boards in commit 790980bf18af ("Make generic default environment type a use choice"). Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- arch/arm/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 47b48308a6..567638238d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -116,7 +116,6 @@ config ARCH_MVEBU select CLKDEV_LOOKUP select GPIOLIB select HAS_DEBUG_LL - select HAVE_DEFAULT_ENVIRONMENT_NEW select HAVE_MACH_ARM_HEAD select HAVE_PBL_MULTI_IMAGES select HW_HAS_PCI -- cgit v1.2.3 From 9b75d19698077275fdd9419ab60e1076f14cf26f Mon Sep 17 00:00:00 2001 From: Steffen Trumtrar Date: Mon, 20 Mar 2017 13:55:40 +0100 Subject: bootm: fit: support rsa2048 Signed-off-by: Steffen Trumtrar Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- common/image-fit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/image-fit.c b/common/image-fit.c index 6a01c614cc..0536c49b12 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -254,6 +254,8 @@ static int fit_verify_signature(struct device_node *sig_node, void *fit) } if (strcmp(algo_name, "sha1,rsa2048") == 0) { algo = HASH_ALGO_SHA1; + } else if (strcmp(algo_name, "sha256,rsa2048") == 0) { + algo = HASH_ALGO_SHA256; } else if (strcmp(algo_name, "sha256,rsa4096") == 0) { algo = HASH_ALGO_SHA256; } else { -- cgit v1.2.3 From a3da5ed793c9aaa963809ff32916e1dee66139b8 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Tue, 21 Mar 2017 13:55:29 +0300 Subject: scripts/tags.sh: drop __TestClearPage*() helpers This is an adoption of the linux kernel commit | commit 685eaade56c66c806dbe8102f12e2926cf4ec870 | Author: Kirill A. Shutemov | Date: Fri Jan 15 16:52:10 2016 -0800 | | page-flags: drop __TestClearPage*() helpers | | Nobody uses them. | | Signed-off-by: Kirill A. Shutemov | Signed-off-by: Andrew Morton | Signed-off-by: Linus Torvalds Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- scripts/tags.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index 79fdafb0d2..c3ce5f9456 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -153,7 +153,6 @@ exuberant() --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ - --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ --regex-c='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ --regex-c='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' @@ -198,7 +197,6 @@ emacs() --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ - --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ --regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ --regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' -- cgit v1.2.3 From 9985c8ff853e53a651a8d6a150345f42226f57d4 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Tue, 21 Mar 2017 13:55:30 +0300 Subject: tags: Do not try to index defconfigs This is an adoption of the linux kernel commit | commit ab9ca615f5f4053417cba464015bf2d7334a2371 | Author: Michal Marek | Date: Thu Oct 15 11:14:02 2015 +0200 | | tags: Do not try to index defconfigs | | The defconfig files are in predictable locations, so there is no need to | index them. Plus, the script was only looking for files named | 'defconfig', which only works on a few architectures nowadays. | | Signed-off-by: Michal Marek Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- scripts/tags.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index c3ce5f9456..22a5cc4bf9 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -103,11 +103,6 @@ all_kconfigs() find_other_sources 'Kconfig*' } -all_defconfigs() -{ - find_sources $ALLSOURCE_ARCHS "defconfig" -} - docscope() { (echo \-k; echo \-q; all_sources) > cscope.files @@ -164,10 +159,6 @@ exuberant() all_kconfigs | xargs $1 -a \ --langdef=kconfig --language-force=kconfig \ --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/' - - all_defconfigs | xargs -r $1 -a \ - --langdef=dotconfig --language-force=dotconfig \ - --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' } emacs() @@ -206,9 +197,6 @@ emacs() all_kconfigs | xargs $1 -a \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/' - - all_defconfigs | xargs -r $1 -a \ - --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/' } xtags() -- cgit v1.2.3 From f4c0cb987363c67c55a2251f0488bef961210da7 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Tue, 21 Mar 2017 13:55:31 +0300 Subject: tags: Process Kconfig files in a single pass This is an adoption of the linux kernel commit | commit a281b8569e9eb4beb1651c92145271555ba05f0c | Author: Michal Marek | Date: Wed Oct 14 11:17:13 2015 +0200 | | tags: Process Kconfig files in a single pass | | Signed-off-by: Michal Marek Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- scripts/tags.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index 22a5cc4bf9..8ae44642a2 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -154,10 +154,7 @@ exuberant() all_kconfigs | xargs $1 -a \ --langdef=kconfig --language-force=kconfig \ - --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' - - all_kconfigs | xargs $1 -a \ - --langdef=kconfig --language-force=kconfig \ + --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' \ --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/' } @@ -193,9 +190,7 @@ emacs() --regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' all_kconfigs | xargs $1 -a \ - --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' - - all_kconfigs | xargs $1 -a \ + --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/' } -- cgit v1.2.3 From 4d38ece4bba29e5c29016efd9be0a778f05fec9c Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Mon, 20 Mar 2017 10:55:17 +0300 Subject: ata: ide-sff: add LBA48 support See http://wiki.osdev.org/ATA_PIO_Mode#48_bit_PIO for details. Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- drivers/ata/disk_ata_drive.c | 3 +++ drivers/ata/ide-sff.c | 54 +++++++++++++++++++++++++++++++++++--------- include/ata_drive.h | 3 +++ 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c index 1aa1bb1456..5ebddbdec8 100644 --- a/drivers/ata/disk_ata_drive.c +++ b/drivers/ata/disk_ata_drive.c @@ -237,6 +237,9 @@ static int ata_port_init(struct ata_port *port) #ifdef DEBUG ata_dump_id(port->id); #endif + + port->lba48 = ata_id_has_lba48(port->id); + if (port->devname) { port->blk.cdev.name = xstrdup(port->devname); } else { diff --git a/drivers/ata/ide-sff.c b/drivers/ata/ide-sff.c index 6dc89d79a5..b7c8847266 100644 --- a/drivers/ata/ide-sff.c +++ b/drivers/ata/ide-sff.c @@ -136,17 +136,33 @@ static int ata_wait_ready(struct ide_port *ide, unsigned timeout) * @param io Register file * @param drive 0 master drive, 1 slave drive * @param num Sector number - * - * @todo LBA48 support */ -static int ata_set_lba_sector(struct ide_port *ide, unsigned drive, uint64_t num) +static int ata_set_lba_sector(struct ata_port *port, unsigned drive, + uint64_t num) { - if (num > 0x0FFFFFFF || drive > 1) + struct ide_port *ide = to_ata_drive_access(port); + + if (drive > 1) return -EINVAL; - ata_wr_byte(ide, 0xA0 | LBA_FLAG | drive << 4 | num >> 24, - ide->io.device_addr); - ata_wr_byte(ide, 0x00, ide->io.error_addr); + if (port->lba48) { + if (num > (1ULL << 48) - 1) + return -EINVAL; + + ata_wr_byte(ide, LBA_FLAG | drive << 4, ide->io.device_addr); + + ata_wr_byte(ide, 0x00, ide->io.nsect_addr); + ata_wr_byte(ide, num >> 24, ide->io.lbal_addr); + ata_wr_byte(ide, num >> 32, ide->io.lbam_addr); + ata_wr_byte(ide, num >> 40, ide->io.lbah_addr); + } else { + if (num > (1ULL << 28) - 1) + return -EINVAL; + + ata_wr_byte(ide, 0xA0 | LBA_FLAG | drive << 4 | num >> 24, + ide->io.device_addr); + } + ata_wr_byte(ide, 0x01, ide->io.nsect_addr); ata_wr_byte(ide, num, ide->io.lbal_addr); /* 0 ... 7 */ ata_wr_byte(ide, num >> 8, ide->io.lbam_addr); /* 8 ... 15 */ @@ -316,10 +332,18 @@ static int ide_read(struct ata_port *port, void *buffer, unsigned int block, struct ide_port *ide = to_ata_drive_access(port); while (num_blocks) { - rc = ata_set_lba_sector(ide, DISK_MASTER, sector); + uint8_t cmd; + + rc = ata_set_lba_sector(port, DISK_MASTER, sector); if (rc != 0) return rc; - rc = ata_wr_cmd(ide, ATA_CMD_READ); + + if (port->lba48) + cmd = ATA_CMD_PIO_READ_EXT; + else + cmd = ATA_CMD_READ; + + rc = ata_wr_cmd(ide, cmd); if (rc != 0) return rc; rc = ata_wait_ready(ide, MAX_TIMEOUT); @@ -355,10 +379,18 @@ static int __maybe_unused ide_write(struct ata_port *port, struct ide_port *ide = to_ata_drive_access(port); while (num_blocks) { - rc = ata_set_lba_sector(ide, DISK_MASTER, sector); + uint8_t cmd; + + rc = ata_set_lba_sector(port, DISK_MASTER, sector); if (rc != 0) return rc; - rc = ata_wr_cmd(ide, ATA_CMD_WRITE); + + if (port->lba48) + cmd = ATA_CMD_PIO_WRITE_EXT; + else + cmd = ATA_CMD_WRITE; + + rc = ata_wr_cmd(ide, cmd); if (rc != 0) return rc; rc = ata_wait_ready(ide, MAX_TIMEOUT); diff --git a/include/ata_drive.h b/include/ata_drive.h index 44073cb1b1..11685eef12 100644 --- a/include/ata_drive.h +++ b/include/ata_drive.h @@ -37,8 +37,10 @@ #define ATA_CMD_ID_ATA 0xEC #define ATA_CMD_READ 0x20 +#define ATA_CMD_PIO_READ_EXT 0x24 #define ATA_CMD_READ_EXT 0x25 #define ATA_CMD_WRITE 0x30 +#define ATA_CMD_PIO_WRITE_EXT 0x34 #define ATA_CMD_WRITE_EXT 0x35 /* drive's status flags */ @@ -140,6 +142,7 @@ struct ata_port { void *drvdata; struct block_device blk; uint16_t *id; + int lba48; int initialized; int probe; }; -- cgit v1.2.3 From f1f6fbcfee7db882518dfa02512ba0ea469df388 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Fri, 24 Mar 2017 06:39:54 +0300 Subject: net: phy: mdio-gpio.c: fix "no previous prototype" warning The patch fixes this compiler's warning: drivers/net/phy/mdio-gpio.c:48:24: warning: no previous prototype for 'mdio_gpio_of_get_info' [-Wmissing-prototypes] struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev) ^ Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- drivers/net/phy/mdio-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index a839f2dee8..a846fb28e2 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c @@ -45,7 +45,7 @@ struct mdio_gpio_info { int mdc_active_low, mdio_active_low, mdo_active_low; }; -struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev) +static struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev) { int ret; enum of_gpio_flags flags; -- cgit v1.2.3 From 2491f2288a55e7b66643bcdb85c813e78f455bbf Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Fri, 24 Mar 2017 06:40:06 +0300 Subject: video: edid.c: fix "no previous prototype" warning The patch fixes this compiler's warning: drivers/video/edid.c:390:5: warning: no previous prototype for 'fb_get_mode' [-Wmissing-prototypes] int fb_get_mode(int flags, u32 val, struct fb_videomode *var) ^ Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- drivers/video/edid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/edid.c b/drivers/video/edid.c index 258526433e..bee4594118 100644 --- a/drivers/video/edid.c +++ b/drivers/video/edid.c @@ -387,7 +387,7 @@ static void fb_timings_vfreq(struct __fb_timings *timings) * REQUIRES: * A valid info->monspecs, otherwise 'safe numbers' will be used. */ -int fb_get_mode(int flags, u32 val, struct fb_videomode *var) +static int fb_get_mode(int flags, u32 val, struct fb_videomode *var) { struct __fb_timings *timings; u32 interlace = 1, dscan = 1; -- cgit v1.2.3 From 09433f971e92b946ec44526fee84487514a59192 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Fri, 24 Mar 2017 11:21:22 +0100 Subject: usb: gadget: start usbgadget automatically ... if global variable configured to do it. Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- drivers/usb/gadget/Kconfig | 11 +++++++ drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/autostart.c | 67 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 drivers/usb/gadget/autostart.c diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index eb279ae8df..4292371f09 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -30,6 +30,17 @@ config USB_GADGET_DRIVER_PXA27X default y select USB_GADGET_DUALSPEED +config USB_GADGET_AUTOSTART + bool + default y + select ENVIRONMENT_VARIABLES + select FILE_LIST + prompt "Automatically start usbgadget on boot" + help + Enabling this option allows to automatically start a fastboot + gadget during boot. This behaviour is controlled with the + global.usbgadget.fastboot_function variable. + comment "USB Gadget drivers" config USB_GADGET_DFU diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index 9ef594575b..e74cf02664 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_USB_GADGET) += composite.o config.o usbstring.o epautoconf.o udc-core.o functions.o config.o multi.o +obj-$(CONFIG_USB_GADGET_AUTOSTART) += autostart.o obj-$(CONFIG_USB_GADGET_SERIAL) += u_serial.o serial.o f_serial.o f_acm.o obj-$(CONFIG_USB_GADGET_DFU) += dfu.o obj-$(CONFIG_USB_GADGET_FASTBOOT) += f_fastboot.o diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c new file mode 100644 index 0000000000..43c2ba23d0 --- /dev/null +++ b/drivers/usb/gadget/autostart.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2017 Oleksij Rempel , Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int autostart; +static int acm; +static char *fastboot_function; + +static int usbgadget_autostart(void) +{ + struct f_multi_opts opts = {}; + + if (!autostart) + return 0; + + if (fastboot_function) + opts.fastboot_opts.files = file_list_parse(fastboot_function); + + opts.create_acm = acm; + + return usb_multi_register(&opts); +} +postenvironment_initcall(usbgadget_autostart); + +static int usbgadget_globalvars_init(void) +{ + + globalvar_add_simple_bool("usbgadget.autostart", &autostart); + globalvar_add_simple_bool("usbgadget.acm", &acm); + globalvar_add_simple_string("usbgadget.fastboot_function", + &fastboot_function); + + return 0; +} +device_initcall(usbgadget_globalvars_init); + +BAREBOX_MAGICVAR_NAMED(global_usbgadget_autostart, + global.usbgadget.autostart, + "usbgadget: Automatically start usbgadget on boot"); +BAREBOX_MAGICVAR_NAMED(global_usbgadget_acm, + global.usbgadget.acm, + "usbgadget: Create CDC ACM function"); +BAREBOX_MAGICVAR_NAMED(global_usbgadget_fastboot_function, + global.usbgadget.fastboot_function, + "usbgadget: Create Android Fastboot function"); -- cgit v1.2.3 From 462f2af3a08f71223e78b5d406dd1a1ba02dd113 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Fri, 24 Mar 2017 11:21:23 +0100 Subject: commands: usbgadget: provide fallback to global variables usbgadget autostarter is providing now a global variable to configure fastboot. We can use is as fallback for the cmd_usbgadget as well. Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- commands/usbgadget.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/commands/usbgadget.c b/commands/usbgadget.c index 314884aee8..02c2c96b02 100644 --- a/commands/usbgadget.c +++ b/commands/usbgadget.c @@ -20,6 +20,7 @@ */ #include #include +#include #include #include #include @@ -32,11 +33,11 @@ static int do_usbgadget(int argc, char *argv[]) { int opt, ret; - int acm = 1, create_serial = 0; - char *fastboot_opts = NULL, *dfu_opts = NULL; + int acm = 1, create_serial = 0, fastboot_set = 0; + const char *fastboot_opts = NULL, *dfu_opts = NULL; struct f_multi_opts *opts; - while ((opt = getopt(argc, argv, "asdA:D:")) > 0) { + while ((opt = getopt(argc, argv, "asdA::D:")) > 0) { switch (opt) { case 'a': acm = 1; @@ -51,6 +52,7 @@ static int do_usbgadget(int argc, char *argv[]) break; case 'A': fastboot_opts = optarg; + fastboot_set = 1; break; case 'd': usb_multi_unregister(); @@ -60,6 +62,9 @@ static int do_usbgadget(int argc, char *argv[]) } } + if (fastboot_set && !fastboot_opts) + fastboot_opts = getenv("global.usbgadget.fastboot_function"); + if (!dfu_opts && !fastboot_opts && !create_serial) return COMMAND_ERROR_USAGE; -- cgit v1.2.3 From 65ecf17f72015848175650f110aed160e913e4e5 Mon Sep 17 00:00:00 2001 From: Steffen Trumtrar Date: Wed, 29 Mar 2017 09:59:27 +0200 Subject: bootm: fit: support multiple configuration nodes Signed-off-by: Steffen Trumtrar Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- common/image-fit.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index 0536c49b12..81433e6ecf 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -491,6 +491,38 @@ static int fit_config_verify_signature(struct fit_handle *handle, struct device_ return ret; } +static int fit_find_compatible_unit(struct device_node *conf_node, + const char **unit) +{ + struct device_node *child = NULL; + struct device_node *barebox_root; + const char *machine; + int ret; + + barebox_root = of_get_root_node(); + if (!barebox_root) + goto default_unit; + + ret = of_property_read_string(barebox_root, "compatible", &machine); + if (ret) + return -ENOENT; + + for_each_child_of_node(conf_node, child) { + if (of_device_is_compatible(child, machine)) { + *unit = child->name; + pr_info("matching unit '%s' found\n", *unit); + return 0; + } + } + +default_unit: + pr_info("No match found. Trying default.\n"); + if (of_property_read_string(conf_node, "default", unit) == 0) + return 0; + + return -ENOENT; +} + static int fit_open_configuration(struct fit_handle *handle, const char *name) { struct device_node *conf_node = NULL; @@ -503,8 +535,12 @@ static int fit_open_configuration(struct fit_handle *handle, const char *name) if (name) { unit = name; - } else if (of_property_read_string(conf_node, "default", &unit)) { - unit = "conf@1"; + } else { + ret = fit_find_compatible_unit(conf_node, &unit); + if (ret) { + pr_info("Couldn't get a valid configuration. Aborting.\n"); + return ret; + } } conf_node = of_get_child_by_name(conf_node, unit); -- cgit v1.2.3 From 4f31107b25ac10d9bac12bb4c3be5d238609f84c Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Thu, 30 Mar 2017 20:46:35 +0200 Subject: clocksource: mvebu: don't request the used iomem resource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The register ranges of the device nodes timer@20300 and watchdog@20300 overlap, so it is impossible that both devices properly use request_iomem_region (e.g. by using dev_request_mem_resource). In Linux only the watchdog driver is registered in /proc/iomem, do the same for barebox. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- drivers/clocksource/mvebu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/mvebu.c b/drivers/clocksource/mvebu.c index cf80571263..59bbc4be22 100644 --- a/drivers/clocksource/mvebu.c +++ b/drivers/clocksource/mvebu.c @@ -60,7 +60,7 @@ static int mvebu_timer_probe(struct device_d *dev) struct clk *clk; u32 rate, div, val; - iores = dev_request_mem_resource(dev, 0); + iores = dev_get_resource(dev, IORESOURCE_MEM, 0); if (IS_ERR(iores)) return PTR_ERR(iores); timer_base = IOMEM(iores->start); -- cgit v1.2.3 From 7e642324bcde0f09e014bf04feaab1d2f40199db Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Thu, 30 Mar 2017 20:46:36 +0200 Subject: watchdog: new driver for Armada XP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This SoC uses a variant of the IP that is also used on most other Marvell SoCs. For now it only supports Armada XP but the naming is already chosen such that adding support for further SoCs doesn't result in much renaming. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- drivers/watchdog/Kconfig | 6 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/orion_wdt.c | 123 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 drivers/watchdog/orion_wdt.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 63fb1a8c57..83b6528a5f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -46,4 +46,10 @@ config WATCHDOG_OMAP help Add support for watchdog on the TI OMAP SoC. +config WATCHDOG_ORION + bool "Watchdog for Armada XP" + depends on ARCH_ARMADA_XP + help + Add support for watchdog on the Marvall Armada XP + endif diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 5fca4c368c..a3b26675ce 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_WATCHDOG_MXS28) += im28wd.o obj-$(CONFIG_WATCHDOG_DW) += dw_wdt.o obj-$(CONFIG_WATCHDOG_JZ4740) += jz4740.o obj-$(CONFIG_WATCHDOG_IMX_RESET_SOURCE) += imxwd.o +obj-$(CONFIG_WATCHDOG_ORION) += orion_wdt.o diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c new file mode 100644 index 0000000000..2802033f71 --- /dev/null +++ b/drivers/watchdog/orion_wdt.c @@ -0,0 +1,123 @@ +/* + * Watchdog driver for Marvell Armada XP. + * + * Copyright (C) 2017 Pengutronix, Uwe Kleine-König + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define CLKRATE 25000000 + +/* registers relative to timer_base (i.e. first reg property) */ +#define TIMER_CTRL 0x00 +#define TIMER_CTRL_WD_TIMER_25MHZ_EN BIT(10) +#define TIMER_CTRL_WD_TIMER_EN BIT(8) + +#define TIMER_STATUS 0x04 +#define TIMER_STATUS_WD_EXPIRED BIT(31) + +#define TIMER_WD_TIMER 0x34 + +/* registers relative to rstout_base (i.e. second reg property) */ +#define WD_RSTOUTn_MASK 0x00 +#define WD_RSTOUTn_MASK_GLOBAL_WD BIT(8) + +struct orion_wdt_ddata { + struct watchdog wd; + void __iomem *timer_base; + void __iomem *rstout_base; +}; + +static int armada_xp_set_timeout(struct watchdog *wd, unsigned timeout) +{ + struct orion_wdt_ddata *ddata = + container_of(wd, struct orion_wdt_ddata, wd); + u32 ctrl; + + if (0xffffffff / CLKRATE < timeout) + return -EINVAL; + + ctrl = readl(ddata->timer_base + TIMER_CTRL); + + if (timeout == 0) { + /* disable timer */ + ctrl &= ~TIMER_CTRL_WD_TIMER_EN; + writel(ctrl, ddata->timer_base + TIMER_CTRL); + + return 0; + } + + /* setup duration */ + writel(CLKRATE * timeout, ddata->timer_base + TIMER_WD_TIMER); + + /* clear expiration status */ + writel(readl(ddata->timer_base + TIMER_STATUS) & ~TIMER_STATUS_WD_EXPIRED, + ddata->timer_base + TIMER_STATUS); + + /* assert reset on expiration */ + writel(WD_RSTOUTn_MASK_GLOBAL_WD, ddata->rstout_base + WD_RSTOUTn_MASK); + + /* enable */ + ctrl |= TIMER_CTRL_WD_TIMER_25MHZ_EN | TIMER_CTRL_WD_TIMER_EN; + writel(ctrl, ddata->timer_base + TIMER_CTRL); + + return 0; +} + +static int orion_wdt_probe(struct device_d *dev) +{ + struct orion_wdt_ddata* ddata; + struct resource *res_timer, *res_rstout; + + ddata = xzalloc(sizeof(*ddata)); + + ddata->wd.set_timeout = armada_xp_set_timeout; + ddata->wd.name = "orion_wdt"; + ddata->wd.dev = dev; + + res_timer = dev_request_mem_resource(dev, 0); + if (IS_ERR(res_timer)) { + dev_err(dev, "could not get timer memory region\n"); + return PTR_ERR(res_timer); + } + ddata->timer_base = IOMEM(res_timer->start); + + res_rstout = dev_request_mem_resource(dev, 1); + if (IS_ERR(res_rstout)) { + dev_err(dev, "could not get rstout memory region\n"); + release_region(res_timer); + + return PTR_ERR(res_rstout); + } + ddata->rstout_base = IOMEM(res_rstout->start); + + return watchdog_register(&ddata->wd); +} + +static const struct of_device_id orion_wdt_of_match[] = { + { + .compatible = "marvell,armada-xp-wdt", + }, { /* sentinel */ } +}; + +static struct driver_d orion_wdt_driver = { + .probe = orion_wdt_probe, + .name = "orion_wdt", + .of_compatible = DRV_OF_COMPAT(orion_wdt_of_match), +}; +device_platform_driver(orion_wdt_driver); -- cgit v1.2.3 From 3e39d067c8ef4419830735a4be89f3065b5ba701 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 3 Apr 2017 22:52:28 +0200 Subject: global command: print info about variables The info contains useful information at least for enums, for these the possible values are printed. This makes the output of the "global" command more useful and similar to "devinfo global" Signed-off-by: Sascha Hauer --- common/globalvar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/globalvar.c b/common/globalvar.c index 52808f8852..4cf635c0c7 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -321,7 +321,10 @@ static void device_param_print(struct device_d *dev) if (IS_ENABLED(CONFIG_NVVAR) && dev != &nv_device) nv = dev_get_param(&nv_device, param->name); - printf("%s%s: %s\n", nv ? "* " : " ", param->name, p); + printf("%s%s: %s", nv ? "* " : " ", param->name, p); + if (param->info) + param->info(param); + printf("\n"); } } -- cgit v1.2.3 From 99a2e09401bba6ef5894c2e07f701d114f7ad5ef Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Mon, 3 Apr 2017 10:31:01 +0200 Subject: usb: gadget: set otg to peripheral mode on autostart we won't be able to start if otg is not properly configured. Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- drivers/usb/gadget/autostart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c index 43c2ba23d0..4ad1dd6be1 100644 --- a/drivers/usb/gadget/autostart.c +++ b/drivers/usb/gadget/autostart.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,8 @@ static int usbgadget_autostart(void) if (!autostart) return 0; + setenv("otg.mode", "peripheral"); + if (fastboot_function) opts.fastboot_opts.files = file_list_parse(fastboot_function); -- cgit v1.2.3 From 3358d27d89b03e3117e779a04301aa327eda2ea2 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Wed, 5 Apr 2017 13:02:38 +0300 Subject: commands: digest: show area info only if necessary Area info "0x00000000 ... 0xffffffffffffffff" in digest commands output is something strange and misleading, e.g. barebox@barebox sandbox:/ md5sum logo/barebox-logo-240.png d3226a0eba3fd49af6bd190b077a3466 logo/barebox-logo-240.png 0x00000000 ... 0xffffffffffffffff Also skipping area info in the barebox digets commands output for every file makes it more similar to traditional *nix digest commands output. Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- commands/digest.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/commands/digest.c b/commands/digest.c index 02a9f6f0de..0edbbec32c 100644 --- a/commands/digest.c +++ b/commands/digest.c @@ -36,12 +36,16 @@ int __do_digest(struct digest *d, unsigned char *sig, while (*argv) { char *filename = "/dev/mem"; loff_t start = 0, size = ~0; + int show_area = 1; /* arguments are either file, file+area or area */ if (parse_area_spec(*argv, &start, &size)) { filename = *argv; - if (argv[1] && !parse_area_spec(argv[1], &start, &size)) + show_area = 0; + if (argv[1] && !parse_area_spec(argv[1], &start, &size)) { argv++; + show_area = 1; + } } ret = digest_file_window(d, filename, @@ -53,8 +57,12 @@ int __do_digest(struct digest *d, unsigned char *sig, for (i = 0; i < digest_length(d); i++) printf("%02x", hash[i]); - printf(" %s\t0x%08llx ... 0x%08llx\n", - filename, start, start + size); + printf(" %s", filename); + if (show_area) + printf("\t0x%08llx ... 0x%08llx", + start, start + size); + + puts("\n"); } } -- cgit v1.2.3 From 0c7c7fe41fd3a2971dbc0149b91972b6bf6eb38f Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Wed, 5 Apr 2017 13:03:36 +0300 Subject: sandbox_defconfig: enable squashfs support Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- arch/sandbox/configs/sandbox_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sandbox/configs/sandbox_defconfig b/arch/sandbox/configs/sandbox_defconfig index c20dd15a0b..dbaff12bfb 100644 --- a/arch/sandbox/configs/sandbox_defconfig +++ b/arch/sandbox/configs/sandbox_defconfig @@ -79,6 +79,7 @@ CONFIG_FS_FAT_WRITE=y CONFIG_FS_FAT_LFN=y CONFIG_FS_BPKFS=y CONFIG_FS_UIMAGEFS=y +CONFIG_FS_SQUASHFS=y CONFIG_BZLIB=y CONFIG_LZ4_DECOMPRESS=y CONFIG_XZ_DECOMPRESS=y -- cgit v1.2.3 From b9abc5322e2a18828fbfab5e081f846f0c4199cc Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 5 Apr 2017 16:26:20 +0200 Subject: boot: Allow to register boot entry providers bootentry_create_from_name() takes a name and creates bootentries for it. It tries different providers that interpret the name: blspec, bootchooser or script pathes. Instead of hardcoding the different providers in the function, allow the providers to register themselves. Signed-off-by: Sascha Hauer --- common/boot.c | 26 ++++++++++++++++++++++++++ include/boot.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/common/boot.c b/common/boot.c index 4306319331..f0359cff38 100644 --- a/common/boot.c +++ b/common/boot.c @@ -244,6 +244,25 @@ static int bootscript_scan_path(struct bootentries *bootentries, const char *pat return ret; } +static LIST_HEAD(bootentry_providers); + +struct bootentry_provider { + int (*fn)(struct bootentries *bootentries, const char *name); + struct list_head list; +}; + +int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, const char *name)) +{ + struct bootentry_provider *p; + + p = xzalloc(sizeof(*p)); + p->fn = fn; + + list_add_tail(&p->list, &bootentry_providers); + + return 0; +} + /* * bootentry_create_from_name - create boot entries from a name * @@ -261,6 +280,7 @@ static int bootscript_scan_path(struct bootentries *bootentries, const char *pat int bootentry_create_from_name(struct bootentries *bootentries, const char *name) { + struct bootentry_provider *p; int found = 0, ret; if (IS_ENABLED(CONFIG_BLSPEC)) { @@ -275,6 +295,12 @@ int bootentry_create_from_name(struct bootentries *bootentries, } } + list_for_each_entry(p, &bootentry_providers, list) { + ret = p->fn(bootentries, name); + if (ret > 0) + found += ret; + } + if (IS_ENABLED(CONFIG_BOOTCHOOSER) && !strcmp(name, "bootchooser")) { ret = bootchooser_create_bootentry(bootentries); if (ret > 0) diff --git a/include/boot.h b/include/boot.h index a855cbe1e5..4f7612ab80 100644 --- a/include/boot.h +++ b/include/boot.h @@ -36,6 +36,8 @@ struct bootentry { int bootentries_add_entry(struct bootentries *entries, struct bootentry *entry); +int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, const char *name)); + #define bootentries_for_each_entry(bootentries, entry) \ list_for_each_entry(entry, &bootentries->entries, list) -- cgit v1.2.3 From b79ce1382f201bf2e098bafe618a81a4a83e7d1e Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 5 Apr 2017 16:28:50 +0200 Subject: blspec: register as bootentry provider Instead of using a global function called by bootentry_create_from_name(), register blspec as bootentry provider. Signed-off-by: Sascha Hauer --- common/blspec.c | 24 ++++++++++++++++++++++++ common/boot.c | 12 ------------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/common/blspec.c b/common/blspec.c index ec63ddb407..8132d141ab 100644 --- a/common/blspec.c +++ b/common/blspec.c @@ -732,3 +732,27 @@ int blspec_scan_devicename(struct bootentries *bootentries, const char *devname) return blspec_scan_device(bootentries, dev); } + +static int blspec_bootentry_provider(struct bootentries *bootentries, + const char *name) +{ + int ret, found = 0; + + ret = blspec_scan_devicename(bootentries, name); + if (ret > 0) + found += ret; + + if (*name == '/' || !strncmp(name, "nfs://", 6)) { + ret = blspec_scan_directory(bootentries, name); + if (ret > 0) + found += ret; + } + + return found; +} + +static int blspec_init(void) +{ + return bootentry_register_provider(blspec_bootentry_provider); +} +device_initcall(blspec_init); \ No newline at end of file diff --git a/common/boot.c b/common/boot.c index f0359cff38..3280ac4f54 100644 --- a/common/boot.c +++ b/common/boot.c @@ -283,18 +283,6 @@ int bootentry_create_from_name(struct bootentries *bootentries, struct bootentry_provider *p; int found = 0, ret; - if (IS_ENABLED(CONFIG_BLSPEC)) { - ret = blspec_scan_devicename(bootentries, name); - if (ret > 0) - found += ret; - - if (*name == '/' || !strncmp(name, "nfs://", 6)) { - ret = blspec_scan_directory(bootentries, name); - if (ret > 0) - found += ret; - } - } - list_for_each_entry(p, &bootentry_providers, list) { ret = p->fn(bootentries, name); if (ret > 0) -- cgit v1.2.3 From 18c05a168124a027aa481ab79d4527f1767939e6 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 5 Apr 2017 16:28:50 +0200 Subject: bootchooser: register as bootentry provider Instead of using a global function called by bootentry_create_from_name(), register the bootchooser as bootentry provider. Signed-off-by: Sascha Hauer --- common/boot.c | 6 ------ common/bootchooser.c | 11 +++++++++-- include/bootchooser.h | 2 -- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/common/boot.c b/common/boot.c index 3280ac4f54..cef3d5e514 100644 --- a/common/boot.c +++ b/common/boot.c @@ -289,12 +289,6 @@ int bootentry_create_from_name(struct bootentries *bootentries, found += ret; } - if (IS_ENABLED(CONFIG_BOOTCHOOSER) && !strcmp(name, "bootchooser")) { - ret = bootchooser_create_bootentry(bootentries); - if (ret > 0) - found += ret; - } - if (!found) { char *path; diff --git a/common/bootchooser.c b/common/bootchooser.c index 9c110f267e..f2174a1348 100644 --- a/common/bootchooser.c +++ b/common/bootchooser.c @@ -863,10 +863,14 @@ static void bootchooser_release(struct bootentry *entry) * * Return: The number of entries added to the list */ -int bootchooser_create_bootentry(struct bootentries *entries) +static int bootchooser_add_entry(struct bootentries *entries, const char *name) { - struct bootchooser *bc = bootchooser_get(); + struct bootchooser *bc; + + if (strcmp(name, "bootchooser")) + return 0; + bc = bootchooser_get(); if (IS_ERR(bc)) return PTR_ERR(bc); @@ -904,6 +908,9 @@ static int bootchooser_init(void) reset_attempts_names, ARRAY_SIZE(reset_attempts_names)); globalvar_add_simple_bitmask("bootchooser.reset_priorities", &reset_priorities, reset_priorities_names, ARRAY_SIZE(reset_priorities_names)); + + bootentry_register_provider(bootchooser_add_entry); + return 0; } device_initcall(bootchooser_init); diff --git a/include/bootchooser.h b/include/bootchooser.h index c948247722..246258e8c9 100644 --- a/include/bootchooser.h +++ b/include/bootchooser.h @@ -19,8 +19,6 @@ struct bootchooser_target *bootchooser_target_by_name(struct bootchooser *bootch const char *name); void bootchooser_target_force_boot(struct bootchooser_target *target); -int bootchooser_create_bootentry(struct bootentries *entries); - int bootchooser_target_set_attempts(struct bootchooser_target *target, int attempts); int bootchooser_target_set_priority(struct bootchooser_target *target, int priority); -- cgit v1.2.3 From 9653eefe40c7945a85b8c17657f17dc9e2ed3776 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 5 Apr 2017 16:29:36 +0200 Subject: bootchooser: export bootchooser_boot Some boards that boot directly from C code do already know that they want to boot from bootchooser and nothing else. For these it's easiest to call bootchooser_boot directly, so export this function. Signed-off-by: Sascha Hauer --- common/bootchooser.c | 19 ++++++++++++------- include/bootchooser.h | 2 ++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/common/bootchooser.c b/common/bootchooser.c index f2174a1348..455f290fa2 100644 --- a/common/bootchooser.c +++ b/common/bootchooser.c @@ -827,15 +827,10 @@ out: return ret; } -static int bootchooser_boot(struct bootentry *entry, int verbose, int dryrun) +int bootchooser_boot(struct bootchooser *bc) { - struct bootchooser *bc = container_of(entry, struct bootchooser, - entry); int ret, tryagain; - bc->verbose = verbose; - bc->dryrun = dryrun; - do { ret = bootchooser_boot_one(bc, &tryagain); @@ -846,6 +841,16 @@ static int bootchooser_boot(struct bootentry *entry, int verbose, int dryrun) return ret; } +static int bootchooser_entry_boot(struct bootentry *entry, int verbose, int dryrun) +{ + struct bootchooser *bc = container_of(entry, struct bootchooser, + entry); + bc->verbose = verbose; + bc->dryrun = dryrun; + + return bootchooser_boot(bc); +} + static void bootchooser_release(struct bootentry *entry) { struct bootchooser *bc = container_of(entry, struct bootchooser, @@ -874,7 +879,7 @@ static int bootchooser_add_entry(struct bootentries *entries, const char *name) if (IS_ERR(bc)) return PTR_ERR(bc); - bc->entry.boot = bootchooser_boot; + bc->entry.boot = bootchooser_entry_boot; bc->entry.release = bootchooser_release; bc->entry.title = xstrdup("bootchooser"); bc->entry.description = xstrdup("bootchooser"); diff --git a/include/bootchooser.h b/include/bootchooser.h index 246258e8c9..7822c01459 100644 --- a/include/bootchooser.h +++ b/include/bootchooser.h @@ -13,6 +13,8 @@ int bootchooser_put(struct bootchooser *bootchooser); void bootchooser_info(struct bootchooser *bootchooser); +int bootchooser_boot(struct bootchooser *bc); + struct bootchooser_target *bootchooser_get_last_chosen(struct bootchooser *bootchooser); const char *bootchooser_target_name(struct bootchooser_target *target); struct bootchooser_target *bootchooser_target_by_name(struct bootchooser *bootchooser, -- cgit v1.2.3 From c690427ddfd8f4eb6eda55f493e9d3727cbf46a6 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 7 Apr 2017 08:43:59 +0200 Subject: globalvar: remove unused globalvar_add() globalvar_add() is unused in the tree. Remove it. Signed-off-by: Sascha Hauer --- common/globalvar.c | 16 ---------------- include/globalvar.h | 12 ------------ 2 files changed, 28 deletions(-) diff --git a/common/globalvar.c b/common/globalvar.c index 4cf635c0c7..971c21949f 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -29,22 +29,6 @@ void nv_var_set_clean(void) nv_dirty = 0; } -int globalvar_add(const char *name, - int (*set)(struct device_d *dev, struct param_d *p, const char *val), - const char *(*get)(struct device_d *, struct param_d *p), - unsigned long flags) -{ - struct param_d *param; - - if (!strncmp(name, "global.", 7)) - name += 7; - - param = dev_add_param(&global_device, name, set, get, flags); - if (IS_ERR(param)) - return PTR_ERR(param); - return 0; -} - void globalvar_remove(const char *name) { struct param_d *p, *tmp; diff --git a/include/globalvar.h b/include/globalvar.h index 80bc53e680..df43f1fe66 100644 --- a/include/globalvar.h +++ b/include/globalvar.h @@ -11,10 +11,6 @@ extern struct device_d global_device; #ifdef CONFIG_GLOBALVAR int globalvar_add_simple(const char *name, const char *value); -int globalvar_add(const char *name, - int (*set)(struct device_d *dev, struct param_d *p, const char *val), - const char *(*get)(struct device_d *, struct param_d *p), - unsigned long flags); void globalvar_remove(const char *name); char *globalvar_get_match(const char *match, const char *separator); void globalvar_set_match(const char *match, const char *val); @@ -80,14 +76,6 @@ static inline int globalvar_add_simple_ip(const char *name, return 0; } -static inline int globalvar_add(const char *name, - int (*set)(struct device_d *dev, struct param_d *p, const char *val), - const char *(*get)(struct device_d *, struct param_d *p), - unsigned long flags) -{ - return 0; -} - static inline void globalvar_remove(const char *name) {} static inline void globalvar_print(void) {} -- cgit v1.2.3 From 35d8e858bea17ec4796069c9c27fd0b134125eaf Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 6 Apr 2017 15:23:56 +0200 Subject: nv: Do not create globalvars from nvvars When we create a new nvvar there's no need to create the corresponding globalvar, because whoever wants to use the corresponding globalvar will create it before usage anyway. Doing this means that we have to test for existence of a corresponding nvvar when we create a globalvar, and if it does, set the value of the globalvar from the nvvar. Signed-off-by: Sascha Hauer --- common/globalvar.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/common/globalvar.c b/common/globalvar.c index 971c21949f..778d8e608c 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -165,14 +165,18 @@ static int nvvar_device_dispatch(const char *name, struct device_d **dev, static int nv_set(struct device_d *dev, struct param_d *p, const char *val) { + struct param_d *g; int ret; if (!val) val = ""; - ret = dev_set_param(&global_device, p->name, val); - if (ret) - return ret; + g = get_param_by_name(&global_device, p->name); + if (g) { + ret = dev_set_param(&global_device, p->name, val); + if (ret) + return ret; + } free(p->value); p->value = xstrdup(val); @@ -199,7 +203,6 @@ static int nv_param_set(struct device_d *dev, struct param_d *p, const char *val static int __nvvar_add(const char *name, const char *value) { struct param_d *p; - int ret; if (!IS_ENABLED(CONFIG_NVVAR)) return -ENOSYS; @@ -212,11 +215,6 @@ static int __nvvar_add(const char *name, const char *value) return PTR_ERR(p); } - /* Create corresponding globalvar if it doesn't exist yet */ - ret = globalvar_add_simple(name, value); - if (ret && ret != -EEXIST) - return ret; - if (!value) value = dev_get_param(&global_device, name); @@ -387,6 +385,15 @@ static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const c return dev_param_set_generic(dev, p, val); } +static void globalvar_nv_sync(const char *name) +{ + const char *val; + + val = dev_get_param(&nv_device, name); + if (val) + dev_set_param(&global_device, name, val); +} + /* * globalvar_add_simple * @@ -403,10 +410,12 @@ int globalvar_add_simple(const char *name, const char *value) return PTR_ERR(param); } - if (!value) - return 0; + if (value) + dev_set_param(&global_device, name, value); + + globalvar_nv_sync(name); - return dev_set_param(&global_device, name, value); + return 0; } static int globalvar_remove_unqualified(const char *name) @@ -425,15 +434,6 @@ static int globalvar_remove_unqualified(const char *name) return 0; } -static void globalvar_nv_sync(const char *name) -{ - const char *val; - - val = dev_get_param(&nv_device, name); - if (val) - dev_set_param(&global_device, name, val); -} - int globalvar_add_simple_string(const char *name, char **value) { struct param_d *p; -- cgit v1.2.3 From e4f81050e098074792730b61563538d9e394e3d6 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 7 Apr 2017 08:49:19 +0200 Subject: globalvar: remove code for unqualified globalvars The globalvar_add_simple_* functions will fail when a globalvar of the name already exists. This happened when the globalvar was created previously because a corresponding nvvar existed. For this reason we removed the globalvars that have been previously created by nvvar creation (we called these unqualified globalvars). Since we no longer create the corresponding globalvars on nvvar creation this code is no longer needed. Remove it. Signed-off-by: Sascha Hauer --- common/globalvar.c | 43 +------------------------------------------ include/param.h | 1 - 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/common/globalvar.c b/common/globalvar.c index 778d8e608c..4050bd66de 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -404,7 +404,7 @@ int globalvar_add_simple(const char *name, const char *value) struct param_d *param; param = dev_add_param(&global_device, name, globalvar_simple_set, NULL, - PARAM_GLOBALVAR_UNQUALIFIED); + 0); if (IS_ERR(param)) { if (PTR_ERR(param) != -EEXIST) return PTR_ERR(param); @@ -418,30 +418,9 @@ int globalvar_add_simple(const char *name, const char *value) return 0; } -static int globalvar_remove_unqualified(const char *name) -{ - struct param_d *p; - - p = get_param_by_name(&global_device, name); - if (!p) - return 0; - - if (!(p->flags & PARAM_GLOBALVAR_UNQUALIFIED)) - return -EEXIST; - - dev_remove_param(p); - - return 0; -} - int globalvar_add_simple_string(const char *name, char **value) { struct param_d *p; - int ret; - - ret = globalvar_remove_unqualified(name); - if (ret) - return ret; p = dev_add_param_string(&global_device, name, NULL, NULL, value, NULL); @@ -458,11 +437,6 @@ int globalvar_add_simple_int(const char *name, int *value, const char *format) { struct param_d *p; - int ret; - - ret = globalvar_remove_unqualified(name); - if (ret) - return ret; p = dev_add_param_int(&global_device, name, NULL, NULL, value, format, NULL); @@ -478,11 +452,6 @@ int globalvar_add_simple_int(const char *name, int *value, int globalvar_add_simple_bool(const char *name, int *value) { struct param_d *p; - int ret; - - ret = globalvar_remove_unqualified(name); - if (ret) - return ret; p = dev_add_param_bool(&global_device, name, NULL, NULL, value, NULL); @@ -499,11 +468,6 @@ int globalvar_add_simple_enum(const char *name, int *value, const char * const *names, int max) { struct param_d *p; - int ret; - - ret = globalvar_remove_unqualified(name); - if (ret) - return ret; p = dev_add_param_enum(&global_device, name, NULL, NULL, value, names, max, NULL); @@ -533,11 +497,6 @@ int globalvar_add_simple_bitmask(const char *name, unsigned long *value, int globalvar_add_simple_ip(const char *name, IPaddr_t *ip) { struct param_d *p; - int ret; - - ret = globalvar_remove_unqualified(name); - if (ret) - return ret; p = dev_add_param_ip(&global_device, name, NULL, NULL, ip, NULL); diff --git a/include/param.h b/include/param.h index f5f82ee70c..f9f3398cae 100644 --- a/include/param.h +++ b/include/param.h @@ -6,7 +6,6 @@ #include #define PARAM_FLAG_RO (1 << 0) -#define PARAM_GLOBALVAR_UNQUALIFIED (1 << 1) struct device_d; typedef uint32_t IPaddr_t; -- cgit v1.2.3