forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/clk/imx/clk-cpu.c
....@@ -1,16 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2014 Lucas Stach <l.stach@pengutronix.de>, Pengutronix
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 as
6
- * published by the Free Software Foundation.
7
- *
8
- * http://www.opensource.org/licenses/gpl-license.html
9
- * http://www.gnu.org/copyleft/gpl.html
104 */
115
126 #include <linux/clk.h>
137 #include <linux/clk-provider.h>
8
+#include <linux/export.h>
149 #include <linux/slab.h>
1510 #include "clk.h"
1611
....@@ -75,13 +70,14 @@
7570 .set_rate = clk_cpu_set_rate,
7671 };
7772
78
-struct clk *imx_clk_cpu(const char *name, const char *parent_name,
73
+struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
7974 struct clk *div, struct clk *mux, struct clk *pll,
8075 struct clk *step)
8176 {
8277 struct clk_cpu *cpu;
83
- struct clk *clk;
84
- struct clk_init_data init = {};
78
+ struct clk_hw *hw;
79
+ struct clk_init_data init;
80
+ int ret;
8581
8682 cpu = kzalloc(sizeof(*cpu), GFP_KERNEL);
8783 if (!cpu)
....@@ -94,15 +90,19 @@
9490
9591 init.name = name;
9692 init.ops = &clk_cpu_ops;
97
- init.flags = 0;
93
+ init.flags = CLK_IS_CRITICAL;
9894 init.parent_names = &parent_name;
9995 init.num_parents = 1;
10096
10197 cpu->hw.init = &init;
98
+ hw = &cpu->hw;
10299
103
- clk = clk_register(NULL, &cpu->hw);
104
- if (IS_ERR(clk))
100
+ ret = clk_hw_register(NULL, hw);
101
+ if (ret) {
105102 kfree(cpu);
103
+ return ERR_PTR(ret);
104
+ }
106105
107
- return clk;
106
+ return hw;
108107 }
108
+EXPORT_SYMBOL_GPL(imx_clk_hw_cpu);