diff options
author | Tom Rini <trini@konsulko.com> | 2022-02-25 11:21:32 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-02-25 11:21:32 -0500 |
commit | c6ae38b38967a5c33d729c20e508a03ba3e0e3f6 (patch) | |
tree | 031471ee357e75ac3789499b47c40bf15829fb71 /cmd | |
parent | 5d94cbd1dca78deff57b3ffc2a484cfb70579503 (diff) | |
parent | 92a1bba85761e4dd5c0647c48048423bceef4749 (diff) |
Merge tag 'clk-2022.04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-clk
Clock patches for v2022.04-rc2
This has an assortment of cleanups and the occasional bugfix. Also present
is the addition of the clock subsystem documentation to HTML docs.
CI: https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/11075
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/clk.c | 25 |
1 files changed, 6 insertions, 19 deletions
@@ -99,20 +99,6 @@ static int do_clk_dump(struct cmd_tbl *cmdtp, int flag, int argc, } #if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(CLK) -struct udevice *clk_lookup(const char *name) -{ - int i = 0; - struct udevice *dev; - - do { - uclass_get_device(UCLASS_CLK, i++, &dev); - if (!strcmp(name, dev->name)) - return dev; - } while (dev); - - return NULL; -} - static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -120,16 +106,17 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc, s32 freq; struct udevice *dev; - freq = dectoul(argv[2], NULL); + if (argc != 3) + return CMD_RET_USAGE; - dev = clk_lookup(argv[1]); + freq = dectoul(argv[2], NULL); - if (dev) + if (!uclass_get_device_by_name(UCLASS_CLK, argv[1], &dev)) clk = dev_get_clk_ptr(dev); if (!clk) { printf("clock '%s' not found.\n", argv[1]); - return -EINVAL; + return CMD_RET_FAILURE; } freq = clk_set_rate(clk, freq); @@ -173,7 +160,7 @@ static int do_clk(struct cmd_tbl *cmdtp, int flag, int argc, #ifdef CONFIG_SYS_LONGHELP static char clk_help_text[] = "dump - Print clock frequencies\n" - "setfreq [clk] [freq] - Set clock frequency"; + "clk setfreq [clk] [freq] - Set clock frequency"; #endif U_BOOT_CMD(clk, 4, 1, do_clk, "CLK sub-system", clk_help_text); |