]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
video: simplefb: Parse memory region from memory-region property
authorAelin Reidel <aelin@mainlining.org>
Sun, 3 May 2026 19:34:53 +0000 (21:34 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 30 May 2026 13:44:08 +0000 (07:44 -0600)
Linux' simplefb driver allows setting the memory-region property to a
phandle to a node that describes the memory to be used for the
framebuffer. If it is present, it will override the "reg" property.

This adds support for parsing the property and prefers it if present.

Signed-off-by: Aelin Reidel <aelin@mainlining.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/video/simplefb.c

index 4d238b936acd4dc1bf8eb4bb1d06555c0075d71c..631ae00b1e1315a80d6ed7a925280e17e05b5d85 100644 (file)
@@ -22,8 +22,14 @@ static int simple_video_probe(struct udevice *dev)
        fdt_addr_t base;
        fdt_size_t size;
        u32 width, height, stride, rot;
+       struct ofnode_phandle_args args;
+
+       ret = dev_read_phandle_with_args(dev, "memory-region", NULL, 0, 0, &args);
+       if (ret)
+               base = dev_read_addr_size(dev, &size);
+       else
+               base = ofnode_get_addr_size(args.node, "reg", &size);
 
-       base = dev_read_addr_size(dev, &size);
        if (base == FDT_ADDR_T_NONE) {
                debug("%s: Failed to decode memory region\n", __func__);
                return -EINVAL;