arch/risc-v/eic7700x: Add the CRG reset controller. - #20062
Open
Fishwaldo wants to merge 4 commits into
Open
Conversation
xiaoxiang781216
previously approved these changes
Sep 6, 2026
Contributor
|
@Fishwaldo please fix the conflicts |
The Clock and Reset Generator holds the reset line for every block on the SoC. This registers all 324 of them with the NuttX reset framework as a provider implementing assert, deassert, reset and status. A line is addressed as its control register index times thirty two plus its bit, across 61 registers, so the ids are sparse in a space of 1952 and decoding one is arithmetic rather than a lookup. Each register carries three masks over the same bits: which bits are lines at all, which the hardware will not let software drive, and which would take down the system that asserted them. The last are still registered and can be read and released; only assert and reset refuse them. Where each line falls, and why, is recorded beside the table. The lines are active low, which the manual never states. It is inferred from the field naming, the reset defaults and both vendor Linux drivers. If that inference is wrong then deassert asserts, so the evidence for it is written out in full rather than left as a convention. Several lines are absent from the manual, the GPIO resets at offset 0x438 among them. They were recovered from the vendor device tree and confirmed by asserting each one and watching the block stop responding. Registration writes nothing to the hardware. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac>
A peripheral held in reset reads like one that is absent, and the boot loader does not leave the same lines released on every board or every boot. One line at startup says how much is held: reset: 324 lines, 117 held Beside the clock tree's line and for the same reason: the summary is worth seeing on every boot, and the detail belongs in /proc where it can be read when it is wanted. The driver's error output is enabled, matching the clock driver. Info level is not, since nothing at that level prints on a healthy boot. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac>
Implements get_line, so /proc/reset names all 324 lines and gives the register and bit each lives in. The framework asks status() for the asserted state. The names do not survive compilation: they live in the enumeration, so without a table a listing gives only numbers, and working back from one to a peripheral means counting through the header. The table costs about 8 KiB and is built only when the procfs entry is. The ids are sparse, 324 lines across a space of 1952, so the table is sorted by id and searched rather than indexed, and an id naming no line returns -ENODEV. The framework skips those, which is what leaves the listing dense. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac>
Makes /proc/reset available, so which peripherals are held can be read while the board is running rather than only for the eight lines the startup report names. RESET_PROCFS depends on FS_PROCFS_REGISTER, which neither board set. Without it the symbol is dropped when the configuration is regenerated and the entry never appears, which is silent: the defconfig still reads as though the feature were on. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac>
Fishwaldo
force-pushed
the
eic7700x-feature-reset-pr
branch
from
September 7, 2026 14:01
e665c47 to
571167e
Compare
Contributor
Author
|
I'll have to rebase this one after my other open PR lands as this will conflict as well. |
xiaoxiang781216
approved these changes
Sep 8, 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
The Clock and Reset Generator holds the reset line for every block on the SoC,
and nothing in this port could see or move one. This registers all 324 lines
with the NuttX reset framework and lists them in
/proc/reset.arch: Add the CRG reset controller.—assert,deassert,reset,statusover 61 control registersboards: Report the reset lines at startup.— one line of boot outputarch: Name the reset lines through procfs.—get_line, so the listingcarries names
boards: Enable the reset procfs entry.— the two board configurationsDesign notes
Addressing. A line is its register index times thirty two plus its bit, so
decoding needs no table. The ids are sparse: 324 lines in a space of 1952.
Three masks per register.
validnames the bits that are lines,rdonlythose the hardware will not let software drive, and
criticalthose whoseassertion takes down the system asserting them: interconnect, DDR path, U84
cluster, and the configuration path back to this block. Critical lines are
still readable and releasable; only
assertandresetrefuse, with-EPERM.The lines are active low, which the manual never states. Inferred from the
field naming (
_rstn,_arstn,_prstn,_hrstn), the reset defaults, andboth vendor Linux drivers. Get it wrong and
deassertasserts, so the evidenceis written out beside the table. It matches the hardware:
uart0readsreleased while the console is printing.
Lines the manual omits are described rather than skipped: the GPIO resets
at
0x438, which the register table jumps straight past, and the translationbuffer and NPU E31 lines given only as reserved. Where an instance mapping is
missing, the assumption is recorded at the table row.
Registration writes nothing to the hardware.
Output
/proc/reset, abridged from 324 rows:Ids naming no line return
-ENODEVand the framework skips them, which is whatkeeps the listing dense. The name table costs about 8 KiB and is built only
when
CONFIG_RESET_PROCFSis.Testing
Booted on the ESWIN EIC7700 EVB, TFTP loaded from U-Boot.
Compiled with
-Wno-cpp -Werrorin three configurations, the reset code beingoption gated:
RESET_PROCFS=yRESET_PROCFS=nDEBUG_RESET=n,RESET_PROCFS=ytools/checkpatch.sh -c -u -m -g master..HEADpasses.CONFIG_RESET_PROCFSdepends onFS_PROCFS_REGISTER, so both boardconfigurations enable it; without it the symbol is dropped when the
configuration is regenerated and the entry never appears.