diff options
author | Patrick Delaunay <patrick.delaunay@foss.st.com> | 2021-11-15 18:32:21 +0300 |
---|---|---|
committer | Patrice Chotard <patrice.chotard@foss.st.com> | 2021-11-30 18:43:28 +0300 |
commit | 77debf61ef271957515de00a78ed5486c164f850 (patch) | |
tree | afdb8ec6d141b1a8e69a83570afbe80758f891f6 /common | |
parent | 2e2e6d8cacbc80f2da0ce8f1afca5ed24020b331 (diff) | |
download | u-boot-77debf61ef271957515de00a78ed5486c164f850.tar.xz |
common: add fdt_simplefb_enable_and_mem_rsv function
Add a new function to activate an existing simple frame buffer node
and add the associated reserved memory, with no-map properties.
This device tree update is only done when the video device is active
and the video buffer is used.
This patch uses '#if CONFIG_IS_ENABLED(DM_VIDEO)' because
gd->video_bottom and gd->video_top are only defined when CONFIG_DM_VIDEO
is activated.
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/fdt_simplefb.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/common/fdt_simplefb.c b/common/fdt_simplefb.c index 32173030ab..c52846f4bc 100644 --- a/common/fdt_simplefb.c +++ b/common/fdt_simplefb.c @@ -89,3 +89,30 @@ int fdt_simplefb_enable_existing_node(void *blob) return fdt_simplefb_configure_node(blob, off); } + +#if CONFIG_IS_ENABLED(DM_VIDEO) +int fdt_simplefb_enable_and_mem_rsv(void *blob) +{ + struct fdt_memory mem; + int ret; + + /* nothing to do when video is not active */ + if (!video_is_active()) + return 0; + + ret = fdt_simplefb_enable_existing_node(blob); + if (ret) + return ret; + + /* nothing to do when the frame buffer is not defined */ + if (gd->video_bottom == gd->video_top) + return 0; + + /* reserved with no-map tag the video buffer */ + mem.start = gd->video_bottom; + mem.end = gd->video_top - 1; + + return fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL, + FDTDEC_RESERVED_MEMORY_NO_MAP); +} +#endif |