X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fvideo%2Fmxc_ipuv3_fb.c;h=3e21fb23067c0dc41c16f35fc58964db806eae07;hb=326ea986ac150acdc7656d57fca647db80b50158;hp=a66981c27c9f86bedaf3d719aedc4ad8352f120d;hpb=33a08c10c78baf67e41cd03d5732ddc338e8c2e9;p=karo-tx-uboot.git diff --git a/drivers/video/mxc_ipuv3_fb.c b/drivers/video/mxc_ipuv3_fb.c index a66981c27c..3e21fb2306 100644 --- a/drivers/video/mxc_ipuv3_fb.c +++ b/drivers/video/mxc_ipuv3_fb.c @@ -8,26 +8,9 @@ * * (C) Copyright 2004-2010 Freescale Semiconductor, Inc. * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ -/* #define DEBUG */ #include #include #include @@ -35,43 +18,20 @@ #include #include #include -#include +#include #include "videomodes.h" #include "ipu.h" #include "mxcfb.h" - -DECLARE_GLOBAL_DATA_PTR; - -void *lcd_base; /* Start of framebuffer memory */ -void *lcd_console_address; /* Start of console buffer */ - -int lcd_line_length; -int lcd_color_fg; -int lcd_color_bg; - -short console_col; -short console_row; - -vidinfo_t panel_info; +#include "ipu_regs.h" static int mxcfb_map_video_memory(struct fb_info *fbi); static int mxcfb_unmap_video_memory(struct fb_info *fbi); -void lcd_initcolregs(void) -{ -} - -void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue) -{ -} - -void lcd_disable(void) -{ -} - -void lcd_panel_disable(void) -{ -} +/* graphics setup */ +static GraphicDevice panel; +static struct fb_videomode const *gmode; +static uint8_t gdisp; +static uint32_t gpixfmt; void fb_videomode_to_var(struct fb_var_screeninfo *var, const struct fb_videomode *mode) @@ -439,9 +399,10 @@ static int mxcfb_map_video_memory(struct fb_info *fbi) fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length; } - - fbi->screen_base = (char *)lcd_base; - fbi->fix.smem_start = (unsigned long)lcd_base; + fbi->fix.smem_len = roundup(fbi->fix.smem_len, ARCH_DMA_MINALIGN); + fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN, + fbi->fix.smem_len); + fbi->fix.smem_start = (unsigned long)fbi->screen_base; if (fbi->screen_base == 0) { puts("Unable to allocate framebuffer memory\n"); fbi->fix.smem_len = 0; @@ -526,7 +487,8 @@ static struct fb_info *mxcfb_init_fbinfo(void) * * @return Appropriate error code to the kernel common code */ -static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode) +static int mxcfb_probe(u32 interface_pix_fmt, uint8_t disp, + struct fb_videomode const *mode) { struct fb_info *fbi; struct mxcfb_info *mxcfbi; @@ -550,7 +512,7 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode) mxcfbi->blank = FB_BLANK_POWERDOWN; } - mxcfbi->ipu_di = 0; + mxcfbi->ipu_di = disp; ipu_disp_set_global_alpha(mxcfbi->ipu_ch, 1, 0x80); ipu_disp_set_color_key(mxcfbi->ipu_ch, 0, 0); @@ -561,12 +523,12 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode) mxcfb_info[mxcfbi->ipu_di] = fbi; /* Need dummy values until real panel is configured */ - fbi->var.xres = 640; - fbi->var.yres = 480; - fbi->var.bits_per_pixel = 16; mxcfbi->ipu_di_pix_fmt = interface_pix_fmt; fb_videomode_to_var(&fbi->var, mode); + fbi->var.bits_per_pixel = 16; + fbi->fix.line_length = fbi->var.xres * (fbi->var.bits_per_pixel / 8); + fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length; mxcfb_check_var(&fbi->var, fbi); @@ -581,19 +543,16 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode) mxcfb_set_par(fbi); - /* Setting panel_info for lcd */ - panel_info.cmap = NULL; - panel_info.vl_col = fbi->var.xres; - panel_info.vl_row = fbi->var.yres; - panel_info.vl_bpix = LCD_BPP; + panel.winSizeX = mode->xres; + panel.winSizeY = mode->yres; + panel.plnSizeX = mode->xres; + panel.plnSizeY = mode->yres; - lcd_line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8; + panel.frameAdrs = (u32)fbi->screen_base; + panel.memSize = fbi->screen_size; - debug("MXC IPUV3 configured\n" - "XRES = %d YRES = %d BitsXpixel = %d\n", - panel_info.vl_col, - panel_info.vl_row, - panel_info.vl_bpix); + panel.gdfBytesPP = 2; + panel.gdfIndex = GDF_16BIT_565RGB; ipu_dump_registers(); @@ -603,29 +562,26 @@ err0: return ret; } -int overwrite_console(void) -{ - /* Keep stdout / stderr on serial, our LCD is for splashscreen only */ - return 1; -} - -void lcd_ctrl_init(void *lcdbase) +void ipuv3_fb_shutdown(void) { - u32 mem_len = panel_info.vl_col * - panel_info.vl_row * - NBITS(panel_info.vl_bpix) / 8; - - /* - * We rely on lcdbase being a physical address, i.e., either MMU off, - * or 1-to-1 mapping. Might want to add some virt2phys here. - */ - if (!lcdbase) - return; - - memset(lcdbase, 0, mem_len); + int i; + struct ipu_stat *stat = (struct ipu_stat *)IPU_STAT; + + for (i = 0; i < ARRAY_SIZE(mxcfb_info); i++) { + struct fb_info *fbi = mxcfb_info[i]; + if (fbi) { + struct mxcfb_info *mxc_fbi = fbi->par; + ipu_disable_channel(mxc_fbi->ipu_ch); + ipu_uninit_channel(mxc_fbi->ipu_ch); + } + } + for (i = 0; i < ARRAY_SIZE(stat->int_stat); i++) { + __raw_writel(__raw_readl(&stat->int_stat[i]), + &stat->int_stat[i]); + } } -int mx51_fb_init(struct fb_videomode *mode) +void *video_hw_init(void) { int ret; @@ -633,10 +589,28 @@ int mx51_fb_init(struct fb_videomode *mode) if (ret) puts("Error initializing IPU\n"); - lcd_base += 56; + ret = mxcfb_probe(gpixfmt, gdisp, gmode); + debug("Framebuffer at 0x%x\n", (unsigned int)panel.frameAdrs); - debug("Framebuffer at 0x%x\n", (unsigned int)lcd_base); - ret = mxcfb_probe(IPU_PIX_FMT_RGB666, mode); + return (void *)&panel; +} - return ret; +void video_set_lut(unsigned int index, /* color number */ + unsigned char r, /* red */ + unsigned char g, /* green */ + unsigned char b /* blue */ + ) +{ + return; +} + +int ipuv3_fb_init(struct fb_videomode const *mode, + uint8_t disp, + uint32_t pixfmt) +{ + gmode = mode; + gdisp = disp; + gpixfmt = pixfmt; + + return 0; }