tools/litex_json2dts_linux: add compatible, model

Fixes these dt-schema validation errors:
/: 'compatible' is a required property
	from schema $id: http://devicetree.org/schemas/root-node.yaml#
/: 'model' is a required property
	from schema $id: http://devicetree.org/schemas/root-node.yaml#
This commit is contained in:
Andrew Dennison 2024-05-21 10:37:42 +10:00
parent ddc521b033
commit 5e0c3f0a04
3 changed files with 10 additions and 2 deletions

View File

@ -944,6 +944,7 @@ class SoC(LiteXModule, SoCCoreCompat):
self.sys_clk_freq = int(sys_clk_freq) # Do conversion to int here to allow passing float to SoC.
self.constants = {}
self.csr_regions = {}
self.add_constant("platform", platform.name)
# Set Top-Level to LiteXContext.
LiteXContext.top = self

View File

@ -247,6 +247,7 @@ class SoCCore(LiteXSoC):
# Add Identifier.
if ident != "":
self.add_identifier("identifier", identifier=ident, with_build_time=ident_version)
self.add_constant("identifier", ident)
# Add UARTBone.
if with_uartbone:

View File

@ -55,14 +55,20 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
cpu_mmu = d["constants"].get("config_cpu_mmu", None)
# Header ---------------------------------------------------------------------------------------
platform = d["constants"]["platform"]
dts = """
/dts-v1/;
/ {
/ {{
compatible = "litex,{platform}", "litex,soc";
model = "{identifier}";
#address-cells = <1>;
#size-cells = <1>;
"""
""".format(
platform=platform,
identifier=d["constants"].get("identifier", platform),
)
# Boot Arguments -------------------------------------------------------------------------------