Hi there,
I am trying to preallocate RAM memory for framebuffer and if I understand correctly this should be done through the device tree. But if I add reg property to the mxcfb1 node the image no longer works:
mxcfb1: fb@0 {
compatible = "fsl,mxc_sdc_fb";
disp_dev = "ldb";
interface_pix_fmt = "RGB666";
default_bpp = <16>;
int_clk = <0>;
late_init = <0>;
status = "okay";
reg = <0x3f000000 0x600000>;
};
Is this because reg property is responsible for cpu internal registers? If so, how can I then preallocate RAM memory for the framebuffer?
Hello @lyashmik
You're correct that adding the reg property to the mxcfb1 node causes issues because the reg property is typically used to define register space for memory-mapped devices, not for framebuffer.
You can try add something like:
/ {
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
framebuffer_reserved: framebuffer@3f000000 {
compatible = "shared-dma-pool";
reg = <0x3f000000 0x600000>;
reusable;
};
};
};
&mxcfb1 {
memory-region = <&framebuffer_reserved>;
};
Also, could you please clarify what MPU are you using?
Best regards,
Salas.
I am using sabrelite board, so MPU is imx6q.
I've introduced what you've suggested but I think it still does not help me.
I've patched linux with a bit of debug logs. In mxc_ipuv3_fb.c in mxcfb_probe function I've added debug logs to this peace of code:
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res && res->start && res->end) {
printk(KERN_DEBUG "%s: Memory resource found: start = %d, end = %d\n",
MXCFB_NAME, res->start, res->end);
fbi->fix.smem_len = res->end - res->start + 1;
fbi->fix.smem_start = res->start;
fbi->screen_base = ioremap(fbi->fix.smem_start, fbi->fix.smem_len);
/* Do not clear the fb content drawn in bootloader. */
if (!mxcfbi->late_init)
memset(fbi->screen_base, 0, fbi->fix.smem_len);
} else {
printk(KERN_DEBUG "%s: No memory resource found\n", MXCFB_NAME);
}
And I would suppose that after changing the device tree, linux would found the resources for mxcfb1, but "No memory resource found" message is outputted.
And if we look at the debug message from mxcfb_map_video_memory function:
dev_dbg(fbi->device, "allocated fb @ paddr=0x%08X, size=%d.\n",
(uint32_t) fbi->fix.smem_start, fbi->fix.smem_len);
The address in the device tree is not seen there.
I am also wondering, if the platform lets linux know what is the start address of the allocated framebuffer by putting it into some register and linux reading this value from the register?