Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/starfive regmaps #19

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

rmsyn
Copy link

@rmsyn rmsyn commented Sep 29, 2023

Adds regmap SVD files and scripts for JH7110 SoCs.

Currently, the two boards supported by these changes are the VisionFive2 v1.2a and v1.3b.

With some modification, the Pine64 Star64 board could also be supported.

Register information comes from the Preliminary Technical Reference Manual v2.

Some register information was changed due to typos in the original, and/or for clarification of duplicate register names.

Depends on #18

Generalizes the DTS parser to not rely on the presence of the
`reg-names` field to parse `reg` field in peripherals child nodes.

Instead, rely on the structure as defined by the DTS specification, i.e.
the address field is first indexed at `<address-cells> - 1`, and the
size field is second indexed at `<address-cells> + <size-cells> - 1`.

Search compatible list for `clic0`, `clint0`, and `plic0` strings, and
modifies the `script_path` to point to the relevant regmap generator.
Adds instructions for flattening DTS files that include C and/or DTSI
files.
Adds register definitions for the JH7110 PWM peripheral.

Register offsets and fields taken from the VisionFive2 SDK linux PWM
driver.
Adds logging messages to help with debugging.
Adds a script for StarFive JH7110 SYSCRG clock register definitions.
Adds a script for StarFive JH7110 STGCRG clock register definitions.
Adds a script for StarFive JH7110 TRNG hardware random number generator register definitions.
Adds a script for StarFive JH7110 AONCRG clock register definitions.
Adds a script for StarFive JH7110 SYS SYSCON register definitions.
Adds a script for StarFive JH7110 STG SYSCON register definitions.
Adds a script for StarFive JH7110 AON SYSCON register definitions.
Adds a script for StarFive JH7110 SYS IOMUX CFG register definitions.
Adds a script for StarFive JH7110 AON IOMUX CFG register definitions.
Adds a script for StarFive JH7110 PMU register definitions.
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch 2 times, most recently from 9e41bc3 to 5a34808 Compare October 8, 2023 04:46
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch 2 times, most recently from 8aafb14 to 42d2918 Compare October 16, 2023 03:22
rmsyn added 2 commits October 17, 2023 01:52
Adds a script for Synopsys Designware I2C register definitions.

Based on Linux driver at
[`linux/drivers/i2c/busses/i2c-designware-core.h`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/busses/i2c-designware-core.h)
Adds a script for ARM PL022 SPI register definitions.

Register definitions from the SSP PL022 R1P3 TRM:

<https://developer.arm.com/documentation/ddi0194/g/DDI0194G_ssp_pl022_r1p3_trm.pdf>
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch from 42d2918 to 89fcbb8 Compare October 17, 2023 01:54
rmsyn added 3 commits October 20, 2023 06:27
Adds a default `resetValue` field to registers defined with
`starfive_common/generate_register`.

Allows SVD parsers to supply a default reset value for the register.

Defaults to zero, which should be a safe reset value for most registers.
Users that require a non-zero default can supply it as an argument to
`generate_register`.
Simplifies peripheral naming to remove specific manufacturer information
from the top-level peripheral name.

This results in better output in the SVD file, which allows for more
uniform generated code.
Improves and simplifies SYS GPIO register names by clarifying peripheral
names according to functionality, instead of the provided StarFive
naming conventions. Register fields still follow StarFive naming
conventions to make following TRM documentation easier.

Fixes some errors in register definitions that were overlooked in the
original implementation. Specifically, the `FMUX` registers are split
into `GPO_DOEN`, `GPO_DOUT`, and `GPI` registers.

Adds default values to all register definitions.
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch from e5c73ce to 83b7f2d Compare October 25, 2023 05:20
Adds register definitions for Cadence QSPI-NOR controllers.
Adds register definitions for Synopsys Designware APB UART peripherals.

Register definitions from DW_apb_uart Databook:
<https://linux-sunxi.org/images/d/d2/Dw_apb_uart_db.pdf>
Uses the `generate_register` helper function to generate StarFive JH7110
`stg_syscon` peripheral registers. Renames registers to be compatible
with `svd2rust` array naming.
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch from 6a2d1f4 to 51a9ad0 Compare December 3, 2023 02:26
Adds a `resetValue` entry for PLIC peripheral registers.

This allows users to enable code generation that requires the reset
value of the registers.
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch from eceb73b to f357712 Compare December 5, 2023 05:29
rmsyn added 9 commits December 8, 2023 05:39
Renames `sys_syscon` registers for better compatibility with array
indexing. Makes some names less verbose, and adds register field
descriptions.

Changes `reset_vector` fields to single-bit entries making for easier
access in generated code.

Uses the `generate_register` helper function to define registers.
Decreases repetition, and enables resettable implementation in generated
code.
Renames `AON_SYSCON` registers with more concise names.

Uses the `generate_register` helper function to increase code re-use,
and have more uniformity in register definitions.
Uses the `generate_register` helper function to increase code re-use,
and more uniformity in register definitions.
Uses the `generate_register` helper function for all common functions to
increase code re-use, and enable reset functionality in generated code.
Simplify the names from the ones supplied in the JH7110 Technical
Reference Manual.

Uses the `generate_register` helper function to increase code re-use,
and add resettable implementations in generated code.
Adds the ability to generate an `interrupt` entry for a peripheral using
the `generate_interrrupt` helper function.

The function defines a IRQ map for given SoC(s), and does a `name`
lookup for the IRQ number.

Allows defining an IRQ enum in generated code.
Simplifies register names supplied in the JH7110 Technical Reference
manual.

Fixes errors in a previous refactor for the register offsets.
Simplifies the naming of `sys_syscon` register fields from the ones
supplied in the JH7110 Technical Reference Manual.
Further simplification of the naming for registers in the `syscrg` clock
peripheral.
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch from 1ac3250 to 8cafe9e Compare December 17, 2023 04:57
Adds register fields `size` and `resetValue` to `clint` registers to
enable resettable implementations in generated code.
Adds register fields to the `clint` peripheral registers based on the
`U74` Core Complex Manual.
Further naming simplification for `stg_syscon` peripheral registers.
Simplifies the reset field names for the `aoncrg`, `stgcrg`, and
`syscrg` peripherals.
Switches `gpo_dout` registers to index-based naming to match `gpo_doen`
registers, for consistency.
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch from a28f849 to 9380099 Compare January 21, 2024 02:42
Adds function to generate register arrays using the `dim` and
`dimIncrement` register attributes.

Adds scripts to generate JH7110 DDR memory controller CTRL and PHY
peripheral registers.
@rmsyn rmsyn force-pushed the feature/starfive-regmaps branch from 9380099 to 7e79375 Compare January 21, 2024 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant