Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH 0/7] rust: reset: add reset control abstractions
@ 2026-11-26 16:04 Daniel Almeida
  2026-11-26 16:04 ` [PATCH 1/7] rust: reset: add reset control helpers Daniel Almeida
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Daniel Almeida @ 2026-11-26 16:04 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Philipp Zabel
  Cc: linux-kernel, rust-for-linux, dri-devel, Detlev Casanova,
	Nicolas Dufresne

This series adds a Rust abstraction for the consumer side of the reset
controller API. A driver can get the reset lines of its device, as an
exclusive or a shared reset control, and assert and deassert them.

This will be used by the upcoming rkvenc driver that my colleagues
Detlev Casanova, Nicolas Dufresne and I are working on, to recover a
hung core of the encoder without stopping the other one. More details on
this driver can be found by watching Nicolas Dufresne's talk at LPC 2026
[0]. Samsung's Rust UFS RFC [1] also uses reset lines, through an
abstraction that it has not posted.

The abstraction follows the regulator abstraction and the clk series
[2], with the reset state as a type parameter.

Patch 1 adds the C helpers that patch 2 needs.

Patch 2 adds ExclusiveResetControl, with the Unknown, Asserted and
Deasserted states.

Patch 3 adds ExclusiveResetControl::get_array() and
get_array_optional(), which get all the reset lines of a device as one
control.

Patch 4 adds AssertedGuard, which asserts the line of an exclusive
control in the Unknown state and deasserts it when dropped, as a
convenience for drivers.

Patch 5 adds SharedResetControl, with the Unknown and Deasserted states
only, and patch 6 adds its array getters.

Patch 7 adds ExclusiveResetControl::devm_deassert() and
devm_deassert_optional(), for drivers that only need their line
deasserted while they are bound.

reset_control_reset(), the bulk API and the shared devm getters are not
covered, and there is no guard for a Deasserted control or for a shared
one. Nothing in the tree uses the abstraction yet.

Patches 1 and 2 add the two new files to the RESET CONTROLLER FRAMEWORK
entry of MAINTAINERS. Philipp, please let me know if you would rather
have them elsewhere.

This is based on v7.4-rc2.

[0]: https://www.youtube.com/watch?v=75E15eHY7ac
[1]: https://lore.kernel.org/r/20260912-rufs-private-v1-1-716db733e655@samsung.com
[2]: https://lore.kernel.org/r/20261013-clk-type-state-v6-0-a5e9977b3509@collabora.com

---
Daniel Almeida (7):
      rust: reset: add reset control helpers
      rust: reset: add ExclusiveResetControl
      rust: reset: add ExclusiveResetControl::get_array() and get_array_optional()
      rust: reset: add AssertedGuard
      rust: reset: add SharedResetControl
      rust: reset: add SharedResetControl::get_array() and get_array_optional()
      rust: reset: add devm_deassert() and devm_deassert_optional()

 MAINTAINERS                     |   2 +
 rust/bindings/bindings_helper.h |   1 +
 rust/helpers/helpers.c          |   1 +
 rust/helpers/reset.c            |  67 ++++
 rust/kernel/lib.rs              |   1 +
 rust/kernel/reset.rs            | 870 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 942 insertions(+)
---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261113-b4-rust-reset-ca5deca6e036

Best regards,
--  
Daniel Almeida <daniel.almeida@collabora.com>


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-26 19:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 16:04 [PATCH 0/7] rust: reset: add reset control abstractions Daniel Almeida
2026-11-26 16:04 ` [PATCH 1/7] rust: reset: add reset control helpers Daniel Almeida
2026-11-26 16:04 ` [PATCH 2/7] rust: reset: add ExclusiveResetControl Daniel Almeida
2026-11-26 16:04 ` [PATCH 3/7] rust: reset: add ExclusiveResetControl::get_array() and get_array_optional() Daniel Almeida
2026-11-26 16:04 ` [PATCH 4/7] rust: reset: add AssertedGuard Daniel Almeida
2026-11-26 16:04 ` [PATCH 5/7] rust: reset: add SharedResetControl Daniel Almeida
2026-11-26 19:14   ` Alice Ryhl
2026-11-26 16:04 ` [PATCH 6/7] rust: reset: add SharedResetControl::get_array() and get_array_optional() Daniel Almeida
2026-11-26 16:04 ` [PATCH 7/7] rust: reset: add devm_deassert() and devm_deassert_optional() Daniel Almeida
2026-11-26 16:33 ` [PATCH 0/7] rust: reset: add reset control abstractions Nicolas Dufresne
2026-11-26 18:02   ` Daniel Almeida
2026-11-26 18:11     ` Nicolas Dufresne
2026-11-26 18:36       ` Daniel Almeida
2026-11-26 18:46         ` Nicolas Dufresne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox