cmd: clk: Add trivial implementation of clock dump for DM
RFC PATCH 1/1 cmd: clk: Add trivial implementation of clock dump for DM
Add trivial implementation of the clk dump in case DM is enabled. This implementation just iterates over all the clock registered with the CLK uclass and prints their rate.
--- cmd/clk.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
cmd/clk.c +37 -0
@@ -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,
Signature · 1 line
2.16.2
RFC PATCH 1/1 cmd: clk: Add trivial implementation of clock dump for DM
Quoted 62 lines · Marek Vasut
Add trivial implementation of the clk dump in case DM is enabled. This implementation just iterates over all the clock registered with the CLK uclass and prints their rate.
Signed-off-by Marek Vasut <[email protected]>Cc Chin Liang See <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Ley Foon Tan <[email protected]>Cc Simon Glass <[email protected]>Cc Tom Rini <[email protected]>---
cmd/clk.c | 37 +++++++++++++++++++++++++++++++++++++1 file changed, 37 insertions(+)cmd/clk.c +4
-0@@ -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__weaksoc_clk_dump(void)
{cmd/clk.c +26
-0+#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));cmd/clk.c +6
-0+ + clk_free(&clk); + } + +return 0 ; +#else
Quoted 6 lines
puts("Not implemented\n");
return 1;
+#endif
}
static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc,
RFC PATCH 1/1 cmd: clk: Add trivial implementation of clock dump for DM
Quoted 5 lines · Ley Foon Tan
Quoted 4 lines · Marek Vasut
Add trivial implementation of the clk dump in case DM is enabled. This implementation just iterates over all the clock registered with the CLK uclass and prints their rate.
Quoted 9 lines
Quoted 9 lines
Signed-off-by Marek Vasut <[email protected]>Cc Chin Liang See <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Ley Foon Tan <[email protected]>Cc Simon Glass <[email protected]>Cc Tom Rini <[email protected]>--- cmd/clk.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
Applied to u-boot-dm, and now in mainline, thanks!