.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> |
---|
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 as published by |
---|
6 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
7 | | - * (at your option) any later version. |
---|
8 | | - * |
---|
9 | 4 | */ |
---|
10 | 5 | |
---|
11 | 6 | #include <linux/clk-provider.h> |
---|
.. | .. |
---|
16 | 11 | #include <linux/regmap.h> |
---|
17 | 12 | |
---|
18 | 13 | #include "pmc.h" |
---|
19 | | - |
---|
20 | | -#define SMD_SOURCE_MAX 2 |
---|
21 | 14 | |
---|
22 | 15 | #define SMD_DIV_SHIFT 8 |
---|
23 | 16 | #define SMD_MAX_DIV 0xf |
---|
.. | .. |
---|
111 | 104 | .set_rate = at91sam9x5_clk_smd_set_rate, |
---|
112 | 105 | }; |
---|
113 | 106 | |
---|
114 | | -static struct clk_hw * __init |
---|
| 107 | +struct clk_hw * __init |
---|
115 | 108 | at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name, |
---|
116 | 109 | const char **parent_names, u8 num_parents) |
---|
117 | 110 | { |
---|
118 | 111 | struct at91sam9x5_clk_smd *smd; |
---|
119 | 112 | struct clk_hw *hw; |
---|
120 | | - struct clk_init_data init = {}; |
---|
| 113 | + struct clk_init_data init; |
---|
121 | 114 | int ret; |
---|
122 | 115 | |
---|
123 | 116 | smd = kzalloc(sizeof(*smd), GFP_KERNEL); |
---|
.. | .. |
---|
142 | 135 | |
---|
143 | 136 | return hw; |
---|
144 | 137 | } |
---|
145 | | - |
---|
146 | | -static void __init of_at91sam9x5_clk_smd_setup(struct device_node *np) |
---|
147 | | -{ |
---|
148 | | - struct clk_hw *hw; |
---|
149 | | - unsigned int num_parents; |
---|
150 | | - const char *parent_names[SMD_SOURCE_MAX]; |
---|
151 | | - const char *name = np->name; |
---|
152 | | - struct regmap *regmap; |
---|
153 | | - |
---|
154 | | - num_parents = of_clk_get_parent_count(np); |
---|
155 | | - if (num_parents == 0 || num_parents > SMD_SOURCE_MAX) |
---|
156 | | - return; |
---|
157 | | - |
---|
158 | | - of_clk_parent_fill(np, parent_names, num_parents); |
---|
159 | | - |
---|
160 | | - of_property_read_string(np, "clock-output-names", &name); |
---|
161 | | - |
---|
162 | | - regmap = syscon_node_to_regmap(of_get_parent(np)); |
---|
163 | | - if (IS_ERR(regmap)) |
---|
164 | | - return; |
---|
165 | | - |
---|
166 | | - hw = at91sam9x5_clk_register_smd(regmap, name, parent_names, |
---|
167 | | - num_parents); |
---|
168 | | - if (IS_ERR(hw)) |
---|
169 | | - return; |
---|
170 | | - |
---|
171 | | - of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); |
---|
172 | | -} |
---|
173 | | -CLK_OF_DECLARE(at91sam9x5_clk_smd, "atmel,at91sam9x5-clk-smd", |
---|
174 | | - of_at91sam9x5_clk_smd_setup); |
---|