diff options
author | Tom Rini <trini@konsulko.com> | 2018-09-30 18:16:51 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-09-30 18:16:51 -0400 |
commit | d24c1d0f4da3b081a4fedf7ae2a08790871f08d0 (patch) | |
tree | 30051c24000bbb640b6296c8a71a8e05f0cc06e4 /cmd | |
parent | 2c1e16b9d2e3a6138acf4ffd9866e47ddbe6d453 (diff) | |
parent | 31b8217e83a63d1c8c70edcdcdf5aff3b1791640 (diff) | |
download | u-boot-d24c1d0f4da3b081a4fedf7ae2a08790871f08d0.tar.gz |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/clk.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -5,11 +5,48 @@ #include <common.h> #include <command.h> #include <clk.h> +#if defined(CONFIG_DM) && defined(CONFIG_CLK) +#include <dm.h> +#include <dm/device-internal.h> +#endif int __weak soc_clk_dump(void) { +#if defined(CONFIG_DM) && defined(CONFIG_CLK) + struct udevice *dev; + struct uclass *uc; + struct clk clk; + int ret; + + /* Device addresses start at 1 */ + ret = uclass_get(UCLASS_CLK, &uc); + if (ret) + return ret; + + uclass_foreach_dev(dev, uc) { + memset(&clk, 0, sizeof(clk)); + ret = device_probe(dev); + if (ret) { + printf("%-30.30s : ? Hz\n", dev->name); + continue; + } + + ret = clk_request(dev, &clk); + if (ret) { + printf("%-30.30s : ? Hz\n", dev->name); + continue; + } + + printf("%-30.30s : %lu Hz\n", dev->name, clk_get_rate(&clk)); + + clk_free(&clk); + } + + return 0; +#else puts("Not implemented\n"); return 1; +#endif } static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc, |