• Home
  • Raw
  • Download

Lines Matching full:rstc

58  * @rstc: array of reset controls
63 struct reset_control *rstc[]; member
182 rstc_to_array(struct reset_control *rstc) { in rstc_to_array() argument
183 return container_of(rstc, struct reset_control_array, base); in rstc_to_array()
191 ret = reset_control_reset(resets->rstc[i]); in reset_control_array_reset()
204 ret = reset_control_assert(resets->rstc[i]); in reset_control_array_assert()
213 reset_control_deassert(resets->rstc[i]); in reset_control_array_assert()
222 ret = reset_control_deassert(resets->rstc[i]); in reset_control_array_deassert()
231 reset_control_assert(resets->rstc[i]); in reset_control_array_deassert()
235 static inline bool reset_control_is_array(struct reset_control *rstc) in reset_control_is_array() argument
237 return rstc->array; in reset_control_is_array()
242 * @rstc: reset controller
250 * If rstc is NULL it is an optional reset and the function will just
253 int reset_control_reset(struct reset_control *rstc) in reset_control_reset() argument
257 if (!rstc) in reset_control_reset()
260 if (WARN_ON(IS_ERR(rstc))) in reset_control_reset()
263 if (reset_control_is_array(rstc)) in reset_control_reset()
264 return reset_control_array_reset(rstc_to_array(rstc)); in reset_control_reset()
266 if (!rstc->rcdev->ops->reset) in reset_control_reset()
269 if (rstc->shared) { in reset_control_reset()
270 if (WARN_ON(atomic_read(&rstc->deassert_count) != 0)) in reset_control_reset()
273 if (atomic_inc_return(&rstc->triggered_count) != 1) in reset_control_reset()
277 ret = rstc->rcdev->ops->reset(rstc->rcdev, rstc->id); in reset_control_reset()
278 if (rstc->shared && ret) in reset_control_reset()
279 atomic_dec(&rstc->triggered_count); in reset_control_reset()
287 * @rstc: reset controller
299 * If rstc is NULL it is an optional reset and the function will just
302 int reset_control_assert(struct reset_control *rstc) in reset_control_assert() argument
304 if (!rstc) in reset_control_assert()
307 if (WARN_ON(IS_ERR(rstc))) in reset_control_assert()
310 if (reset_control_is_array(rstc)) in reset_control_assert()
311 return reset_control_array_assert(rstc_to_array(rstc)); in reset_control_assert()
313 if (rstc->shared) { in reset_control_assert()
314 if (WARN_ON(atomic_read(&rstc->triggered_count) != 0)) in reset_control_assert()
317 if (WARN_ON(atomic_read(&rstc->deassert_count) == 0)) in reset_control_assert()
320 if (atomic_dec_return(&rstc->deassert_count) != 0) in reset_control_assert()
327 if (!rstc->rcdev->ops->assert) in reset_control_assert()
335 if (!rstc->rcdev->ops->assert) in reset_control_assert()
339 return rstc->rcdev->ops->assert(rstc->rcdev, rstc->id); in reset_control_assert()
345 * @rstc: reset controller
352 * If rstc is NULL it is an optional reset and the function will just
355 int reset_control_deassert(struct reset_control *rstc) in reset_control_deassert() argument
357 if (!rstc) in reset_control_deassert()
360 if (WARN_ON(IS_ERR(rstc))) in reset_control_deassert()
363 if (reset_control_is_array(rstc)) in reset_control_deassert()
364 return reset_control_array_deassert(rstc_to_array(rstc)); in reset_control_deassert()
366 if (rstc->shared) { in reset_control_deassert()
367 if (WARN_ON(atomic_read(&rstc->triggered_count) != 0)) in reset_control_deassert()
370 if (atomic_inc_return(&rstc->deassert_count) != 1) in reset_control_deassert()
381 if (!rstc->rcdev->ops->deassert) in reset_control_deassert()
384 return rstc->rcdev->ops->deassert(rstc->rcdev, rstc->id); in reset_control_deassert()
392 * @rstc: reset controller
394 int reset_control_status(struct reset_control *rstc) in reset_control_status() argument
396 if (!rstc) in reset_control_status()
399 if (WARN_ON(IS_ERR(rstc)) || reset_control_is_array(rstc)) in reset_control_status()
402 if (rstc->rcdev->ops->status) in reset_control_status()
403 return rstc->rcdev->ops->status(rstc->rcdev, rstc->id); in reset_control_status()
413 struct reset_control *rstc; in __reset_control_get_internal() local
417 list_for_each_entry(rstc, &rcdev->reset_control_head, list) { in __reset_control_get_internal()
418 if (rstc->id == index) { in __reset_control_get_internal()
419 if (WARN_ON(!rstc->shared || !shared)) in __reset_control_get_internal()
422 kref_get(&rstc->refcnt); in __reset_control_get_internal()
423 return rstc; in __reset_control_get_internal()
427 rstc = kzalloc(sizeof(*rstc), GFP_KERNEL); in __reset_control_get_internal()
428 if (!rstc) in __reset_control_get_internal()
433 rstc->rcdev = rcdev; in __reset_control_get_internal()
434 list_add(&rstc->list, &rcdev->reset_control_head); in __reset_control_get_internal()
435 rstc->id = index; in __reset_control_get_internal()
436 kref_init(&rstc->refcnt); in __reset_control_get_internal()
437 rstc->shared = shared; in __reset_control_get_internal()
439 return rstc; in __reset_control_get_internal()
444 struct reset_control *rstc = container_of(kref, struct reset_control, in __reset_control_release() local
449 module_put(rstc->rcdev->owner); in __reset_control_release()
451 list_del(&rstc->list); in __reset_control_release()
452 kfree(rstc); in __reset_control_release()
455 static void __reset_control_put_internal(struct reset_control *rstc) in __reset_control_put_internal() argument
459 kref_put(&rstc->refcnt, __reset_control_release); in __reset_control_put_internal()
466 struct reset_control *rstc; in __of_reset_control_get() local
501 rstc = ERR_PTR(-EPROBE_DEFER); in __of_reset_control_get()
506 rstc = ERR_PTR(-EINVAL); in __of_reset_control_get()
512 rstc = ERR_PTR(rstc_id); in __of_reset_control_get()
517 rstc = __reset_control_get_internal(rcdev, rstc_id, shared); in __of_reset_control_get()
523 return rstc; in __of_reset_control_get()
552 struct reset_control *rstc = NULL; in __reset_control_get_from_lookup() local
575 rstc = __reset_control_get_internal(rcdev, in __reset_control_get_from_lookup()
585 if (!rstc) in __reset_control_get_from_lookup()
588 return rstc; in __reset_control_get_from_lookup()
608 __reset_control_put_internal(resets->rstc[i]); in reset_control_array_put()
615 * @rstc: reset controller
617 void reset_control_put(struct reset_control *rstc) in reset_control_put() argument
619 if (IS_ERR_OR_NULL(rstc)) in reset_control_put()
622 if (reset_control_is_array(rstc)) { in reset_control_put()
623 reset_control_array_put(rstc_to_array(rstc)); in reset_control_put()
628 __reset_control_put_internal(rstc); in reset_control_put()
642 struct reset_control **ptr, *rstc; in __devm_reset_control_get() local
649 rstc = __reset_control_get(dev, id, index, shared, optional); in __devm_reset_control_get()
650 if (!IS_ERR(rstc)) { in __devm_reset_control_get()
651 *ptr = rstc; in __devm_reset_control_get()
657 return rstc; in __devm_reset_control_get()
673 struct reset_control *rstc; in __device_reset() local
676 rstc = __reset_control_get(dev, NULL, 0, 0, optional); in __device_reset()
677 if (IS_ERR(rstc)) in __device_reset()
678 return PTR_ERR(rstc); in __device_reset()
680 ret = reset_control_reset(rstc); in __device_reset()
682 reset_control_put(rstc); in __device_reset()
728 struct reset_control *rstc; in of_reset_control_array_get() local
735 resets = kzalloc(struct_size(resets, rstc, num), GFP_KERNEL); in of_reset_control_array_get()
740 rstc = __of_reset_control_get(np, NULL, i, shared, optional); in of_reset_control_array_get()
741 if (IS_ERR(rstc)) in of_reset_control_array_get()
743 resets->rstc[i] = rstc; in of_reset_control_array_get()
753 __reset_control_put_internal(resets->rstc[i]); in of_reset_control_array_get()
758 return rstc; in of_reset_control_array_get()
780 struct reset_control *rstc; in devm_reset_control_array_get() local
787 rstc = of_reset_control_array_get(dev->of_node, shared, optional); in devm_reset_control_array_get()
788 if (IS_ERR(rstc)) { in devm_reset_control_array_get()
790 return rstc; in devm_reset_control_array_get()
793 *devres = rstc; in devm_reset_control_array_get()
796 return rstc; in devm_reset_control_array_get()