diff options
author | Stefan Reinauer <reinauer@chromium.org> | 2013-05-20 15:17:44 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-07-10 21:46:23 +0200 |
commit | f17519120a4d76cd18d12e94987b65b336f32f59 (patch) | |
tree | 8b9eaf33907d71843d75a4072cdcb0f3acb7f572 /src/cpu | |
parent | 1162103958fad815e10b90524560b3b81f2c0b18 (diff) | |
download | coreboot-f17519120a4d76cd18d12e94987b65b336f32f59.tar.xz |
exynos5420: Simplify the graphics code by eliminating the unused color map
The code that allocated space for the framebuffer was adding space for a
vestigial color map which was never used. It was also passing around a
structure which was used to calculate a single value which was already
known when that structure was put together. Eliminate the extra space,
and pass the single value instead of the structure.
Change-Id: I29bc17488539dbe695908e47f0b80c07e102e17d
Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-on: http://review.coreboot.org/3666
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/samsung/exynos5420/cpu.c | 21 | ||||
-rw-r--r-- | src/cpu/samsung/exynos5420/dp-core.h | 16 | ||||
-rw-r--r-- | src/cpu/samsung/exynos5420/fb.c | 29 |
3 files changed, 17 insertions, 49 deletions
diff --git a/src/cpu/samsung/exynos5420/cpu.c b/src/cpu/samsung/exynos5420/cpu.c index 0abc0a3022..e83c16ad0a 100644 --- a/src/cpu/samsung/exynos5420/cpu.c +++ b/src/cpu/samsung/exynos5420/cpu.c @@ -68,12 +68,10 @@ static void exynos_displayport_init(device_t dev) /* put these on the stack. If, at some point, we want to move * this code to a pre-ram stage, it will be much easier. */ - vidinfo_t vi; struct exynos5_fimd_panel panel; unsigned long int fb_size; u32 lcdbase; - memset(&vi, 0, sizeof(vi)); memset(&panel, 0, sizeof(panel)); panel.is_dp = 1; /* Display I/F is eDP */ @@ -94,18 +92,10 @@ static void exynos_displayport_init(device_t dev) panel.xres = conf->xres; panel.yres = conf->yres; - vi.vl_col = conf->xres; - vi.vl_row = conf->yres; - vi.vl_bpix = conf->bpp; - /* - * The size is a magic number from hardware. Allocate enough for the - * frame buffer and color map. - */ + /* The size is a magic number from hardware. */ fb_size = conf->xres * conf->yres * (conf->bpp / 8); - lcdbase = (uintptr_t)cbmem_add(CBMEM_ID_CONSOLE, fb_size + 64*KiB); - printk(BIOS_SPEW, "LCD colormap base is %p\n", (void *)(lcdbase)); - mmio_resource(dev, 0, lcdbase/KiB, 64); - vi.cmap = (void *)lcdbase; + lcdbase = (uintptr_t)cbmem_add(CBMEM_ID_CONSOLE, fb_size); + printk(BIOS_SPEW, "LCD framebuffer base is %p\n", (void *)(lcdbase)); /* * We need to clean and invalidate the framebuffer region and disable @@ -119,18 +109,17 @@ static void exynos_displayport_init(device_t dev) * FIXME: Is disabling/re-enabling the MMU entirely necessary? */ uint32_t lower = ALIGN_DOWN(lcdbase, MiB); - uint32_t upper = ALIGN_UP(lcdbase + fb_size + 64*KiB, MiB); + uint32_t upper = ALIGN_UP(lcdbase + fb_size, MiB); dcache_clean_invalidate_by_mva(lower, upper - lower); dcache_mmu_disable(); mmu_config_range(lower/MiB, (upper - lower)/MiB, DCACHE_OFF); dcache_mmu_enable(); - lcdbase += 64*KiB; mmio_resource(dev, 1, lcdbase/KiB, (fb_size + KiB - 1)/KiB); printk(BIOS_DEBUG, "Initializing Exynos VGA, base %p\n", (void *)lcdbase); memset((void *)lcdbase, 0, fb_size); /* clear the framebuffer */ - ret = lcd_ctrl_init(&vi, &panel, (void *)lcdbase); + ret = lcd_ctrl_init(fb_size, &panel, (void *)lcdbase); } static void cpu_init(device_t dev) diff --git a/src/cpu/samsung/exynos5420/dp-core.h b/src/cpu/samsung/exynos5420/dp-core.h index 7b81037776..62144e3a26 100644 --- a/src/cpu/samsung/exynos5420/dp-core.h +++ b/src/cpu/samsung/exynos5420/dp-core.h @@ -117,14 +117,6 @@ struct s5p_dp_device { struct link_train link_train; }; -/* this struct is used by mainboards to pass mode info to the driver */ -typedef struct vidinfo { - u16 vl_col; - u16 vl_row; - u8 vl_bpix; - u16 *cmap; -} vidinfo_t; - /* s5p_dp_reg.c */ /* @@ -260,9 +252,9 @@ void s5p_dp_wait_hw_link_training_done(struct s5p_dp_device *dp); /* startup and init */ struct exynos5_fimd_panel; -void fb_init(vidinfo_t *panel_info, void *lcdbase, - struct exynos5_fimd_panel *pd); +void fb_init(unsigned long int fb_size, void *lcdbase, + struct exynos5_fimd_panel *pd); int dp_controller_init(struct s5p_dp_device *dp_device); -int lcd_ctrl_init(vidinfo_t *panel_info, - struct exynos5_fimd_panel *panel_data, void *lcdbase); +int lcd_ctrl_init(unsigned long int fb_size, + struct exynos5_fimd_panel *panel_data, void *lcdbase); #endif /* CPU_SAMSUNG_EXYNOS5420_DP_CORE_H */ diff --git a/src/cpu/samsung/exynos5420/fb.c b/src/cpu/samsung/exynos5420/fb.c index d4c3d447bd..760f5ee4bf 100644 --- a/src/cpu/samsung/exynos5420/fb.c +++ b/src/cpu/samsung/exynos5420/fb.c @@ -116,32 +116,21 @@ static void fimd_bypass(void) sysreg->disp1blk_cfg &= ~FIMDBYPASS_DISP1; } -/* Calculate the size of Framebuffer from the resolution */ -static u32 calc_fbsize(vidinfo_t *panel_info) -{ - /* They had PAGE_SIZE here instead of 4096. - * but that's a totally arbitrary number -- everything nowadays - * has lots of page sizes. - * So keep it obvious. - */ - return ALIGN((panel_info->vl_col * panel_info->vl_row * - ((1<<panel_info->vl_bpix) / 8)), 4096); -} - /* * Initialize display controller. * * @param lcdbase pointer to the base address of framebuffer. * @pd pointer to the main panel_data structure */ -void fb_init(vidinfo_t *panel_info, void *lcdbase, - struct exynos5_fimd_panel *pd) +void fb_init(unsigned long int fb_size, void *lcdbase, + struct exynos5_fimd_panel *pd) { unsigned int val; - u32 fbsize; struct exynos5_fimd *fimd = samsung_get_base_fimd(); struct exynos5_disp_ctrl *disp_ctrl = samsung_get_base_disp_ctrl(); + fb_size = ALIGN(fb_size, 4096); + writel(pd->ivclk | pd->fixvclk, &disp_ctrl->vidcon1); val = ENVID_ON | ENVID_F_ON | (pd->clkval_f << CLKVAL_F_OFFSET); writel(val, &fimd->vidcon0); @@ -161,9 +150,7 @@ void fb_init(vidinfo_t *panel_info, void *lcdbase, writel(val, &disp_ctrl->vidtcon2); writel((unsigned int)lcdbase, &fimd->vidw00add0b0); - - fbsize = calc_fbsize(panel_info); - writel((unsigned int)lcdbase + fbsize, &fimd->vidw00add1b0); + writel((unsigned int)lcdbase + fb_size, &fimd->vidw00add1b0); writel(pd->xres * 2, &fimd->vidw00add2); @@ -586,12 +573,12 @@ int dp_controller_init(struct s5p_dp_device *dp_device) * @param lcdbase Base address of LCD frame buffer * @return 0 if ok, -ve error code on error */ -int lcd_ctrl_init(vidinfo_t *panel_info, - struct exynos5_fimd_panel *panel_data, void *lcdbase) +int lcd_ctrl_init(unsigned long int fb_size, + struct exynos5_fimd_panel *panel_data, void *lcdbase) { int ret = 0; fimd_bypass(); - fb_init(panel_info, lcdbase, panel_data); + fb_init(fb_size, lcdbase, panel_data); return ret; } |