Skip to content

Commit

Permalink
tools/litex_json2dts_linux: add *-endian to support csr ordering
Browse files Browse the repository at this point in the history
csr_ordering default is "big" but there was no way for software
to detect if csr_ordering was changed to "little" to match the cpu.
  • Loading branch information
Andrew Dennison committed Apr 9, 2024
1 parent c760955 commit db7f21d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions litex/tools/litex_json2dts_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic

cpu_mmu = d["constants"].get("config_cpu_mmu", None)

# CSR Parameters -------------------------------------------------------------------------------
csr_ordering = d["constants"].get("config_csr_ordering", "big")
assert csr_ordering in ["big", "little"]
dts_endian = f"{csr_ordering}-endian;"

# Header ---------------------------------------------------------------------------------------
dts = """
/dts-v1/;
Expand Down Expand Up @@ -517,6 +522,7 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
vmmc-supply = <&vreg_mmc>;
bus-width = <0x04>;
{sdcard_irq_interrupt}
{dts_endian}
status = "okay";
}};
""".format(
Expand All @@ -526,6 +532,7 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
sdcard_block2mem = d["csr_bases"]["sdcard_block2mem"],
sdcard_mem2block = d["csr_bases"]["sdcard_mem2block"],
sdcard_irq = d["csr_bases"]["sdcard_irq"],
dts_endian = dts_endian,
sdcard_irq_interrupt = "" if polling else "interrupts = <{}>;".format(d["constants"]["sdcard_irq_interrupt"])
)
# Leds -----------------------------------------------------------------------------------------
Expand Down

0 comments on commit db7f21d

Please sign in to comment.