blob: 52b25405ce6e2356bcab6a04c490289c089f8f7e [file] [log] [blame]
Michal Simeka0d28022013-11-21 13:39:02 -08001/*
2 * Copyright (C) 2013 Xilinx, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6#include <common.h>
7#include <command.h>
8#include <clk.h>
9
10int __weak soc_clk_dump(void)
11{
12 puts("Not implemented\n");
13 return 1;
14}
15
16static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc,
17 char *const argv[])
18{
Michal Simek7f6992b2018-04-19 15:15:25 +020019 int ret;
20
21 ret = soc_clk_dump();
22 if (ret < 0) {
23 printf("Clock dump error %d\n", ret);
24 ret = CMD_RET_FAILURE;
25 }
26
27 return ret;
Michal Simeka0d28022013-11-21 13:39:02 -080028}
29
30static cmd_tbl_t cmd_clk_sub[] = {
31 U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""),
32};
33
34static int do_clk(cmd_tbl_t *cmdtp, int flag, int argc,
35 char *const argv[])
36{
37 cmd_tbl_t *c;
38
39 if (argc < 2)
40 return CMD_RET_USAGE;
41
42 /* Strip off leading 'clk' command argument */
43 argc--;
44 argv++;
45
46 c = find_cmd_tbl(argv[0], &cmd_clk_sub[0], ARRAY_SIZE(cmd_clk_sub));
47
48 if (c)
49 return c->cmd(cmdtp, flag, argc, argv);
50 else
51 return CMD_RET_USAGE;
52}
53
54#ifdef CONFIG_SYS_LONGHELP
55static char clk_help_text[] =
56 "dump - Print clock frequencies";
57#endif
58
59U_BOOT_CMD(clk, 2, 1, do_clk, "CLK sub-system", clk_help_text);