[PATCH 0/3] cmd: clk: simplify clk command

The clk command cannot provide useful output without a clock driver. So let it depend on CONFIG_CLK.
Fix the Kconfig description of the command.
As with the series the clk command is only built if CONFIG_CLK=y we can remove some #ifdefs.
Enabling the clk command on the sandbox will allow us to write tests for it.
Heinrich Schuchardt (3): cmd/Kconfig: CONFIG_CMD_CLK should depend on CONFIG_CLK cmd: clk: simplify clk command sandbox: enable clk command on the sandbox
cmd/Kconfig | 9 +++------ cmd/clk.c | 14 -------------- configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_noinst_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/sandbox_vpl_defconfig | 1 + 8 files changed, 9 insertions(+), 20 deletions(-)

The clk command cannot provide useful output without a clock driver. So let it depend on CONFIG_CLK.
Since commit 258c1002383e ("cmd: clk: Use dump function from clk_ops") the remark about deprecation is obsolete. Remove it.
Since commit 7ab418fbe612 ("clk: add support for setting clk rate from cmdline") the clk command can be used to set clock frequencies. Mention it.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- cmd/Kconfig | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/cmd/Kconfig b/cmd/Kconfig index 43f78a5aeb1..f1ab7c2cb92 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1084,13 +1084,10 @@ config CMD_BIND gadget driver from the command line.
config CMD_CLK - bool "clk - Show clock frequencies" + bool "clk - Show and set clock frequencies" + depends on CLK help - (deprecated) - Shows clock frequences by calling a sock_clk_dump() hook function. - This is depreated in favour of using the CLK uclass and accessing - clock values from associated drivers. However currently no command - exists for this. + Show and set clock frequencies managed by CLK uclass drivers.
config CMD_DEMO bool "demo - Demonstration commands for driver model"

CONFIG_DM is always true. The clk command is only built if CONFIG_CLK=y.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- cmd/clk.c | 14 -------------- 1 file changed, 14 deletions(-)
diff --git a/cmd/clk.c b/cmd/clk.c index 6fda6efb1ce..2fc834e5549 100644 --- a/cmd/clk.c +++ b/cmd/clk.c @@ -4,15 +4,12 @@ */ #include <command.h> #include <clk.h> -#if defined(CONFIG_DM) && defined(CONFIG_CLK) #include <dm.h> #include <dm/device.h> #include <dm/root.h> #include <dm/device-internal.h> #include <linux/clk-provider.h> -#endif
-#if defined(CONFIG_DM) && defined(CONFIG_CLK) static void show_clks(struct udevice *dev, int depth, int last_flag) { int i, is_last; @@ -79,13 +76,6 @@ static int soc_clk_dump(void)
return 0; } -#else -static int soc_clk_dump(void) -{ - puts("Not implemented\n"); - return 1; -} -#endif
static int do_clk_dump(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) @@ -101,7 +91,6 @@ static int do_clk_dump(struct cmd_tbl *cmdtp, int flag, int argc, return ret; }
-#if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(CLK) static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -131,13 +120,10 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc, printf("set_rate returns %u\n", freq); return 0; } -#endif
static struct cmd_tbl cmd_clk_sub[] = { U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""), -#if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(CLK) U_BOOT_CMD_MKENT(setfreq, 3, 1, do_clk_setfreq, "", ""), -#endif };
static int do_clk(struct cmd_tbl *cmdtp, int flag, int argc,

Enabling the clk command on the sandbox will allow us to write tests for it.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_noinst_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/sandbox_vpl_defconfig | 1 + 6 files changed, 6 insertions(+)
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index dd0582d2a0c..532d85ca39d 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -44,6 +44,7 @@ CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_MX_CYCLIC=y CONFIG_CMD_MEMTEST=y +CONFIG_CMD_CLK=y CONFIG_CMD_DEMO=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index a50fbce8d06..c4d74b3af71 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_MEMINFO=y CONFIG_CMD_MEM_SEARCH=y CONFIG_CMD_MX_CYCLIC=y CONFIG_CMD_MEMTEST=y +CONFIG_CMD_CLK=y CONFIG_CMD_DEMO=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPIO_READ=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 049a606613e..99839061d29 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -39,6 +39,7 @@ CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_MX_CYCLIC=y CONFIG_CMD_MEMTEST=y +CONFIG_CMD_CLK=y CONFIG_CMD_DEMO=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index eb0f064ad28..65fd07e0b3b 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -82,6 +82,7 @@ CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_MX_CYCLIC=y CONFIG_CMD_MEMTEST=y +CONFIG_CMD_CLK=y CONFIG_CMD_DEMO=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index bc6a430fa35..bb63f389d69 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -60,6 +60,7 @@ CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_MX_CYCLIC=y CONFIG_CMD_MEMTEST=y +CONFIG_CMD_CLK=y CONFIG_CMD_DEMO=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y diff --git a/configs/sandbox_vpl_defconfig b/configs/sandbox_vpl_defconfig index 96e9211bd19..fa374d69fcb 100644 --- a/configs/sandbox_vpl_defconfig +++ b/configs/sandbox_vpl_defconfig @@ -72,6 +72,7 @@ CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_MX_CYCLIC=y CONFIG_CMD_MEMTEST=y +CONFIG_CMD_CLK=y CONFIG_CMD_DEMO=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y
participants (1)
-
Heinrich Schuchardt