Search code examples
linux-device-driverframebufferdevice-treezynq

Simple framebuffer in device-tree


I have been trying to setup simple framebuffer on a device, and I am having problems with the device tree. Currently I have it setup pretty much as it is in the documentation:

chosen {
    #address-cells = <1>;
    #size-cells = <1>;

    framebuffer0: framebuffer@1817000
    {
            compatible = "simple-framebuffer";
            reg = <0x1817000 (1920*1080*4)>;
            width = <1920>;
            height = <1080>;
            stride = <(1920*4)>;
            format = "a8b8g8r8";
    };

};

During boot, the error I get is:

simple-framebuffer chosen:framebuffer@1817000: No memory resource
simple-framebuffer: probe of chosen:framebuffer@1817000 failed with error -22

From the simplefb code I see that it fails on the following:

  mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  if (!mem) {
          dev_err(&pdev->dev, "No memory resource\n");
          return -EINVAL;
  }

Several internet sources tell that IORESOURCE_MEM is the reg property, and it is defined so I am baffled about what could be wrong.


Solution

  • I had a similar issue I added ranges; and status= "okay" and it worked for me. Zynq as well.

    chosen {
        #address-cells = <0x1>;
        #size-cells = <0x1>;
        ranges;
        framebuffer0: framebuffer@1817000
        {
                compatible = "simple-framebuffer";
                reg = <0x1817000 (1920*1080*4)>;
                width = <1920>;
                height = <1080>;
                stride = <(1920*4)>;
                format = "a8b8g8r8";
                status = "okay"
        };
    
    };