blob: e7793fc0fa932ee3e41d49756e75bf829a743452 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Philipp Zabel61fc4132012-11-19 17:23:13 +01002#ifndef _LINUX_RESET_H_
3#define _LINUX_RESET_H_
4
Randy Dunlapd005aa72019-04-02 08:20:08 -07005#include <linux/err.h>
6#include <linux/errno.h>
Masahiro Yamadadfc1d9b2017-10-29 01:50:08 +09007#include <linux/types.h>
Hans de Goede6c96f052016-02-23 18:46:24 +01008
Masahiro Yamadadfc1d9b2017-10-29 01:50:08 +09009struct device;
10struct device_node;
Philipp Zabel61fc4132012-11-19 17:23:13 +010011struct reset_control;
12
Philipp Zabelb4240802014-03-07 15:18:47 +010013#ifdef CONFIG_RESET_CONTROLLER
14
Philipp Zabel61fc4132012-11-19 17:23:13 +010015int reset_control_reset(struct reset_control *rstc);
16int reset_control_assert(struct reset_control *rstc);
17int reset_control_deassert(struct reset_control *rstc);
Dinh Nguyen729de412014-10-10 10:21:14 -050018int reset_control_status(struct reset_control *rstc);
Philipp Zabelc84b0322019-02-21 16:25:53 +010019int reset_control_acquire(struct reset_control *rstc);
20void reset_control_release(struct reset_control *rstc);
Philipp Zabel61fc4132012-11-19 17:23:13 +010021
Hans de Goede6c96f052016-02-23 18:46:24 +010022struct reset_control *__of_reset_control_get(struct device_node *node,
Ramiro Oliveirabb475232017-01-13 17:57:41 +000023 const char *id, int index, bool shared,
Philipp Zabelc84b0322019-02-21 16:25:53 +010024 bool optional, bool acquired);
Philipp Zabel62e24c52016-02-05 13:41:39 +010025struct reset_control *__reset_control_get(struct device *dev, const char *id,
26 int index, bool shared,
Philipp Zabelc84b0322019-02-21 16:25:53 +010027 bool optional, bool acquired);
Philipp Zabel61fc4132012-11-19 17:23:13 +010028void reset_control_put(struct reset_control *rstc);
Masahiro Yamada1554bbd2017-10-29 01:50:06 +090029int __device_reset(struct device *dev, bool optional);
Hans de Goede6c96f052016-02-23 18:46:24 +010030struct reset_control *__devm_reset_control_get(struct device *dev,
Ramiro Oliveirabb475232017-01-13 17:57:41 +000031 const char *id, int index, bool shared,
Philipp Zabelc84b0322019-02-21 16:25:53 +010032 bool optional, bool acquired);
Philipp Zabel61fc4132012-11-19 17:23:13 +010033
Vivek Gautam17c82e22017-05-22 16:53:25 +053034struct reset_control *devm_reset_control_array_get(struct device *dev,
35 bool shared, bool optional);
36struct reset_control *of_reset_control_array_get(struct device_node *np,
Thierry Redingf31d5c22019-02-21 16:25:54 +010037 bool shared, bool optional,
38 bool acquired);
Vivek Gautam17c82e22017-05-22 16:53:25 +053039
Geert Uytterhoeveneaf91db2018-11-13 13:47:44 +010040int reset_control_get_count(struct device *dev);
41
Philipp Zabelb4240802014-03-07 15:18:47 +010042#else
43
44static inline int reset_control_reset(struct reset_control *rstc)
45{
Philipp Zabelb4240802014-03-07 15:18:47 +010046 return 0;
47}
48
49static inline int reset_control_assert(struct reset_control *rstc)
50{
Philipp Zabelb4240802014-03-07 15:18:47 +010051 return 0;
52}
53
54static inline int reset_control_deassert(struct reset_control *rstc)
55{
Philipp Zabelb4240802014-03-07 15:18:47 +010056 return 0;
57}
58
Dinh Nguyen729de412014-10-10 10:21:14 -050059static inline int reset_control_status(struct reset_control *rstc)
60{
Dinh Nguyen729de412014-10-10 10:21:14 -050061 return 0;
62}
63
Philipp Zabelc84b0322019-02-21 16:25:53 +010064static inline int reset_control_acquire(struct reset_control *rstc)
65{
66 return 0;
67}
68
69static inline void reset_control_release(struct reset_control *rstc)
70{
71}
72
Philipp Zabelb4240802014-03-07 15:18:47 +010073static inline void reset_control_put(struct reset_control *rstc)
74{
Philipp Zabelb4240802014-03-07 15:18:47 +010075}
76
Masahiro Yamada1554bbd2017-10-29 01:50:06 +090077static inline int __device_reset(struct device *dev, bool optional)
Daniel Lezcano41136522016-04-01 21:38:16 +020078{
Masahiro Yamada1554bbd2017-10-29 01:50:06 +090079 return optional ? 0 : -ENOTSUPP;
Philipp Zabelb4240802014-03-07 15:18:47 +010080}
81
Hans de Goede6c96f052016-02-23 18:46:24 +010082static inline struct reset_control *__of_reset_control_get(
83 struct device_node *node,
Ramiro Oliveirabb475232017-01-13 17:57:41 +000084 const char *id, int index, bool shared,
Philipp Zabelc84b0322019-02-21 16:25:53 +010085 bool optional, bool acquired)
Axel Lin5bcd0b72015-09-01 07:56:38 +080086{
Philipp Zabel0ca10b62017-03-20 11:25:16 +010087 return optional ? NULL : ERR_PTR(-ENOTSUPP);
Axel Lin5bcd0b72015-09-01 07:56:38 +080088}
89
Philipp Zabel62e24c52016-02-05 13:41:39 +010090static inline struct reset_control *__reset_control_get(
91 struct device *dev, const char *id,
Philipp Zabelc84b0322019-02-21 16:25:53 +010092 int index, bool shared, bool optional,
93 bool acquired)
Philipp Zabel62e24c52016-02-05 13:41:39 +010094{
95 return optional ? NULL : ERR_PTR(-ENOTSUPP);
96}
97
Hans de Goede6c96f052016-02-23 18:46:24 +010098static inline struct reset_control *__devm_reset_control_get(
Ramiro Oliveirabb475232017-01-13 17:57:41 +000099 struct device *dev, const char *id,
Philipp Zabelc84b0322019-02-21 16:25:53 +0100100 int index, bool shared, bool optional,
101 bool acquired)
Hans de Goede6c96f052016-02-23 18:46:24 +0100102{
Philipp Zabel0ca10b62017-03-20 11:25:16 +0100103 return optional ? NULL : ERR_PTR(-ENOTSUPP);
Hans de Goede6c96f052016-02-23 18:46:24 +0100104}
105
Vivek Gautam17c82e22017-05-22 16:53:25 +0530106static inline struct reset_control *
107devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
108{
109 return optional ? NULL : ERR_PTR(-ENOTSUPP);
110}
111
112static inline struct reset_control *
Thierry Redingf31d5c22019-02-21 16:25:54 +0100113of_reset_control_array_get(struct device_node *np, bool shared, bool optional,
114 bool acquired)
Vivek Gautam17c82e22017-05-22 16:53:25 +0530115{
116 return optional ? NULL : ERR_PTR(-ENOTSUPP);
117}
118
Geert Uytterhoeveneaf91db2018-11-13 13:47:44 +0100119static inline int reset_control_get_count(struct device *dev)
120{
121 return -ENOENT;
122}
123
Hans de Goede6c96f052016-02-23 18:46:24 +0100124#endif /* CONFIG_RESET_CONTROLLER */
125
Masahiro Yamada1554bbd2017-10-29 01:50:06 +0900126static inline int __must_check device_reset(struct device *dev)
127{
128 return __device_reset(dev, false);
129}
130
131static inline int device_reset_optional(struct device *dev)
132{
133 return __device_reset(dev, true);
134}
135
Hans de Goede6c96f052016-02-23 18:46:24 +0100136/**
Lee Jonesa53e35d2016-06-06 16:56:50 +0100137 * reset_control_get_exclusive - Lookup and obtain an exclusive reference
138 * to a reset controller.
Hans de Goede6c96f052016-02-23 18:46:24 +0100139 * @dev: device to be reset by the controller
140 * @id: reset line name
141 *
142 * Returns a struct reset_control or IS_ERR() condition containing errno.
Geert Uytterhoeven34845c92018-09-26 15:20:03 +0200143 * If this function is called more than once for the same reset_control it will
Hans de Goede0b522972016-02-23 18:46:26 +0100144 * return -EBUSY.
145 *
146 * See reset_control_get_shared for details on shared references to
147 * reset-controls.
Hans de Goede6c96f052016-02-23 18:46:24 +0100148 *
149 * Use of id names is optional.
150 */
Lee Jonesa53e35d2016-06-06 16:56:50 +0100151static inline struct reset_control *
152__must_check reset_control_get_exclusive(struct device *dev, const char *id)
Axel Lin5bcd0b72015-09-01 07:56:38 +0800153{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100154 return __reset_control_get(dev, id, 0, false, false, true);
155}
156
157/**
158 * reset_control_get_exclusive_released - Lookup and obtain a temoprarily
159 * exclusive reference to a reset
160 * controller.
161 * @dev: device to be reset by the controller
162 * @id: reset line name
163 *
164 * Returns a struct reset_control or IS_ERR() condition containing errno.
165 * reset-controls returned by this function must be acquired via
166 * reset_control_acquire() before they can be used and should be released
167 * via reset_control_release() afterwards.
168 *
169 * Use of id names is optional.
170 */
171static inline struct reset_control *
172__must_check reset_control_get_exclusive_released(struct device *dev,
173 const char *id)
174{
175 return __reset_control_get(dev, id, 0, false, false, false);
Axel Lin5bcd0b72015-09-01 07:56:38 +0800176}
177
Hans de Goede6c96f052016-02-23 18:46:24 +0100178/**
Hans de Goede0b522972016-02-23 18:46:26 +0100179 * reset_control_get_shared - Lookup and obtain a shared reference to a
180 * reset controller.
181 * @dev: device to be reset by the controller
182 * @id: reset line name
183 *
184 * Returns a struct reset_control or IS_ERR() condition containing errno.
185 * This function is intended for use with reset-controls which are shared
Geert Uytterhoeven12c62b92018-10-08 13:15:43 +0200186 * between hardware blocks.
Hans de Goede0b522972016-02-23 18:46:26 +0100187 *
188 * When a reset-control is shared, the behavior of reset_control_assert /
189 * deassert is changed, the reset-core will keep track of a deassert_count
190 * and only (re-)assert the reset after reset_control_assert has been called
191 * as many times as reset_control_deassert was called. Also see the remark
192 * about shared reset-controls in the reset_control_assert docs.
193 *
194 * Calling reset_control_assert without first calling reset_control_deassert
195 * is not allowed on a shared reset control. Calling reset_control_reset is
196 * also not allowed on a shared reset control.
197 *
198 * Use of id names is optional.
199 */
200static inline struct reset_control *reset_control_get_shared(
201 struct device *dev, const char *id)
202{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100203 return __reset_control_get(dev, id, 0, true, false, false);
Hans de Goede0b522972016-02-23 18:46:26 +0100204}
205
Lee Jonesa53e35d2016-06-06 16:56:50 +0100206static inline struct reset_control *reset_control_get_optional_exclusive(
Lee Jones3c35f6e2016-06-06 16:56:49 +0100207 struct device *dev, const char *id)
208{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100209 return __reset_control_get(dev, id, 0, false, true, true);
Lee Jones3c35f6e2016-06-06 16:56:49 +0100210}
211
Lee Jonesc33d61a2016-06-06 16:56:52 +0100212static inline struct reset_control *reset_control_get_optional_shared(
213 struct device *dev, const char *id)
214{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100215 return __reset_control_get(dev, id, 0, true, true, false);
Lee Jonesc33d61a2016-06-06 16:56:52 +0100216}
217
Hans de Goede0b522972016-02-23 18:46:26 +0100218/**
Lee Jonesa53e35d2016-06-06 16:56:50 +0100219 * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference
220 * to a reset controller.
Hans de Goede6c96f052016-02-23 18:46:24 +0100221 * @node: device to be reset by the controller
222 * @id: reset line name
223 *
224 * Returns a struct reset_control or IS_ERR() condition containing errno.
225 *
226 * Use of id names is optional.
227 */
Lee Jonesa53e35d2016-06-06 16:56:50 +0100228static inline struct reset_control *of_reset_control_get_exclusive(
Hans de Goede6c96f052016-02-23 18:46:24 +0100229 struct device_node *node, const char *id)
230{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100231 return __of_reset_control_get(node, id, 0, false, false, true);
Hans de Goede6c96f052016-02-23 18:46:24 +0100232}
233
234/**
Geert Uytterhoeven12c62b92018-10-08 13:15:43 +0200235 * of_reset_control_get_shared - Lookup and obtain a shared reference
Lee Jones40faee8e2016-06-06 16:56:51 +0100236 * to a reset controller.
237 * @node: device to be reset by the controller
238 * @id: reset line name
239 *
240 * When a reset-control is shared, the behavior of reset_control_assert /
241 * deassert is changed, the reset-core will keep track of a deassert_count
242 * and only (re-)assert the reset after reset_control_assert has been called
243 * as many times as reset_control_deassert was called. Also see the remark
244 * about shared reset-controls in the reset_control_assert docs.
245 *
246 * Calling reset_control_assert without first calling reset_control_deassert
247 * is not allowed on a shared reset control. Calling reset_control_reset is
248 * also not allowed on a shared reset control.
249 * Returns a struct reset_control or IS_ERR() condition containing errno.
250 *
251 * Use of id names is optional.
252 */
253static inline struct reset_control *of_reset_control_get_shared(
254 struct device_node *node, const char *id)
255{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100256 return __of_reset_control_get(node, id, 0, true, false, false);
Lee Jones40faee8e2016-06-06 16:56:51 +0100257}
258
259/**
Lee Jonesa53e35d2016-06-06 16:56:50 +0100260 * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive
261 * reference to a reset controller
262 * by index.
Hans de Goede6c96f052016-02-23 18:46:24 +0100263 * @node: device to be reset by the controller
264 * @index: index of the reset controller
265 *
266 * This is to be used to perform a list of resets for a device or power domain
267 * in whatever order. Returns a struct reset_control or IS_ERR() condition
268 * containing errno.
269 */
Lee Jonesa53e35d2016-06-06 16:56:50 +0100270static inline struct reset_control *of_reset_control_get_exclusive_by_index(
Hans de Goede6c96f052016-02-23 18:46:24 +0100271 struct device_node *node, int index)
272{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100273 return __of_reset_control_get(node, NULL, index, false, false, true);
Hans de Goede6c96f052016-02-23 18:46:24 +0100274}
275
276/**
Geert Uytterhoeven12c62b92018-10-08 13:15:43 +0200277 * of_reset_control_get_shared_by_index - Lookup and obtain a shared
Lee Jones40faee8e2016-06-06 16:56:51 +0100278 * reference to a reset controller
279 * by index.
280 * @node: device to be reset by the controller
281 * @index: index of the reset controller
282 *
283 * When a reset-control is shared, the behavior of reset_control_assert /
284 * deassert is changed, the reset-core will keep track of a deassert_count
285 * and only (re-)assert the reset after reset_control_assert has been called
286 * as many times as reset_control_deassert was called. Also see the remark
287 * about shared reset-controls in the reset_control_assert docs.
288 *
289 * Calling reset_control_assert without first calling reset_control_deassert
290 * is not allowed on a shared reset control. Calling reset_control_reset is
291 * also not allowed on a shared reset control.
292 * Returns a struct reset_control or IS_ERR() condition containing errno.
293 *
294 * This is to be used to perform a list of resets for a device or power domain
295 * in whatever order. Returns a struct reset_control or IS_ERR() condition
296 * containing errno.
297 */
298static inline struct reset_control *of_reset_control_get_shared_by_index(
299 struct device_node *node, int index)
300{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100301 return __of_reset_control_get(node, NULL, index, true, false, false);
Lee Jones40faee8e2016-06-06 16:56:51 +0100302}
303
304/**
Lee Jonesa53e35d2016-06-06 16:56:50 +0100305 * devm_reset_control_get_exclusive - resource managed
306 * reset_control_get_exclusive()
Hans de Goede6c96f052016-02-23 18:46:24 +0100307 * @dev: device to be reset by the controller
308 * @id: reset line name
309 *
Lee Jonesa53e35d2016-06-06 16:56:50 +0100310 * Managed reset_control_get_exclusive(). For reset controllers returned
311 * from this function, reset_control_put() is called automatically on driver
312 * detach.
313 *
314 * See reset_control_get_exclusive() for more information.
Hans de Goede6c96f052016-02-23 18:46:24 +0100315 */
Lee Jonesa53e35d2016-06-06 16:56:50 +0100316static inline struct reset_control *
317__must_check devm_reset_control_get_exclusive(struct device *dev,
318 const char *id)
Hans de Goede6c96f052016-02-23 18:46:24 +0100319{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100320 return __devm_reset_control_get(dev, id, 0, false, false, true);
321}
322
323/**
324 * devm_reset_control_get_exclusive_released - resource managed
325 * reset_control_get_exclusive_released()
326 * @dev: device to be reset by the controller
327 * @id: reset line name
328 *
329 * Managed reset_control_get_exclusive_released(). For reset controllers
330 * returned from this function, reset_control_put() is called automatically on
331 * driver detach.
332 *
333 * See reset_control_get_exclusive_released() for more information.
334 */
335static inline struct reset_control *
336__must_check devm_reset_control_get_exclusive_released(struct device *dev,
337 const char *id)
338{
339 return __devm_reset_control_get(dev, id, 0, false, false, false);
Philipp Zabelb4240802014-03-07 15:18:47 +0100340}
341
Hans de Goede0b522972016-02-23 18:46:26 +0100342/**
343 * devm_reset_control_get_shared - resource managed reset_control_get_shared()
344 * @dev: device to be reset by the controller
345 * @id: reset line name
346 *
347 * Managed reset_control_get_shared(). For reset controllers returned from
348 * this function, reset_control_put() is called automatically on driver detach.
349 * See reset_control_get_shared() for more information.
350 */
351static inline struct reset_control *devm_reset_control_get_shared(
352 struct device *dev, const char *id)
353{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100354 return __devm_reset_control_get(dev, id, 0, true, false, false);
Hans de Goede0b522972016-02-23 18:46:26 +0100355}
356
Lee Jonesa53e35d2016-06-06 16:56:50 +0100357static inline struct reset_control *devm_reset_control_get_optional_exclusive(
Philipp Zabelb4240802014-03-07 15:18:47 +0100358 struct device *dev, const char *id)
359{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100360 return __devm_reset_control_get(dev, id, 0, false, true, true);
Philipp Zabelb4240802014-03-07 15:18:47 +0100361}
362
Lee Jonesc33d61a2016-06-06 16:56:52 +0100363static inline struct reset_control *devm_reset_control_get_optional_shared(
364 struct device *dev, const char *id)
365{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100366 return __devm_reset_control_get(dev, id, 0, true, true, false);
Lee Jonesc33d61a2016-06-06 16:56:52 +0100367}
368
Hans de Goede6c96f052016-02-23 18:46:24 +0100369/**
Lee Jonesa53e35d2016-06-06 16:56:50 +0100370 * devm_reset_control_get_exclusive_by_index - resource managed
371 * reset_control_get_exclusive()
Hans de Goede6c96f052016-02-23 18:46:24 +0100372 * @dev: device to be reset by the controller
373 * @index: index of the reset controller
374 *
Lee Jonesa53e35d2016-06-06 16:56:50 +0100375 * Managed reset_control_get_exclusive(). For reset controllers returned from
376 * this function, reset_control_put() is called automatically on driver
377 * detach.
378 *
379 * See reset_control_get_exclusive() for more information.
Hans de Goede6c96f052016-02-23 18:46:24 +0100380 */
Lee Jonesa53e35d2016-06-06 16:56:50 +0100381static inline struct reset_control *
382devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
Hans de Goedee3ec0a82014-04-13 14:09:15 +0200383{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100384 return __devm_reset_control_get(dev, NULL, index, false, false, true);
Hans de Goede0b522972016-02-23 18:46:26 +0100385}
386
Hans de Goede0b522972016-02-23 18:46:26 +0100387/**
388 * devm_reset_control_get_shared_by_index - resource managed
Geert Uytterhoeven12c62b92018-10-08 13:15:43 +0200389 * reset_control_get_shared
Hans de Goede0b522972016-02-23 18:46:26 +0100390 * @dev: device to be reset by the controller
391 * @index: index of the reset controller
392 *
393 * Managed reset_control_get_shared(). For reset controllers returned from
394 * this function, reset_control_put() is called automatically on driver detach.
395 * See reset_control_get_shared() for more information.
396 */
Lee Jones0bcc0ea2016-06-06 16:56:53 +0100397static inline struct reset_control *
398devm_reset_control_get_shared_by_index(struct device *dev, int index)
Hans de Goede0b522972016-02-23 18:46:26 +0100399{
Philipp Zabelc84b0322019-02-21 16:25:53 +0100400 return __devm_reset_control_get(dev, NULL, index, true, false, false);
Hans de Goedee3ec0a82014-04-13 14:09:15 +0200401}
402
Lee Jonesa53e35d2016-06-06 16:56:50 +0100403/*
404 * TEMPORARY calls to use during transition:
405 *
406 * of_reset_control_get() => of_reset_control_get_exclusive()
407 *
408 * These inline function calls will be removed once all consumers
409 * have been moved over to the new explicit API.
410 */
Lee Jonesa53e35d2016-06-06 16:56:50 +0100411static inline struct reset_control *of_reset_control_get(
412 struct device_node *node, const char *id)
413{
414 return of_reset_control_get_exclusive(node, id);
415}
416
417static inline struct reset_control *of_reset_control_get_by_index(
418 struct device_node *node, int index)
419{
420 return of_reset_control_get_exclusive_by_index(node, index);
421}
422
423static inline struct reset_control *devm_reset_control_get(
424 struct device *dev, const char *id)
425{
426 return devm_reset_control_get_exclusive(dev, id);
427}
428
429static inline struct reset_control *devm_reset_control_get_optional(
430 struct device *dev, const char *id)
431{
432 return devm_reset_control_get_optional_exclusive(dev, id);
433
434}
435
436static inline struct reset_control *devm_reset_control_get_by_index(
437 struct device *dev, int index)
438{
439 return devm_reset_control_get_exclusive_by_index(dev, index);
440}
Vivek Gautam17c82e22017-05-22 16:53:25 +0530441
442/*
443 * APIs to manage a list of reset controllers
444 */
445static inline struct reset_control *
446devm_reset_control_array_get_exclusive(struct device *dev)
447{
448 return devm_reset_control_array_get(dev, false, false);
449}
450
451static inline struct reset_control *
452devm_reset_control_array_get_shared(struct device *dev)
453{
454 return devm_reset_control_array_get(dev, true, false);
455}
456
457static inline struct reset_control *
458devm_reset_control_array_get_optional_exclusive(struct device *dev)
459{
460 return devm_reset_control_array_get(dev, false, true);
461}
462
463static inline struct reset_control *
464devm_reset_control_array_get_optional_shared(struct device *dev)
465{
466 return devm_reset_control_array_get(dev, true, true);
467}
468
469static inline struct reset_control *
470of_reset_control_array_get_exclusive(struct device_node *node)
471{
Thierry Redingf31d5c22019-02-21 16:25:54 +0100472 return of_reset_control_array_get(node, false, false, true);
Vivek Gautam17c82e22017-05-22 16:53:25 +0530473}
474
475static inline struct reset_control *
Thierry Reding22815f182019-02-21 16:25:55 +0100476of_reset_control_array_get_exclusive_released(struct device_node *node)
477{
478 return of_reset_control_array_get(node, false, false, false);
479}
480
481static inline struct reset_control *
Vivek Gautam17c82e22017-05-22 16:53:25 +0530482of_reset_control_array_get_shared(struct device_node *node)
483{
Thierry Redingf31d5c22019-02-21 16:25:54 +0100484 return of_reset_control_array_get(node, true, false, true);
Vivek Gautam17c82e22017-05-22 16:53:25 +0530485}
486
487static inline struct reset_control *
488of_reset_control_array_get_optional_exclusive(struct device_node *node)
489{
Thierry Redingf31d5c22019-02-21 16:25:54 +0100490 return of_reset_control_array_get(node, false, true, true);
Vivek Gautam17c82e22017-05-22 16:53:25 +0530491}
492
493static inline struct reset_control *
494of_reset_control_array_get_optional_shared(struct device_node *node)
495{
Thierry Redingf31d5c22019-02-21 16:25:54 +0100496 return of_reset_control_array_get(node, true, true, true);
Vivek Gautam17c82e22017-05-22 16:53:25 +0530497}
Philipp Zabel61fc4132012-11-19 17:23:13 +0100498#endif