diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-11 10:49:50 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-11 10:49:50 +0100 |
commit | 034d4ddcb6dfc7f72cb5076807e93a7bb7e4636b (patch) | |
tree | a8912608d1b8f1614e58c94f67e0b9f1801018e6 /commands | |
parent | 7991fe1b8eb057c6d7acc5c91f10108c1ee10a52 (diff) | |
parent | 092479d7da288479eb99362b4e852948b1de6de9 (diff) | |
download | barebox-034d4ddcb6dfc7f72cb5076807e93a7bb7e4636b.tar.gz barebox-034d4ddcb6dfc7f72cb5076807e93a7bb7e4636b.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'commands')
-rw-r--r-- | commands/Kconfig | 16 | ||||
-rw-r--r-- | commands/Makefile | 1 | ||||
-rw-r--r-- | commands/magicvar.c | 2 | ||||
-rw-r--r-- | commands/of_fixup_status.c | 74 |
4 files changed, 92 insertions, 1 deletions
diff --git a/commands/Kconfig b/commands/Kconfig index b4fdc866a7..9519a44cfc 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -2114,6 +2114,22 @@ config CMD_OF_DISPLAY_TIMINGS -s path select display-timings and register oftree fixup -f dtb work on dtb. Has no effect on -s option +config CMD_OF_FIXUP_STATUS + tristate + select OFTREE + prompt "of_fixup_status" + help + Register a fixup to enable or disable node + + Usage: of_fixup_node [-d] path + + Options: + -d disable node + path Node path or alias + + Register a fixup to enable or disable a device tree node. + Nodes are enabled on default. Disabled with -d. + config CMD_OFTREE tristate select OFTREE diff --git a/commands/Makefile b/commands/Makefile index d98534119d..8975d4bd40 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -78,6 +78,7 @@ obj-$(CONFIG_CMD_OF_PROPERTY) += of_property.o obj-$(CONFIG_CMD_OF_NODE) += of_node.o obj-$(CONFIG_CMD_OF_DUMP) += of_dump.o obj-$(CONFIG_CMD_OF_DISPLAY_TIMINGS) += of_display_timings.o +obj-$(CONFIG_CMD_OF_FIXUP_STATUS) += of_fixup_status.o obj-$(CONFIG_CMD_MAGICVAR) += magicvar.o obj-$(CONFIG_CMD_IOMEM) += iomemport.o obj-$(CONFIG_CMD_LINUX_EXEC) += linux_exec.o diff --git a/commands/magicvar.c b/commands/magicvar.c index 6737eb533d..8740784ed2 100644 --- a/commands/magicvar.c +++ b/commands/magicvar.c @@ -24,7 +24,7 @@ static void magicvar_print_one(struct magicvar_dyn *md, int verbose) } } -struct magicvar_dyn *magicvar_find(const char *name) +static struct magicvar_dyn *magicvar_find(const char *name) { struct magicvar_dyn *md; diff --git a/commands/of_fixup_status.c b/commands/of_fixup_status.c new file mode 100644 index 0000000000..9a4a619195 --- /dev/null +++ b/commands/of_fixup_status.c @@ -0,0 +1,74 @@ +/* + * of_fixup_status.c - Register a fixup to enable or disable nodes in the + * device tree + * + * Copyright (c) 2014-2016 PHYTEC Messtechnik GmbH + * Author: + * Teresa Remmet + * Wadim Egorov + * + * 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. + */ + +#include <common.h> +#include <of.h> +#include <command.h> +#include <malloc.h> +#include <complete.h> +#include <asm/byteorder.h> +#include <linux/err.h> +#include <getopt.h> +#include <string.h> + +static int do_of_fixup_status(int argc, char *argv[]) +{ + int opt; + bool status = 1; + char *node = NULL; + + while ((opt = getopt(argc, argv, "d")) > 0) { + switch (opt) { + case 'd': + status = 0; + break; + default: + return COMMAND_ERROR_USAGE; + } + } + + if (optind == argc) + return COMMAND_ERROR_USAGE; + + node = xstrdup(argv[optind]); + + of_register_set_status_fixup(node, status); + + return 0; +} + +BAREBOX_CMD_HELP_START(of_fixup_status) +BAREBOX_CMD_HELP_TEXT("Options:") +BAREBOX_CMD_HELP_OPT("-d", "disable node") +BAREBOX_CMD_HELP_OPT("path", "Node path\n") +BAREBOX_CMD_HELP_TEXT("Register a fixup to enable or disable a device tree node.") +BAREBOX_CMD_HELP_TEXT("Nodes are enabled on default. Disabled with -d.") +BAREBOX_CMD_HELP_END + +BAREBOX_CMD_START(of_fixup_status) + .cmd = do_of_fixup_status, + BAREBOX_CMD_DESC("register a fixup to enable or disable node") + BAREBOX_CMD_OPTS("[-d] path") + BAREBOX_CMD_GROUP(CMD_GRP_MISC) + BAREBOX_CMD_COMPLETE(devicetree_file_complete) + BAREBOX_CMD_HELP(cmd_of_fixup_status_help) +BAREBOX_CMD_END |