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