From dac6c1cbb19f737329b6b5e277bfc9c0fea13d4b Mon Sep 17 00:00:00 2001 From: Romain Dolbeau Date: Tue, 6 Apr 2021 13:44:50 +0200 Subject: [PATCH] json2dts: add the framebuffer memory in the 'reserved-memory' entry, so that Linux doesn't try to use it for something else. --- litex/tools/litex_json2dts.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/litex/tools/litex_json2dts.py b/litex/tools/litex_json2dts.py index 8eeb325c7..bb68e0f4f 100755 --- a/litex/tools/litex_json2dts.py +++ b/litex/tools/litex_json2dts.py @@ -115,19 +115,33 @@ def generate_dts(d, initrd_start=None, initrd_size=None, polling=False): main_ram_base = d["memories"]["main_ram"]["base"], main_ram_size = d["memories"]["main_ram"]["size"]) - if "opensbi" in d["memories"]: + if (("opensbi" in d["memories"]) or ("video_framebuffer" in d["csr_bases"])): dts += """ - reserved-memory {{ + reserved-memory { #address-cells = <1>; #size-cells = <1>; ranges; +""" + if "opensbi" in d["memories"]: + dts += """ opensbi@{opensbi_base:x} {{ reg = <0x{opensbi_base:x} 0x{opensbi_size:x}>; }}; - }}; """.format( opensbi_base = d["memories"]["opensbi"]["base"], opensbi_size = d["memories"]["opensbi"]["size"]) + if "video_framebuffer" in d["csr_bases"]: + dts += """ + framebuffer@f0000000 {{ + reg = <0x{framebuffer_base:x} 0x{framebuffer_size:x}>; + }}; +""".format( + framebuffer_base = d["constants"]["video_framebuffer_base"], + framebuffer_size = (d["constants"]["video_framebuffer_hres"] * d["constants"]["video_framebuffer_vres"] * 4)) + + dts += """ + }; +""" # SoC ------------------------------------------------------------------------------------------