.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2012 Freescale Semiconductor, Inc. |
---|
3 | 4 | * Copyright 2012 Linaro Ltd. |
---|
4 | | - * |
---|
5 | | - * The code contained herein is licensed under the GNU General Public |
---|
6 | | - * License. You may obtain a copy of the GNU General Public License |
---|
7 | | - * Version 2 or later at the following locations: |
---|
8 | | - * |
---|
9 | | - * http://www.opensource.org/licenses/gpl-license.html |
---|
10 | | - * http://www.gnu.org/copyleft/gpl.html |
---|
11 | 5 | */ |
---|
12 | 6 | |
---|
| 7 | +#include <linux/bits.h> |
---|
13 | 8 | #include <linux/clk.h> |
---|
14 | 9 | #include <linux/clk-provider.h> |
---|
15 | 10 | #include <linux/io.h> |
---|
.. | .. |
---|
78 | 73 | .set_rate = clk_busy_divider_set_rate, |
---|
79 | 74 | }; |
---|
80 | 75 | |
---|
81 | | -struct clk *imx_clk_busy_divider(const char *name, const char *parent_name, |
---|
| 76 | +struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name, |
---|
82 | 77 | void __iomem *reg, u8 shift, u8 width, |
---|
83 | 78 | void __iomem *busy_reg, u8 busy_shift) |
---|
84 | 79 | { |
---|
85 | 80 | struct clk_busy_divider *busy; |
---|
86 | | - struct clk *clk; |
---|
87 | | - struct clk_init_data init = {}; |
---|
| 81 | + struct clk_hw *hw; |
---|
| 82 | + struct clk_init_data init; |
---|
| 83 | + int ret; |
---|
88 | 84 | |
---|
89 | 85 | busy = kzalloc(sizeof(*busy), GFP_KERNEL); |
---|
90 | 86 | if (!busy) |
---|
.. | .. |
---|
107 | 103 | |
---|
108 | 104 | busy->div.hw.init = &init; |
---|
109 | 105 | |
---|
110 | | - clk = clk_register(NULL, &busy->div.hw); |
---|
111 | | - if (IS_ERR(clk)) |
---|
112 | | - kfree(busy); |
---|
| 106 | + hw = &busy->div.hw; |
---|
113 | 107 | |
---|
114 | | - return clk; |
---|
| 108 | + ret = clk_hw_register(NULL, hw); |
---|
| 109 | + if (ret) { |
---|
| 110 | + kfree(busy); |
---|
| 111 | + return ERR_PTR(ret); |
---|
| 112 | + } |
---|
| 113 | + |
---|
| 114 | + return hw; |
---|
115 | 115 | } |
---|
116 | 116 | |
---|
117 | 117 | struct clk_busy_mux { |
---|
.. | .. |
---|
152 | 152 | .set_parent = clk_busy_mux_set_parent, |
---|
153 | 153 | }; |
---|
154 | 154 | |
---|
155 | | -struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, |
---|
| 155 | +struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift, |
---|
156 | 156 | u8 width, void __iomem *busy_reg, u8 busy_shift, |
---|
157 | 157 | const char * const *parent_names, int num_parents) |
---|
158 | 158 | { |
---|
159 | 159 | struct clk_busy_mux *busy; |
---|
160 | | - struct clk *clk; |
---|
161 | | - struct clk_init_data init = {}; |
---|
| 160 | + struct clk_hw *hw; |
---|
| 161 | + struct clk_init_data init; |
---|
| 162 | + int ret; |
---|
162 | 163 | |
---|
163 | 164 | busy = kzalloc(sizeof(*busy), GFP_KERNEL); |
---|
164 | 165 | if (!busy) |
---|
.. | .. |
---|
181 | 182 | |
---|
182 | 183 | busy->mux.hw.init = &init; |
---|
183 | 184 | |
---|
184 | | - clk = clk_register(NULL, &busy->mux.hw); |
---|
185 | | - if (IS_ERR(clk)) |
---|
186 | | - kfree(busy); |
---|
| 185 | + hw = &busy->mux.hw; |
---|
187 | 186 | |
---|
188 | | - return clk; |
---|
| 187 | + ret = clk_hw_register(NULL, hw); |
---|
| 188 | + if (ret) { |
---|
| 189 | + kfree(busy); |
---|
| 190 | + return ERR_PTR(ret); |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + return hw; |
---|
189 | 194 | } |
---|