[PATCH 2/2] clk: support pinmux configuration in clock provider nodes

Nikita Yushchenko nikita.yoush at cogentembedded.com
Thu May 10 08:20:19 PDT 2018


Some device trees use pinctrl-* settings inside device tree nodes for
clock providers.

Barebox does not threat clock providers (such as fixed-clock or
gpio-gate-clock) as conventional devices, thus setting default
pinctrl configuration in driver binding code does not happen for
clock providers.

This patch adds setting default pinctrl configuration to of_clk_init(),
just before calling clock provider's probe routine.

Signed-off-by: Nikita Yushchenko <nikita.yoush at cogentembedded.com>
---
 drivers/clk/clk.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 5bb147eee..24759b45b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -22,6 +22,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/clk/clk-conf.h>
+#include <pinctrl.h>
 
 static LIST_HEAD(clks);
 
@@ -596,10 +597,12 @@ int of_clk_init(struct device_node *root, const struct of_device_id *matches)
 		list_for_each_entry_safe(clk_provider, next,
 					 &clk_provider_list, node) {
 
-			if (force || parent_ready(clk_provider->np)) {
+			struct device_node *np = clk_provider->np;
+			if (force || parent_ready(np)) {
 
-				clk_provider->clk_init_cb(clk_provider->np);
-				of_clk_set_defaults(clk_provider->np, true);
+				of_pinctrl_select_state_default(np);
+				clk_provider->clk_init_cb(np);
+				of_clk_set_defaults(np, true);
 
 				list_del(&clk_provider->node);
 				free(clk_provider);
-- 
2.11.0




More information about the barebox mailing list