]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/video/bcm2835.c
exynos: video: Move struct exynos_platform_mipi_dsim into vidinfo
[karo-tx-uboot.git] / drivers / video / bcm2835.c
index 1f18231ac69ddc3c698720b90dbd389a615f43dc..cd605e632cb606c84754c24b6ca1590db9a22ab7 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <lcd.h>
+#include <memalign.h>
+#include <phys2bus.h>
 #include <asm/arch/mbox.h>
 #include <asm/global_data.h>
 
@@ -38,10 +40,11 @@ struct msg_setup {
 
 void lcd_ctrl_init(void *lcdbase)
 {
-       ALLOC_ALIGN_BUFFER(struct msg_query, msg_query, 1, 16);
-       ALLOC_ALIGN_BUFFER(struct msg_setup, msg_setup, 1, 16);
+       ALLOC_CACHE_ALIGN_BUFFER(struct msg_query, msg_query, 1);
+       ALLOC_CACHE_ALIGN_BUFFER(struct msg_setup, msg_setup, 1);
        int ret;
        u32 w, h;
+       u32 fb_start, fb_end;
 
        debug("bcm2835: Query resolution...\n");
 
@@ -102,7 +105,16 @@ void lcd_ctrl_init(void *lcdbase)
        panel_info.vl_row = h;
        panel_info.vl_bpix = LCD_COLOR16;
 
-       gd->fb_base = msg_setup->allocate_buffer.body.resp.fb_address;
+       gd->fb_base = bus_to_phys(
+               msg_setup->allocate_buffer.body.resp.fb_address);
+
+       /* Enable dcache for the frame buffer */
+       fb_start = gd->fb_base & ~(MMU_SECTION_SIZE - 1);
+       fb_end = gd->fb_base + msg_setup->allocate_buffer.body.resp.fb_size;
+       fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
+       mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
+               DCACHE_WRITEBACK);
+       lcd_set_flush_dcache(1);
 }
 
 void lcd_enable(void)