@@ -26,8 +26,12 @@
* parent - fixed parent. No clk_set_parent support
*/
+/* resolve struct clk_fixed_rate from inner struct clk_hw member */
#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw)
+/* resolve struct clk_fixed_rate_desc from inner struct clk_desc member */
+#define to_hw_desc(_desc) container_of(_desc, struct clk_fixed_rate_desc, desc)
+
static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
@@ -82,6 +86,26 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
}
EXPORT_SYMBOL_GPL(clk_register_fixed_rate);
+struct clk_hw *clk_register_fixed_rate_desc(struct device *dev,
+ struct clk_desc *desc)
+{
+ struct clk_fixed_rate *fixed;
+ struct clk_fixed_rate_desc *hw_desc;
+
+ hw_desc = to_hw_desc(desc);
+
+ /* allocate fixed-rate clock */
+ fixed = kzalloc(sizeof(*fixed), GFP_KERNEL);
+ if (!fixed)
+ return ERR_PTR(-ENOMEM);
+
+ /* populate struct clk_fixed_rate assignments */
+ fixed->fixed_rate = hw_desc->fixed_rate;
+
+ return &fixed->hw;
+}
+EXPORT_SYMBOL_GPL(clk_register_fixed_rate_desc);
+
#ifdef CONFIG_OF
/**
* of_fixed_clk_setup() - Setup function for simple fixed rate clock
@@ -219,6 +219,21 @@ struct clk_fixed_rate {
u8 flags;
};
+/**
+ * struct clk_fixed_rate_desc - fixed-rate clock description
+ * @desc: handle between common and hardware-specific interfaces
+ * @fixed_rate: constant frequency of clock
+ * @flags: hardware-specific flags
+ */
+struct clk_fixed_rate_desc {
+ struct clk_desc desc;
+ unsigned long fixed_rate;
+ u8 flags;
+};
+
+struct clk_hw *clk_register_fixed_rate_desc(struct device *dev,
+ struct clk_desc *desc);
+
extern const struct clk_ops clk_fixed_rate_ops;
struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,