From 462016a1d0803566657f0cbc47cab1e4d2f9aec4 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 24 Jun 2024 13:01:18 +0200 Subject: [PATCH] litex/tools/litex_json2dts_linux: Add initial CAN support. --- litex/tools/litex_json2dts_linux.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/litex/tools/litex_json2dts_linux.py b/litex/tools/litex_json2dts_linux.py index 08e9c0e8a..8d5e7f8c1 100755 --- a/litex/tools/litex_json2dts_linux.py +++ b/litex/tools/litex_json2dts_linux.py @@ -633,6 +633,25 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic }}; """.format(xadc_csr_base=d["csr_bases"]["xadc"]) + # CAN ------------------------------------------------------------------------------------------ + + for mem in d["memories"]: + if "can" in mem: + dts += """ + {name}: can@{can_mem_base:x} {{ + compatible = "ctu,ctucanfd"; + reg = <0x{can_mem_base:x} 0x{can_mem_size:x}>; + interrupt-parent = <&intc0>; + interrupts = <{can_interrupt}>; + clocks = <&sys_clk>; + status = "okay"; + }}; +""".format(name=mem, + can_mem_base=d["memories"][mem]["base"], + can_mem_size=d["memories"][mem]["size"], + can_interrupt = int(d["constants"][f"{mem}_interrupt"]), + ) + # Framebuffer ---------------------------------------------------------------------------------- if "video_framebuffer" in d["csr_bases"]: