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.
This PR adds comprehensive CEC support for all devices with CEC IP and serves as a proposal for an RM-based/peripheral-based patch approach that can coexist with the current patching methodologies. This method is conducive to decreased dependence on SVD files (like stm32-rs/meta#4 proposes) and faster support for new devices in the future (#477 and #504). CEC support is added for the following RMs/devices (including devices that do not yet have a patch file and/or SVD file):
The goal of this approach is to create a self-contained definition of the CEC peripheral that can replace the sometimes-erroneous SVD definition and unify the register/field descriptions for all SVDs. The basic idea is that there is a unique YAML file in common_patches/cec for each reference manual that creates a new CEC peripheral to match that RM's description. The register and field definitions are imported from other YAML files that define the IP common to different RMs. A separate cec_delete.yaml file removes the original SVD's CEC definition. Some SVDs have a CEC definition when the device itself doesn't actually have CEC IP, so the separate delete file allows easy removal. If stm32-rs is no longer dependent on SVD files at some point in the future, then the delete file can just go away. Some code duplication could be reduced with new features in svdtools, but I haven't looked at this in-depth yet.
One aspect that doesn't really fit into this peripheral-based approach is the peripheral reset and enable fields in the RCC registers. Most SVDs already had them, but F446 needed CECRST added. F730, F7x2, and F7x3 needed CECRST removed. These were just done in the top device YAML file in the absence of a better idea.
The CEC peripheral is pretty straightforward with only two IP versions (v1 for F100 and v2 for all others), so some of the design decisions aren't applicable here but make more sense for more complicated peripherals (like the DFSDM, which I'm also working on).
I don't have a use case for the CEC or an easy way to test it, so I can't speak for the accuracy of this patch with respect to the actual silicon. However, I've reviewed the RMs and mmap diffs very thoroughly and am pretty confident in the accuracy of this patch. There are some notable differences that show up in the mmap diffs besides basic name and description changes:
I'd appreciate any feedback or suggestions for improvement on this approach, as well as any errors that I missed (or added). Absent any problems, this should be ready to merge.