diff options
Diffstat (limited to 'drivers/clk/hisilicon/clk.c')
-rw-r--r-- | drivers/clk/hisilicon/clk.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c index 276f672e7b1a..a078e84f7b05 100644 --- a/drivers/clk/hisilicon/clk.c +++ b/drivers/clk/hisilicon/clk.c | |||
@@ -127,11 +127,14 @@ void __init hisi_clk_register_mux(struct hisi_mux_clock *clks, | |||
127 | int i; | 127 | int i; |
128 | 128 | ||
129 | for (i = 0; i < nums; i++) { | 129 | for (i = 0; i < nums; i++) { |
130 | clk = clk_register_mux(NULL, clks[i].name, clks[i].parent_names, | 130 | u32 mask = BIT(clks[i].width) - 1; |
131 | clks[i].num_parents, clks[i].flags, | 131 | |
132 | base + clks[i].offset, clks[i].shift, | 132 | clk = clk_register_mux_table(NULL, clks[i].name, |
133 | clks[i].width, clks[i].mux_flags, | 133 | clks[i].parent_names, |
134 | &hisi_clk_lock); | 134 | clks[i].num_parents, clks[i].flags, |
135 | base + clks[i].offset, clks[i].shift, | ||
136 | mask, clks[i].mux_flags, | ||
137 | clks[i].table, &hisi_clk_lock); | ||
135 | if (IS_ERR(clk)) { | 138 | if (IS_ERR(clk)) { |
136 | pr_err("%s: failed to register clock %s\n", | 139 | pr_err("%s: failed to register clock %s\n", |
137 | __func__, clks[i].name); | 140 | __func__, clks[i].name); |
@@ -174,6 +177,34 @@ void __init hisi_clk_register_divider(struct hisi_divider_clock *clks, | |||
174 | } | 177 | } |
175 | } | 178 | } |
176 | 179 | ||
180 | void __init hisi_clk_register_gate(struct hisi_gate_clock *clks, | ||
181 | int nums, struct hisi_clock_data *data) | ||
182 | { | ||
183 | struct clk *clk; | ||
184 | void __iomem *base = data->base; | ||
185 | int i; | ||
186 | |||
187 | for (i = 0; i < nums; i++) { | ||
188 | clk = clk_register_gate(NULL, clks[i].name, | ||
189 | clks[i].parent_name, | ||
190 | clks[i].flags, | ||
191 | base + clks[i].offset, | ||
192 | clks[i].bit_idx, | ||
193 | clks[i].gate_flags, | ||
194 | &hisi_clk_lock); | ||
195 | if (IS_ERR(clk)) { | ||
196 | pr_err("%s: failed to register clock %s\n", | ||
197 | __func__, clks[i].name); | ||
198 | continue; | ||
199 | } | ||
200 | |||
201 | if (clks[i].alias) | ||
202 | clk_register_clkdev(clk, clks[i].alias, NULL); | ||
203 | |||
204 | data->clk_data.clks[clks[i].id] = clk; | ||
205 | } | ||
206 | } | ||
207 | |||
177 | void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *clks, | 208 | void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *clks, |
178 | int nums, struct hisi_clock_data *data) | 209 | int nums, struct hisi_clock_data *data) |
179 | { | 210 | { |