drivers/reset: Add line read-back and a procfs entry - #19876
Open
Fishwaldo wants to merge 1 commit into
Open
Conversation
Fishwaldo
requested review from
Donny9,
jerpelea and
raiden00pl
as code owners
August 17, 2026 04:21
|
jerpelea
previously approved these changes
Aug 17, 2026
Fishwaldo
force-pushed
the
upstream-reset-procfs
branch
from
August 17, 2026 12:26
de266b5 to
b6c445d
Compare
status() reads one reset line at a time, and only for a caller that already knows the id. Nothing else in the interface says how many lines a controller has or what any of them resets, so the lines a board is holding cannot be surveyed. Adds an optional get_line method describing one line as a structure: its name, and a text member for controller specific fields the structure does not cover. The asserted state stays with status(), which already reports it, so a controller does not supply the same fact twice. Returning -ENODEV reports an id that names no line, which is how controllers with gaps in their numbering are handled. reset_controller_dev gains the line count that bounds the ids. CONFIG_RESET_PROCFS adds /proc/reset, one key:value line per reset line, every line the same tokens in the same order so the file is machine parseable. A controller without get_line is listed by name and a note. The controller list already existed for reset_control_get() to search, so the renderer only walks what was there. /proc/reset is claimed when the first controller registers; procfs_register() requires that procfs is not yet mounted, which holds because controllers register during board or architecture start up, and it appends without checking for duplicates, so the entry is claimed once for the lifetime of the system. Documents the framework, which had a page with nothing on it: the consumer interface and what shared and exclusive handles mean, the controller interface, the new method, and /proc/reset. Off by default and costs nothing when off. No in-tree configuration enables RESET, so this builds only when a board turns it on. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac>
Fishwaldo
force-pushed
the
upstream-reset-procfs
branch
from
August 17, 2026 12:27
b6c445d to
815cc35
Compare
xiaoxiang781216
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
/proc/reset, which lists every reset line a board's controllers have andwhether each one is currently asserted or released.
There was no way to see that.
status()reads one line at a time, and only fora caller that already knows its id; nothing else in the interface says how many
lines a controller has or what any of them resets. During bring up that is the
question that matters, since a peripheral that appears dead is often just still
in reset.
The file is rendered from a new optional
get_linemethod, underCONFIG_RESET_PROCFS. Every line carries the samekey:valuetokens in thesame order, so the file can be parsed as well as read.
It also fixes an existing hazard in the function it modifies:
procfs_register()appends without checking for duplicates, so registering acontroller after all of them had unregistered would have added
/proc/resetasecond time. The entry is now claimed once for the lifetime of the system.
The state deliberately stays with
status(), which already reports it — theframework calls it, so a controller never supplies the same fact twice.
get_linesupplies only what the framework cannot derive:Everything is optional. A controller without
get_lineis listed by nameand a note. Both members may be left empty, and a line then reports by id
alone.
extracarries whatever the structure has no member for.Controllers commonly leave gaps in their numbering, so
nlinesinstruct reset_controller_devbounds the idsget_lineis asked about ratherthan counting real lines — for a controller with dense numbering the two are
the same, which is why it is not called
maxid. Returning-ENODEVreports anid that names no line, and the renderer skips those, which is what keeps the
listing dense:
This follows the shape of the pinctrl read-back in #19871, so the two procfs
entries agree on how a controller describes itself.
Documentation/components/drivers/special/reset.rsthad a title and nocontent. It now documents the framework: the consumer interface and what
shared and exclusive handles mean, the controller interface and its call
table, the new method, and
/proc/reset.Impact
New feature, off by default.
CONFIG_RESET_PROCFSdepends onFS_PROCFS_REGISTER; with it unset nothing here is compiled.struct reset_control_opsgains one optional member andstruct reset_controller_devgainsnlines. The only in-tree controller isdrivers/reset/reset_rpmsg.c, which is unaffected: it allocates its controllerwith
kmm_zalloc(), so the new field is zero and the new method NULL, and itis listed with its note.
No change to the existing operations or their behaviour.
Worth flagging to reviewers: no in-tree configuration enables
CONFIG_RESET,so CI will not compile this code. A green run says nothing about it, and the
testing below is the only evidence.
Testing
Host: macOS 26.5.1 (arm64),
riscv-none-elf-gcc15.2.0, Sphinx 6.2.1.Build, since CI cannot:
sim:nshwithRESET,FS_PROCFS,FS_PROCFS_REGISTERandRESET_PROCFSforced on compilesdrivers/reset/core.cclean; also built with
RESET_PROCFSoff. Documentation builds with no newwarnings.
Hardware: ESWIN EIC7700 EVB (EIC7700X, 4 x RV64GC). The consumer is the
EIC7700X CRG reset driver, part of a port being upstreamed separately; this
PR is deliberately independent of it and adds no in-tree user.
Note 16 → 32 → 36 → 64: that controller is a good exercise of the sparse case,
1628 of its 1952 ids naming nothing, and the gaps are skipped rather than
printed.
Checked on that output:
skipped, none of the 1628 empty ids printed
many times one read buffer, so this exercises the
posaccounting acrossrepeated
read()callsstate:column verified against the hardware: 107 of the lines fallin registers I read independently over JTAG while the board was running, and
all 107 agree with the register bits (active low, so a set bit reads
released) — 0 mismatchesread
state:assertedthroughout, and nothing has brought either out of resetA controller without
get_linewas checked by removing the method: thecontroller is listed with its note and no lines.