diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-08-27 10:43:30 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-23 10:54:07 +0200 |
commit | 1c2a23346bd1fa727837bea9be657f4b6f28d53d (patch) | |
tree | 7cba5204cc36e2e4552536c28be17cec4680b7d8 /commands | |
parent | a1b04c33faacbcc5bc4e7e3855914c51616a3a98 (diff) | |
download | barebox-1c2a23346bd1fa727837bea9be657f4b6f28d53d.tar.gz barebox-1c2a23346bd1fa727837bea9be657f4b6f28d53d.tar.xz |
clk_dump command: Allow printing a single clock
So far the clk_dump command can only print all clocks. With this patch
we can limit the output to ancestors and children of a given clock. This
makes it easier to find the desired information in big clock trees.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/clk.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/commands/clk.c b/commands/clk.c index 47159dddd2..649a0a7cb2 100644 --- a/commands/clk.c +++ b/commands/clk.c @@ -139,6 +139,7 @@ BAREBOX_CMD_END static int do_clk_dump(int argc, char *argv[]) { int opt, verbose = 0; + struct clk *clk; while ((opt = getopt(argc, argv, "v")) > 0) { switch(opt) { @@ -151,7 +152,16 @@ static int do_clk_dump(int argc, char *argv[]) } } - clk_dump(verbose); + if (optind == argc) { + clk_dump(verbose); + return COMMAND_SUCCESS; + } + + clk = clk_lookup(argv[optind]); + if (IS_ERR(clk)) + return PTR_ERR(clk); + + clk_dump_one(clk, verbose); return COMMAND_SUCCESS; } @@ -164,9 +174,10 @@ BAREBOX_CMD_HELP_END BAREBOX_CMD_START(clk_dump) .cmd = do_clk_dump, BAREBOX_CMD_DESC("show information about registered clocks") - BAREBOX_CMD_OPTS("[-v]") + BAREBOX_CMD_OPTS("[-v] [clkname]") BAREBOX_CMD_GROUP(CMD_GRP_INFO) BAREBOX_CMD_HELP(cmd_clk_dump_help) + BAREBOX_CMD_COMPLETE(clk_name_complete) BAREBOX_CMD_END static int do_clk_set_parent(int argc, char *argv[]) |