hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/clk/clk-highbank.c
....@@ -1,23 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * 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/>.
154 */
165
176 #include <linux/kernel.h>
187 #include <linux/slab.h>
198 #include <linux/err.h>
20
-#include <linux/clk.h>
219 #include <linux/clk-provider.h>
2210 #include <linux/io.h>
2311 #include <linux/of.h>
....@@ -272,23 +260,23 @@
272260 .set_rate = clk_periclk_set_rate,
273261 };
274262
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)
276264 {
277265 u32 reg;
278266 struct hb_clk *hb_clk;
279267 const char *clk_name = node->name;
280268 const char *parent_name;
281
- struct clk_init_data init = {};
269
+ struct clk_init_data init;
282270 struct device_node *srnp;
283271 int rc;
284272
285273 rc = of_property_read_u32(node, "reg", &reg);
286274 if (WARN_ON(rc))
287
- return NULL;
275
+ return;
288276
289277 hb_clk = kzalloc(sizeof(*hb_clk), GFP_KERNEL);
290278 if (WARN_ON(!hb_clk))
291
- return NULL;
279
+ return;
292280
293281 /* Map system registers */
294282 srnp = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
....@@ -301,7 +289,7 @@
301289
302290 init.name = clk_name;
303291 init.ops = ops;
304
- init.flags = 0;
292
+ init.flags = clkflags;
305293 parent_name = of_clk_get_parent_name(node, 0);
306294 init.parent_names = &parent_name;
307295 init.num_parents = 1;
....@@ -311,33 +299,31 @@
311299 rc = clk_hw_register(NULL, &hb_clk->hw);
312300 if (WARN_ON(rc)) {
313301 kfree(hb_clk);
314
- return NULL;
302
+ return;
315303 }
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);
318305 }
319306
320307 static void __init hb_pll_init(struct device_node *node)
321308 {
322
- hb_clk_init(node, &clk_pll_ops);
309
+ hb_clk_init(node, &clk_pll_ops, 0);
323310 }
324311 CLK_OF_DECLARE(hb_pll, "calxeda,hb-pll-clock", hb_pll_init);
325312
326313 static void __init hb_a9periph_init(struct device_node *node)
327314 {
328
- hb_clk_init(node, &a9periphclk_ops);
315
+ hb_clk_init(node, &a9periphclk_ops, 0);
329316 }
330317 CLK_OF_DECLARE(hb_a9periph, "calxeda,hb-a9periph-clock", hb_a9periph_init);
331318
332319 static void __init hb_a9bus_init(struct device_node *node)
333320 {
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);
336322 }
337323 CLK_OF_DECLARE(hb_a9bus, "calxeda,hb-a9bus-clock", hb_a9bus_init);
338324
339325 static void __init hb_emmc_init(struct device_node *node)
340326 {
341
- hb_clk_init(node, &periclk_ops);
327
+ hb_clk_init(node, &periclk_ops, 0);
342328 }
343329 CLK_OF_DECLARE(hb_emmc, "calxeda,hb-emmc-clock", hb_emmc_init);