.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2011-2012 Calxeda, Inc. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify it |
---|
5 | | - * under the terms and conditions of the GNU General Public License, |
---|
6 | | - * version 2, as published by the Free Software Foundation. |
---|
7 | | - * |
---|
8 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
11 | | - * more details. |
---|
12 | | - * |
---|
13 | | - * You should have received a copy of the GNU General Public License along with |
---|
14 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | 4 | */ |
---|
16 | 5 | |
---|
17 | 6 | #include <linux/kernel.h> |
---|
18 | 7 | #include <linux/slab.h> |
---|
19 | 8 | #include <linux/err.h> |
---|
20 | | -#include <linux/clk.h> |
---|
21 | 9 | #include <linux/clk-provider.h> |
---|
22 | 10 | #include <linux/io.h> |
---|
23 | 11 | #include <linux/of.h> |
---|
.. | .. |
---|
272 | 260 | .set_rate = clk_periclk_set_rate, |
---|
273 | 261 | }; |
---|
274 | 262 | |
---|
275 | | -static __init struct clk *hb_clk_init(struct device_node *node, const struct clk_ops *ops) |
---|
| 263 | +static void __init hb_clk_init(struct device_node *node, const struct clk_ops *ops, unsigned long clkflags) |
---|
276 | 264 | { |
---|
277 | 265 | u32 reg; |
---|
278 | 266 | struct hb_clk *hb_clk; |
---|
279 | 267 | const char *clk_name = node->name; |
---|
280 | 268 | const char *parent_name; |
---|
281 | | - struct clk_init_data init = {}; |
---|
| 269 | + struct clk_init_data init; |
---|
282 | 270 | struct device_node *srnp; |
---|
283 | 271 | int rc; |
---|
284 | 272 | |
---|
285 | 273 | rc = of_property_read_u32(node, "reg", ®); |
---|
286 | 274 | if (WARN_ON(rc)) |
---|
287 | | - return NULL; |
---|
| 275 | + return; |
---|
288 | 276 | |
---|
289 | 277 | hb_clk = kzalloc(sizeof(*hb_clk), GFP_KERNEL); |
---|
290 | 278 | if (WARN_ON(!hb_clk)) |
---|
291 | | - return NULL; |
---|
| 279 | + return; |
---|
292 | 280 | |
---|
293 | 281 | /* Map system registers */ |
---|
294 | 282 | srnp = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); |
---|
.. | .. |
---|
301 | 289 | |
---|
302 | 290 | init.name = clk_name; |
---|
303 | 291 | init.ops = ops; |
---|
304 | | - init.flags = 0; |
---|
| 292 | + init.flags = clkflags; |
---|
305 | 293 | parent_name = of_clk_get_parent_name(node, 0); |
---|
306 | 294 | init.parent_names = &parent_name; |
---|
307 | 295 | init.num_parents = 1; |
---|
.. | .. |
---|
311 | 299 | rc = clk_hw_register(NULL, &hb_clk->hw); |
---|
312 | 300 | if (WARN_ON(rc)) { |
---|
313 | 301 | kfree(hb_clk); |
---|
314 | | - return NULL; |
---|
| 302 | + return; |
---|
315 | 303 | } |
---|
316 | | - rc = of_clk_add_hw_provider(node, of_clk_hw_simple_get, &hb_clk->hw); |
---|
317 | | - return hb_clk->hw.clk; |
---|
| 304 | + of_clk_add_hw_provider(node, of_clk_hw_simple_get, &hb_clk->hw); |
---|
318 | 305 | } |
---|
319 | 306 | |
---|
320 | 307 | static void __init hb_pll_init(struct device_node *node) |
---|
321 | 308 | { |
---|
322 | | - hb_clk_init(node, &clk_pll_ops); |
---|
| 309 | + hb_clk_init(node, &clk_pll_ops, 0); |
---|
323 | 310 | } |
---|
324 | 311 | CLK_OF_DECLARE(hb_pll, "calxeda,hb-pll-clock", hb_pll_init); |
---|
325 | 312 | |
---|
326 | 313 | static void __init hb_a9periph_init(struct device_node *node) |
---|
327 | 314 | { |
---|
328 | | - hb_clk_init(node, &a9periphclk_ops); |
---|
| 315 | + hb_clk_init(node, &a9periphclk_ops, 0); |
---|
329 | 316 | } |
---|
330 | 317 | CLK_OF_DECLARE(hb_a9periph, "calxeda,hb-a9periph-clock", hb_a9periph_init); |
---|
331 | 318 | |
---|
332 | 319 | static void __init hb_a9bus_init(struct device_node *node) |
---|
333 | 320 | { |
---|
334 | | - struct clk *clk = hb_clk_init(node, &a9bclk_ops); |
---|
335 | | - clk_prepare_enable(clk); |
---|
| 321 | + hb_clk_init(node, &a9bclk_ops, CLK_IS_CRITICAL); |
---|
336 | 322 | } |
---|
337 | 323 | CLK_OF_DECLARE(hb_a9bus, "calxeda,hb-a9bus-clock", hb_a9bus_init); |
---|
338 | 324 | |
---|
339 | 325 | static void __init hb_emmc_init(struct device_node *node) |
---|
340 | 326 | { |
---|
341 | | - hb_clk_init(node, &periclk_ops); |
---|
| 327 | + hb_clk_init(node, &periclk_ops, 0); |
---|
342 | 328 | } |
---|
343 | 329 | CLK_OF_DECLARE(hb_emmc, "calxeda,hb-emmc-clock", hb_emmc_init); |
---|