Merge pull request #1973 from motec-research/dts_schema_compliance

Dts schema compliance
This commit is contained in:
enjoy-digital 2024-05-30 09:16:01 +02:00 committed by GitHub
commit d9332da433
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 3 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 -------------------------------------------------------------------------------
@ -161,6 +167,7 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
tlb_desc = ""
if "config_cpu_dtlb_size" in d["constants"]:
tlb_desc += """
tlb-split;
d-tlb-size = <{d_tlb_size}>;
d-tlb-sets = <{d_tlb_ways}>;
""".format(
@ -181,7 +188,6 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
next-level-cache = <&memory>;
riscv,pmpgranularity = <4>;
riscv,pmpregions = <8>;
tlb-split;
"""
else:
extra_attr = ""