.. | .. |
---|
26 | 26 | void *data; |
---|
27 | 27 | }; |
---|
28 | 28 | |
---|
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 | +} |
---|
30 | 33 | |
---|
31 | 34 | /** |
---|
32 | 35 | * struct clk_regmap_gate_data - regmap backed gate specific data |
---|
.. | .. |
---|
51 | 54 | } |
---|
52 | 55 | |
---|
53 | 56 | extern const struct clk_ops clk_regmap_gate_ops; |
---|
| 57 | +extern const struct clk_ops clk_regmap_gate_ro_ops; |
---|
54 | 58 | |
---|
55 | 59 | /** |
---|
56 | 60 | * struct clk_regmap_div_data - regmap backed adjustable divider specific data |
---|
.. | .. |
---|
110 | 114 | extern const struct clk_ops clk_regmap_mux_ops; |
---|
111 | 115 | extern const struct clk_ops clk_regmap_mux_ro_ops; |
---|
112 | 116 | |
---|
| 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) |
---|
113 | 137 | #endif /* __CLK_REGMAP_H */ |
---|