-
Notifications
You must be signed in to change notification settings - Fork 575
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
RFC: refactor devicetree (DTS) generation (draft) #1960
Comments
It's pretty much the same for the zephyr version of this script. I believe it would be preferable, if these two scripts could be combined as it should be possible to have only minor differences between Zephyr and Linux dts files for LiteX. As for custom peripherals from separate git repos, being able to support them with the same script would be even better. As it stands, we currently have our own hard coded copy of the zephyr script that we are working with. That's probably what most do, but it makes collaboration harder and (unnecessarily) raises the entry barrier. |
Description edited, more to do |
@enjoy-digital @trabucayre this issue describes the motivation behind the changes in #1975. This is a minimal change to start dynamically generating dts content for litex cores/modules instead of hard coding in the json2dts scripts. In the future a pure python dts library like https://github.com/molejar/pyFDT may be interesting to consider as a more fully featured approach if DTS generation is moved into |
Current status
The current state of
litex_json2dts_linux.py
is just enough to generate a DTS for {linux_on_litex_vexriscv,rocket} with some of the standard devices, however it is hardcoded to just the standard litex peripherals with linux drivers and does not cater for other litex cores in separate git modules or custom peripherals. Some devices are only partially supported with mostly hard coded configuration, eg custom instances of gpio for leds and pwm for rgb_led.Motivation
To generalise the dts to cater for standard peripherals in a generic way and also support additional peripherals.
Proposal
dts
functions fromlitex.tools.litex_json2dts_zephyr
into a commonjson2dts
module: maybelitex.tools.json2dts
dts
helpersget_csr_regions_of()
get_mem_regions_of()
to extract regions from csr_bases (csr_base size by parsing car_registers) and memories.dts
functions into a JSON2DTS classlevels
for indentation to support the linux dtsdts
functions in litex.tools.litex_json2dts_linuxof
related metadata to the soc1. use
soc.add_constant()
to inject constants with a prefix of "{name}of" to provide some required dts information, for examplesoc.add_constant(name + "_of_compatible", "litex,timer")
(prototyped), OR2. add a dts specific dictionary to the soc and write this into csr.json. Some dts names such as
#gpio-cells
don't suit also being generated into c#defines
sdcard_block2mem
in soc translated toreader
in dts1. be consistent: use either
block2mem
orreader
in bothsoc
anddts
, or2, add an optional
alias
attribute for csr_regions and mem_regions that can be supplied by the soc.Status
I have some work in progress that implements the checked items above (using
soc.add_constant
) and can generate device tree entries for simple peripherals.TODO
The text was updated successfully, but these errors were encountered: