]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - include/clk.h
usb: dwc2: convert to livetree
[people/ms/u-boot.git] / include / clk.h
index fe1f8922c68683314230c2b92ea0f98b8c249b9f..e7ce3e8576883f8e6df0d21d19347bfd9d7047be 100644 (file)
@@ -61,9 +61,9 @@ struct clk {
 };
 
 #if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
-struct phandle_2_cell;
+struct phandle_1_arg;
 int clk_get_by_index_platdata(struct udevice *dev, int index,
-                             struct phandle_2_cell *cells, struct clk *clk);
+                             struct phandle_1_arg *cells, struct clk *clk);
 
 /**
  * clock_get_by_index - Get/request a clock by integer index.
@@ -99,6 +99,40 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk);
  */
 int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk);
 
+/**
+ * clk_release_all() - Disable (turn off)/Free an array of previously
+ * requested clocks.
+ *
+ * For each clock contained in the clock array, this function will check if
+ * clock has been previously requested and then will disable and free it.
+ *
+ * @clk:       A clock struct array that was previously successfully
+ *             requested by clk_request/get_by_*().
+ * @count      Number of clock contained in the array
+ * @return zero on success, or -ve error code.
+ */
+int clk_release_all(struct clk *clk, int count);
+
+#else
+static inline int clk_get_by_index(struct udevice *dev, int index,
+                                  struct clk *clk)
+{
+       return -ENOSYS;
+}
+
+static inline int clk_get_by_name(struct udevice *dev, const char *name,
+                          struct clk *clk)
+{
+       return -ENOSYS;
+}
+
+static inline int clk_release_all(struct clk *clk, int count)
+{
+       return -ENOSYS;
+}
+
+#endif
+
 /**
  * clk_request - Request a clock by provider-specific ID.
  *
@@ -162,17 +196,5 @@ int clk_enable(struct clk *clk);
 int clk_disable(struct clk *clk);
 
 int soc_clk_dump(void);
-#else
-static inline int clk_get_by_index(struct udevice *dev, int index,
-                                  struct clk *clk)
-{
-       return -ENOSYS;
-}
 
-static inline int clk_get_by_name(struct udevice *dev, const char *name,
-                          struct clk *clk)
-{
-       return -ENOSYS;
-}
-#endif
 #endif