.. | .. |
---|
| 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> |
---|
.. | .. |
---|
39 | 34 | |
---|
40 | 35 | regmap_read(regmap, AT91_PMC_SR, &status); |
---|
41 | 36 | |
---|
42 | | - return status & (1 << id) ? 1 : 0; |
---|
| 37 | + return !!(status & (1 << id)); |
---|
43 | 38 | } |
---|
44 | 39 | |
---|
45 | 40 | static int clk_system_prepare(struct clk_hw *hw) |
---|
.. | .. |
---|
79 | 74 | |
---|
80 | 75 | regmap_read(sys->regmap, AT91_PMC_SR, &status); |
---|
81 | 76 | |
---|
82 | | - return status & (1 << sys->id) ? 1 : 0; |
---|
| 77 | + return !!(status & (1 << sys->id)); |
---|
83 | 78 | } |
---|
84 | 79 | |
---|
85 | 80 | static const struct clk_ops system_ops = { |
---|
.. | .. |
---|
88 | 83 | .is_prepared = clk_system_is_prepared, |
---|
89 | 84 | }; |
---|
90 | 85 | |
---|
91 | | -static struct clk_hw * __init |
---|
| 86 | +struct clk_hw * __init |
---|
92 | 87 | at91_clk_register_system(struct regmap *regmap, const char *name, |
---|
93 | 88 | const char *parent_name, u8 id) |
---|
94 | 89 | { |
---|
95 | 90 | struct clk_system *sys; |
---|
96 | 91 | struct clk_hw *hw; |
---|
97 | | - struct clk_init_data init = {}; |
---|
| 92 | + struct clk_init_data init; |
---|
98 | 93 | int ret; |
---|
99 | 94 | |
---|
100 | 95 | if (!parent_name || id > SYSTEM_MAX_ID) |
---|
.. | .. |
---|
123 | 118 | |
---|
124 | 119 | return hw; |
---|
125 | 120 | } |
---|
126 | | - |
---|
127 | | -static void __init of_at91rm9200_clk_sys_setup(struct device_node *np) |
---|
128 | | -{ |
---|
129 | | - int num; |
---|
130 | | - u32 id; |
---|
131 | | - struct clk_hw *hw; |
---|
132 | | - const char *name; |
---|
133 | | - struct device_node *sysclknp; |
---|
134 | | - const char *parent_name; |
---|
135 | | - struct regmap *regmap; |
---|
136 | | - |
---|
137 | | - num = of_get_child_count(np); |
---|
138 | | - if (num > (SYSTEM_MAX_ID + 1)) |
---|
139 | | - return; |
---|
140 | | - |
---|
141 | | - regmap = syscon_node_to_regmap(of_get_parent(np)); |
---|
142 | | - if (IS_ERR(regmap)) |
---|
143 | | - return; |
---|
144 | | - |
---|
145 | | - for_each_child_of_node(np, sysclknp) { |
---|
146 | | - if (of_property_read_u32(sysclknp, "reg", &id)) |
---|
147 | | - continue; |
---|
148 | | - |
---|
149 | | - if (of_property_read_string(np, "clock-output-names", &name)) |
---|
150 | | - name = sysclknp->name; |
---|
151 | | - |
---|
152 | | - parent_name = of_clk_get_parent_name(sysclknp, 0); |
---|
153 | | - |
---|
154 | | - hw = at91_clk_register_system(regmap, name, parent_name, id); |
---|
155 | | - if (IS_ERR(hw)) |
---|
156 | | - continue; |
---|
157 | | - |
---|
158 | | - of_clk_add_hw_provider(sysclknp, of_clk_hw_simple_get, hw); |
---|
159 | | - } |
---|
160 | | -} |
---|
161 | | -CLK_OF_DECLARE(at91rm9200_clk_sys, "atmel,at91rm9200-clk-system", |
---|
162 | | - of_at91rm9200_clk_sys_setup); |
---|