We do not do cache maintenance for framebuffers and expect that memory
is mapped suitably, either writecombine or uncached (coherent).

The simplefb-client was first added to barebox for a cache-coherent
platform and did not observe this requirement.

To enable its use on ARM as well without graphic artifacts, let's remap
the range as writecombine, which will fall back to uncached if
unsupported.

Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
---
 drivers/video/simplefb-client.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/video/simplefb-client.c b/drivers/video/simplefb-client.c
index dafec6178fe6..1c0ee3e7d426 100644
--- a/drivers/video/simplefb-client.c
+++ b/drivers/video/simplefb-client.c
@@ -18,6 +18,7 @@
 #include <linux/platform_data/simplefb.h>
 #include <driver.h>
 #include <of.h>
+#include <mmu.h>
 
 static struct fb_ops simplefb_ops;
 
@@ -119,6 +120,11 @@ static int simplefb_probe(struct device *dev)
        info->screen_base = (void *)mem->start;
        info->screen_size = resource_size(mem);
 
+       /*
+        * Best effort: Some platforms don't need this and those that do,
+        * will at worst have some graphic artifacts on lack of remap_range.
+        */
+       (void)remap_range(info->screen_base, info->screen_size, 
MAP_WRITECOMBINE);
 
        info->fbops = &simplefb_ops;
 
-- 
2.39.5


Reply via email to