Michal Simek | a0d2802 | 2013-11-21 13:39:02 -0800 | [diff] [blame^] | 1 | /* |
| 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 | |
| 10 | int __weak soc_clk_dump(void) |
| 11 | { |
| 12 | puts("Not implemented\n"); |
| 13 | return 1; |
| 14 | } |
| 15 | |
| 16 | static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc, |
| 17 | char *const argv[]) |
| 18 | { |
| 19 | return soc_clk_dump(); |
| 20 | } |
| 21 | |
| 22 | static cmd_tbl_t cmd_clk_sub[] = { |
| 23 | U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""), |
| 24 | }; |
| 25 | |
| 26 | static int do_clk(cmd_tbl_t *cmdtp, int flag, int argc, |
| 27 | char *const argv[]) |
| 28 | { |
| 29 | cmd_tbl_t *c; |
| 30 | |
| 31 | if (argc < 2) |
| 32 | return CMD_RET_USAGE; |
| 33 | |
| 34 | /* Strip off leading 'clk' command argument */ |
| 35 | argc--; |
| 36 | argv++; |
| 37 | |
| 38 | c = find_cmd_tbl(argv[0], &cmd_clk_sub[0], ARRAY_SIZE(cmd_clk_sub)); |
| 39 | |
| 40 | if (c) |
| 41 | return c->cmd(cmdtp, flag, argc, argv); |
| 42 | else |
| 43 | return CMD_RET_USAGE; |
| 44 | } |
| 45 | |
| 46 | #ifdef CONFIG_SYS_LONGHELP |
| 47 | static char clk_help_text[] = |
| 48 | "dump - Print clock frequencies"; |
| 49 | #endif |
| 50 | |
| 51 | U_BOOT_CMD(clk, 2, 1, do_clk, "CLK sub-system", clk_help_text); |