1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2013 Xilinx, Inc.
8 #if defined(CONFIG_DM) && defined(CONFIG_CLK)
10 #include <dm/device-internal.h>
13 int __weak soc_clk_dump(void)
15 #if defined(CONFIG_DM) && defined(CONFIG_CLK)
21 /* Device addresses start at 1 */
22 ret = uclass_get(UCLASS_CLK, &uc);
26 uclass_foreach_dev(dev, uc) {
27 memset(&clk, 0, sizeof(clk));
28 ret = device_probe(dev);
30 printf("%-30.30s : ? Hz\n", dev->name);
34 ret = clk_request(dev, &clk);
36 printf("%-30.30s : ? Hz\n", dev->name);
40 printf("%-30.30s : %lu Hz\n", dev->name, clk_get_rate(&clk));
47 puts("Not implemented\n");
52 static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc,
59 printf("Clock dump error %d\n", ret);
60 ret = CMD_RET_FAILURE;
66 static cmd_tbl_t cmd_clk_sub[] = {
67 U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""),
70 static int do_clk(cmd_tbl_t *cmdtp, int flag, int argc,
78 /* Strip off leading 'clk' command argument */
82 c = find_cmd_tbl(argv[0], &cmd_clk_sub[0], ARRAY_SIZE(cmd_clk_sub));
85 return c->cmd(cmdtp, flag, argc, argv);
90 #ifdef CONFIG_SYS_LONGHELP
91 static char clk_help_text[] =
92 "dump - Print clock frequencies";
95 U_BOOT_CMD(clk, 2, 1, do_clk, "CLK sub-system", clk_help_text);