forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/clk/meson/clk-regmap.h
....@@ -26,7 +26,10 @@
2626 void *data;
2727 };
2828
29
-#define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw)
29
+static inline struct clk_regmap *to_clk_regmap(struct clk_hw *hw)
30
+{
31
+ return container_of(hw, struct clk_regmap, hw);
32
+}
3033
3134 /**
3235 * struct clk_regmap_gate_data - regmap backed gate specific data
....@@ -51,6 +54,7 @@
5154 }
5255
5356 extern const struct clk_ops clk_regmap_gate_ops;
57
+extern const struct clk_ops clk_regmap_gate_ro_ops;
5458
5559 /**
5660 * struct clk_regmap_div_data - regmap backed adjustable divider specific data
....@@ -110,4 +114,24 @@
110114 extern const struct clk_ops clk_regmap_mux_ops;
111115 extern const struct clk_ops clk_regmap_mux_ro_ops;
112116
117
+#define __MESON_PCLK(_name, _reg, _bit, _ops, _pname) \
118
+struct clk_regmap _name = { \
119
+ .data = &(struct clk_regmap_gate_data){ \
120
+ .offset = (_reg), \
121
+ .bit_idx = (_bit), \
122
+ }, \
123
+ .hw.init = &(struct clk_init_data) { \
124
+ .name = #_name, \
125
+ .ops = _ops, \
126
+ .parent_hws = (const struct clk_hw *[]) { _pname }, \
127
+ .num_parents = 1, \
128
+ .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), \
129
+ }, \
130
+}
131
+
132
+#define MESON_PCLK(_name, _reg, _bit, _pname) \
133
+ __MESON_PCLK(_name, _reg, _bit, &clk_regmap_gate_ops, _pname)
134
+
135
+#define MESON_PCLK_RO(_name, _reg, _bit, _pname) \
136
+ __MESON_PCLK(_name, _reg, _bit, &clk_regmap_gate_ro_ops, _pname)
113137 #endif /* __CLK_REGMAP_H */