Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1426616 > unrolled thread

[PATCH v2 0/3] Convert clk-fixed into module platform driver

Started byRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
First post2016-06-20 15:50 +0200
Last post2016-06-20 15:50 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/3] Convert clk-fixed into module platform driver Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-06-20 15:50 +0200
    [PATCH v2 1/3] clk: Add new function of_clk_is_provider() Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-06-20 15:50 +0200

#1426616 — [PATCH v2 0/3] Convert clk-fixed into module platform driver

FromRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date2016-06-20 15:50 +0200
Subject[PATCH v2 0/3] Convert clk-fixed into module platform driver
Message-ID<rM7Kp-sF-3@gated-at.bofh.it>
When clock providers are added to the device tree after of_clk_init is called
they are not added to the clock provider list. This makes that drivers such
as i2c-xiic.c fail to init, as they may depend on the unadded clock provider.

We first introduce a new function clk.c that will check if a device_node is
already a clock provider or not.

Later we add two patches, one for clk-fixed-factor and another to
clk-fixed-rate that make us of that function and also convert both drivers
to module platform driver, but keeping all the previous functionality intact.

v2: Changes proposed by: Stephen Boyd <sboyd@codeaurora.org>
-Add error check
-CodeStyle on of_device_ide
-Use builtin_platform_driver()

Ricardo Ribalda Delgado (3):
  clk: Add new function of_clk_is_provider()
  clk: fixed-factor: Convert into a module platform driver
  clk: fixed-rate: Convert into a module platform driver

 drivers/clk/clk-fixed-factor.c | 75 +++++++++++++++++++++++++++++++++++++++---
 drivers/clk/clk-fixed-rate.c   | 71 ++++++++++++++++++++++++++++++++++++---
 drivers/clk/clk.c              | 20 +++++++++++
 include/linux/clk-provider.h   |  5 +++
 4 files changed, 162 insertions(+), 9 deletions(-)

-- 
2.8.1

[toc] | [next] | [standalone]


#1426617 — [PATCH v2 1/3] clk: Add new function of_clk_is_provider()

FromRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date2016-06-20 15:50 +0200
Subject[PATCH v2 1/3] clk: Add new function of_clk_is_provider()
Message-ID<rM7Kp-sF-7@gated-at.bofh.it>
In reply to#1426616
of_clk_is_provider() checks if a device_node has already been added to
the clk provider list. This can be used to avoid adding the same clock
provider twice.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
 drivers/clk/clk.c            | 20 ++++++++++++++++++++
 include/linux/clk-provider.h |  5 +++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index d584004f7af7..2423c6373906 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3120,6 +3120,26 @@ __of_clk_get_hw_from_provider(struct of_clk_provider *provider,
 	return hw;
 }
 
+/**
+ * of_clk_is_provider() - Reports if a device node is already a clk provider
+ * @np: Device node pointer under test
+ */
+bool of_clk_is_provider(struct device_node *np)
+{
+	struct of_clk_provider *cp;
+
+	mutex_lock(&of_clk_mutex);
+	list_for_each_entry(cp, &of_clk_providers, link) {
+		if (cp->node == np) {
+			mutex_unlock(&of_clk_mutex);
+			return true;
+		}
+	}
+	mutex_unlock(&of_clk_mutex);
+	return false;
+}
+EXPORT_SYMBOL_GPL(of_clk_is_provider);
+
 struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,
 				       const char *dev_id, const char *con_id)
 {
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index fb39d5add173..a01b18797418 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -787,6 +787,7 @@ int of_clk_add_hw_provider(struct device_node *np,
 						 void *data),
 			   void *data);
 void of_clk_del_provider(struct device_node *np);
+bool of_clk_is_provider(struct device_node *np);
 struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
 				  void *data);
 struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec,
@@ -819,6 +820,10 @@ static inline int of_clk_add_hw_provider(struct device_node *np,
 	return 0;
 }
 static inline void of_clk_del_provider(struct device_node *np) {}
+static inline bool of_clk_is_provider(struct device_node *np)
+{
+	return false;
+}
 static inline struct clk *of_clk_src_simple_get(
 	struct of_phandle_args *clkspec, void *data)
 {
-- 
2.8.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web