unsigned int count;
};
-#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
struct phandle_1_arg;
+
+#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
/**
* clk_get_by_phandle() - Get a clock by its phandle information (of-platadata)
* @dev: Device containing the phandle
void devm_clk_put(struct udevice *dev, struct clk *clk);
#else
+
+static inline int clk_get_by_phandle(struct udevice *dev, const
+ struct phandle_1_arg *cells,
+ struct clk *clk)
+{
+ return -ENOSYS;
+}
+
static inline int clk_get_by_index(struct udevice *dev, int index,
struct clk *clk)
{
return -ENOSYS;
}
+static inline int clk_get_by_index_nodev(ofnode node, int index,
+ struct clk *clk)
+{
+ return -ENOSYS;
+}
+
static inline int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk)
{
return -ENOSYS;
return -ENOSYS;
}
+static inline struct clk *devm_clk_get(struct udevice *dev, const char *id)
+{
+ return ERR_PTR(-ENOSYS);
+}
+
+static inline struct clk *devm_clk_get_optional(struct udevice *dev,
+ const char *id)
+{
+ return ERR_PTR(-ENOSYS);
+}
+
static inline int
clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk)
{
{
return -ENOSYS;
}
+
+static inline void devm_clk_put(struct udevice *dev, struct clk *clk)
+{
+}
#endif
/**
+ * clk_get_by_name_optional() - Get/request a optional clock by name.
+ * @dev: The client device.
+ * @name: The name of the clock to request, within the client's list of
+ * clocks.
+ * @clk: A pointer to a clock struct to initialize.
+ *
+ * Behaves the same as clk_get_by_name(), except when there is no clock
+ * provider. In the latter case, return 0.
+ *
+ * Return: 0 if OK, or a negative error code.
+ */
+static inline int clk_get_by_name_optional(struct udevice *dev,
+ const char *name, struct clk *clk)
+{
+ int ret;
+
+ ret = clk_get_by_name(dev, name, clk);
+ if (ret == -ENODATA)
+ return 0;
+
+ return ret;
+}
+
+/**
* clk_get_by_name_nodev_optional - Get/request an optinonal clock by name
* without a device.
* @node: The client ofnode.
* @clk: A clock struct that was previously successfully requested by
* clk_request/get_by_*().
*
- * Return: 0 if OK, or a negative error code.
+ * Free resources allocated by clk_request() (or any clk_get_* function).
*/
-int clk_free(struct clk *clk);
+void clk_free(struct clk *clk);
/**
* clk_get_rate() - Get current clock rate.
*
* Return: clock rate in Hz, or -ve error code.
*/
-long long clk_get_parent_rate(struct clk *clk);
+ulong clk_get_parent_rate(struct clk *clk);
/**
* clk_round_rate() - Adjust a rate to the exact rate a clock can provide
return -ENOSYS;
}
-static inline int clk_free(struct clk *clk)
+static inline void clk_free(struct clk *clk)
{
- return 0;
+ return;
}
static inline ulong clk_get_rate(struct clk *clk)
return ERR_PTR(-ENOSYS);
}
-static inline long long clk_get_parent_rate(struct clk *clk)
+static inline ulong clk_get_parent_rate(struct clk *clk)
{
return -ENOSYS;
}