]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - include/clk.h
efi_loader: fix building crt0 on arm
[people/ms/u-boot.git] / include / clk.h
index a905a4143fada793f9f4e74f5756b5075fbf3952..a7d95d32c9185541a1df91001691198e32926bbb 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.
@@ -98,6 +98,21 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk);
  * @return 0 if OK, or a negative error code.
  */
 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)
@@ -110,6 +125,29 @@ static inline int clk_get_by_name(struct udevice *dev, const char *name,
 {
        return -ENOSYS;
 }
+
+static inline int clk_release_all(struct clk *clk, int count)
+{
+       return -ENOSYS;
+}
+
+#endif
+
+#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \
+       CONFIG_IS_ENABLED(CLK)
+/**
+ * clk_set_defaults - Process 'assigned-{clocks/clock-parents/clock-rates}'
+ *                    properties to configure clocks
+ *
+ * @dev:        A device to process (the ofnode associated with this device
+ *              will be processed).
+ */
+int clk_set_defaults(struct udevice *dev);
+#else
+static inline int clk_set_defaults(struct udevice *dev)
+{
+       return 0;
+}
 #endif
 
 /**
@@ -157,36 +195,33 @@ ulong clk_get_rate(struct clk *clk);
 ulong clk_set_rate(struct clk *clk, ulong rate);
 
 /**
- * clk_enable() - Enable (turn on) a clock.
+ * clk_set_parent() - Set current clock parent.
  *
  * @clk:       A clock struct that was previously successfully requested by
  *             clk_request/get_by_*().
- * @return zero on success, or -ve error code.
+ * @parent:    A clock struct that was previously successfully requested by
+ *             clk_request/get_by_*().
+ * @return new rate, or -ve error code.
  */
-int clk_enable(struct clk *clk);
+int clk_set_parent(struct clk *clk, struct clk *parent);
 
 /**
- * clk_disable() - Disable (turn off) a clock.
+ * clk_enable() - Enable (turn on) a clock.
  *
  * @clk:       A clock struct that was previously successfully requested by
  *             clk_request/get_by_*().
  * @return zero on success, or -ve error code.
  */
-int clk_disable(struct clk *clk);
+int clk_enable(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_disable() - Disable (turn off) a clock.
  *
- * @clk:       A clock struct array that was previously successfully
- *             requested by clk_request/get_by_*().
- * @count      Number of clock contained in the array
+ * @clk:       A clock struct that was previously successfully requested by
+ *             clk_request/get_by_*().
  * @return zero on success, or -ve error code.
  */
-int clk_release_all(struct clk *clk, int count);
+int clk_disable(struct clk *clk);
 
 int soc_clk_dump(void);