diff options
author | Lee Jones <lee.jones@linaro.org> | 2016-06-06 11:56:51 -0400 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2016-06-29 15:24:52 -0400 |
commit | 40faee8ee471ae526344cd5c62ff520d356de841 (patch) | |
tree | c2158358a27a768b1fa6a0ff88949992936b14fb | |
parent | a53e35db70d1638002e40d495d096181dbb0fe16 (diff) |
reset: Supply *_shared variant calls when using of_* API
Consumers need to be able to specify whether they are requesting an
'exclusive' or 'shared' reset line no matter which API (of_*, devm_*,
etc) they are using. This change allows users of the of_* API in
particular to specify that their request is for a 'shared' line.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r-- | include/linux/reset.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/linux/reset.h b/include/linux/reset.h index 9cf4cf39bf1d..fd69240907c8 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h | |||
@@ -158,6 +158,31 @@ static inline struct reset_control *of_reset_control_get_exclusive( | |||
158 | } | 158 | } |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * of_reset_control_get_shared - Lookup and obtain an shared reference | ||
162 | * to a reset controller. | ||
163 | * @node: device to be reset by the controller | ||
164 | * @id: reset line name | ||
165 | * | ||
166 | * When a reset-control is shared, the behavior of reset_control_assert / | ||
167 | * deassert is changed, the reset-core will keep track of a deassert_count | ||
168 | * and only (re-)assert the reset after reset_control_assert has been called | ||
169 | * as many times as reset_control_deassert was called. Also see the remark | ||
170 | * about shared reset-controls in the reset_control_assert docs. | ||
171 | * | ||
172 | * Calling reset_control_assert without first calling reset_control_deassert | ||
173 | * is not allowed on a shared reset control. Calling reset_control_reset is | ||
174 | * also not allowed on a shared reset control. | ||
175 | * Returns a struct reset_control or IS_ERR() condition containing errno. | ||
176 | * | ||
177 | * Use of id names is optional. | ||
178 | */ | ||
179 | static inline struct reset_control *of_reset_control_get_shared( | ||
180 | struct device_node *node, const char *id) | ||
181 | { | ||
182 | return __of_reset_control_get(node, id, 0, 1); | ||
183 | } | ||
184 | |||
185 | /** | ||
161 | * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive | 186 | * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive |
162 | * reference to a reset controller | 187 | * reference to a reset controller |
163 | * by index. | 188 | * by index. |
@@ -175,6 +200,34 @@ static inline struct reset_control *of_reset_control_get_exclusive_by_index( | |||
175 | } | 200 | } |
176 | 201 | ||
177 | /** | 202 | /** |
203 | * of_reset_control_get_shared_by_index - Lookup and obtain an shared | ||
204 | * reference to a reset controller | ||
205 | * by index. | ||
206 | * @node: device to be reset by the controller | ||
207 | * @index: index of the reset controller | ||
208 | * | ||
209 | * When a reset-control is shared, the behavior of reset_control_assert / | ||
210 | * deassert is changed, the reset-core will keep track of a deassert_count | ||
211 | * and only (re-)assert the reset after reset_control_assert has been called | ||
212 | * as many times as reset_control_deassert was called. Also see the remark | ||
213 | * about shared reset-controls in the reset_control_assert docs. | ||
214 | * | ||
215 | * Calling reset_control_assert without first calling reset_control_deassert | ||
216 | * is not allowed on a shared reset control. Calling reset_control_reset is | ||
217 | * also not allowed on a shared reset control. | ||
218 | * Returns a struct reset_control or IS_ERR() condition containing errno. | ||
219 | * | ||
220 | * This is to be used to perform a list of resets for a device or power domain | ||
221 | * in whatever order. Returns a struct reset_control or IS_ERR() condition | ||
222 | * containing errno. | ||
223 | */ | ||
224 | static inline struct reset_control *of_reset_control_get_shared_by_index( | ||
225 | struct device_node *node, int index) | ||
226 | { | ||
227 | return __of_reset_control_get(node, NULL, index, 1); | ||
228 | } | ||
229 | |||
230 | /** | ||
178 | * devm_reset_control_get_exclusive - resource managed | 231 | * devm_reset_control_get_exclusive - resource managed |
179 | * reset_control_get_exclusive() | 232 | * reset_control_get_exclusive() |
180 | * @dev: device to be reset by the controller | 233 | * @dev: device to be reset by the controller |