From 945d069fb5c8932e74aeba178c60a9dc6e9cba93 Mon Sep 17 00:00:00 2001 From: Liu Ying Date: Sat, 6 Oct 2012 04:16:04 +0000 Subject: ipu common: reset ipuv3 correctly This patch checks self-clear sw_ipu_rst bit in SCR register of SRC controller to be cleared after setting it to high to reset IPUv3. This makes sure that IPUv3 finishes sofware reset. A timeout mechanism is added to stop polling on the bit status in case the bit could not be cleared by the hardware automatically within 10 millisecond. Signed-off-by: Liu Ying --- drivers/video/ipu_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c index 0f2d113..ad4af52 100644 --- a/drivers/video/ipu_common.c +++ b/drivers/video/ipu_common.c @@ -94,6 +94,7 @@ struct ipu_ch_param { temp1; \ }) +#define IPU_SW_RST_TOUT_USEC (10000) void clk_enable(struct clk *clk) { @@ -398,11 +399,20 @@ void ipu_reset(void) { u32 *reg; u32 value; + int timeout = IPU_SW_RST_TOUT_USEC; reg = (u32 *)SRC_BASE_ADDR; value = __raw_readl(reg); value = value | SW_IPU_RST; __raw_writel(value, reg); + + while (__raw_readl(reg) & SW_IPU_RST) { + udelay(1); + if (!(timeout--)) { + printf("ipu software reset timeout\n"); + break; + } + }; } /* -- cgit v1.1 From c20ee073a61f32cd34bd76ec88797ab20f62c313 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Fri, 28 Sep 2012 15:11:12 +0000 Subject: video: Implement additional video API functions in cfb_console Implement the new video API functions to provide access to screen size, etc. Signed-off-by: Stefan Reinauer Signed-off-by: Simon Glass Signed-off-by: Anatolij Gustschin --- drivers/video/cfb_console.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9c67b63..6f5d4f2 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -2257,3 +2257,45 @@ int drv_video_init(void) /* Return success */ return 1; } + +void video_position_cursor(unsigned col, unsigned row) +{ + console_col = min(col, CONSOLE_COLS - 1); + console_row = min(row, CONSOLE_ROWS - 1); +} + +int video_get_pixel_width(void) +{ + return VIDEO_VISIBLE_COLS; +} + +int video_get_pixel_height(void) +{ + return VIDEO_VISIBLE_ROWS; +} + +int video_get_screen_rows(void) +{ + return CONSOLE_ROWS; +} + +int video_get_screen_columns(void) +{ + return CONSOLE_COLS; +} + +void video_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + 0, /* dest pos x */ + 0, /* dest pos y */ + VIDEO_VISIBLE_COLS, /* frame width */ + VIDEO_VISIBLE_ROWS, /* frame height */ + bgx /* fill color */ + ); +#else + memsetl(video_fb_address, + (VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), bgx); +#endif +} -- cgit v1.1 From d484b52e6fcb28dc011ce45718294496c6ea83d0 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 28 Sep 2012 15:11:17 +0000 Subject: video: Skip bitmaps which do not fit into the screen in cfb_console The cfb console driver is trying to prevent bitmaps to spill over the screen, but the calculations assume that at least part of the bitmap fits into the screen area. In reality there could be bitmap elements which are completely out of the screen area, they just need to be discarded. Signed-off-by: Vadim Bendebury Signed-off-by: Simon Glass --- drivers/video/cfb_console.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 6f5d4f2..9388859 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1515,6 +1515,13 @@ int video_display_bitmap(ulong bmp_image, int x, int y) padded_line = (((width * bpp + 7) / 8) + 3) & ~0x3; + /* + * Just ignore elements which are completely beyond screen + * dimensions. + */ + if ((x >= VIDEO_VISIBLE_COLS) || (y >= VIDEO_VISIBLE_ROWS)) + return 0; + #ifdef CONFIG_SPLASH_SCREEN_ALIGN if (x == BMP_ALIGN_CENTER) x = max(0, (VIDEO_VISIBLE_COLS - width) / 2); -- cgit v1.1 From cfcd1c03e44fc22f2146948dc9f341b28e6ec583 Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Thu, 8 Nov 2012 17:49:14 +0000 Subject: video: atmel: implement lcd_setcolreg function implement the common api lcd_setcolreg in include/lcd.h Signed-off-by: Bo Shen [agust: fixed commit log and gcc 4.6 -Wparentheses warnings] Signed-off-by: Anatolij Gustschin --- drivers/video/atmel_hlcdfb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c index beb7fa3..b10ca4b 100644 --- a/drivers/video/atmel_hlcdfb.c +++ b/drivers/video/atmel_hlcdfb.c @@ -51,6 +51,18 @@ short console_row; #define lcdc_readl(reg) __raw_readl((reg)) #define lcdc_writel(reg, val) __raw_writel((val), (reg)) +/* + * the CLUT register map as following + * RCLUT(24 ~ 16), GCLUT(15 ~ 8), BCLUT(7 ~ 0) + */ +void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue) +{ + lcdc_writel(((red << LCDC_BASECLUT_RCLUT_Pos) & LCDC_BASECLUT_RCLUT_Msk) + | ((green << LCDC_BASECLUT_GCLUT_Pos) & LCDC_BASECLUT_GCLUT_Msk) + | ((blue << LCDC_BASECLUT_BCLUT_Pos) & LCDC_BASECLUT_BCLUT_Msk), + panel_info.mmio + ATMEL_LCDC_LUT(regno)); +} + void lcd_ctrl_init(void *lcdbase) { unsigned long value; -- cgit v1.1 From 4a1921eb04fa83acbab60fc0219e48e85dbc2f74 Mon Sep 17 00:00:00 2001 From: "Jens Scharsig (BuS Elektronik)" Date: Wed, 14 Nov 2012 00:10:20 +0000 Subject: Video: fix compiler warnings in bus_vcxk if a board uses the vcxk driver option CONFIG_SYS_VCXK_DOUBLEBUFFERD, compilier shows warnings. This patch will fix it. Signed-off-by: Jens Scharsig (BuS Elektronik) --- drivers/video/bus_vcxk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/bus_vcxk.c b/drivers/video/bus_vcxk.c index 9c4714d..a0607cf 100644 --- a/drivers/video/bus_vcxk.c +++ b/drivers/video/bus_vcxk.c @@ -153,7 +153,7 @@ int vcxk_init(unsigned long width, unsigned long height) #ifdef CONFIG_SYS_VCXK_DOUBLEBUFFERED double_bws_word = (u_short *)double_bws; double_bws_long = (u_long *)double_bws; - debug("%lx %lx %lx \n", double_bws, double_bws_word, double_bws_long); + debug("%px %px %px\n", double_bws, double_bws_word, double_bws_long); #endif display_width = width; display_height = height; -- cgit v1.1 From 17c40ad96352114162e8a22b89a50b4742fd8f6a Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Fri, 30 Nov 2012 06:32:33 +0000 Subject: x86: video: Add coreboot framebuffer support Add a basic driver for the coreboot framebuffer. Signed-off-by: Stefan Reinauer Signed-off-by: Simon Glass --- drivers/video/Makefile | 1 + drivers/video/coreboot_fb.c | 101 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 drivers/video/coreboot_fb.c (limited to 'drivers/video') diff --git a/drivers/video/Makefile b/drivers/video/Makefile index ebb6da8..cc3022a 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -39,6 +39,7 @@ COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o COBJS-$(CONFIG_S6E63D6) += s6e63d6.o COBJS-$(CONFIG_SED156X) += sed156x.o COBJS-$(CONFIG_VIDEO_AMBA) += amba.o +COBJS-$(CONFIG_VIDEO_COREBOOT) += coreboot_fb.o COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o COBJS-$(CONFIG_VIDEO_DA8XX) += da8xx-fb.o videomodes.o COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o videomodes.o diff --git a/drivers/video/coreboot_fb.c b/drivers/video/coreboot_fb.c new file mode 100644 index 0000000..d93bd89 --- /dev/null +++ b/drivers/video/coreboot_fb.c @@ -0,0 +1,101 @@ +/* + * coreboot Framebuffer driver. + * + * Copyright (C) 2011 The Chromium OS authors + * + * 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 + */ + +#include +#include +#include +#include +#include "videomodes.h" + +/* + * The Graphic Device + */ +GraphicDevice ctfb; + +static int parse_coreboot_table_fb(GraphicDevice *gdev) +{ + struct cb_framebuffer *fb = lib_sysinfo.framebuffer; + + /* If there is no framebuffer structure, bail out and keep + * running on the serial console. + */ + if (!fb) + return 0; + + gdev->winSizeX = fb->x_resolution; + gdev->winSizeY = fb->y_resolution; + + gdev->plnSizeX = fb->x_resolution; + gdev->plnSizeY = fb->y_resolution; + + gdev->gdfBytesPP = fb->bits_per_pixel / 8; + + switch (fb->bits_per_pixel) { + case 24: + gdev->gdfIndex = GDF_32BIT_X888RGB; + break; + case 16: + gdev->gdfIndex = GDF_16BIT_565RGB; + break; + default: + gdev->gdfIndex = GDF__8BIT_INDEX; + break; + } + + gdev->isaBase = CONFIG_SYS_ISA_IO_BASE_ADDRESS; + gdev->pciBase = (unsigned int)fb->physical_address; + + gdev->frameAdrs = (unsigned int)fb->physical_address; + gdev->memSize = fb->bytes_per_line * fb->y_resolution; + + gdev->vprBase = (unsigned int)fb->physical_address; + gdev->cprBase = (unsigned int)fb->physical_address; + + return 1; +} + +void *video_hw_init(void) +{ + GraphicDevice *gdev = &ctfb; + int bits_per_pixel; + + printf("Video: "); + + if (!parse_coreboot_table_fb(gdev)) { + printf("No video mode configured in coreboot!\n"); + return NULL; + } + + bits_per_pixel = gdev->gdfBytesPP * 8; + + /* fill in Graphic device struct */ + sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY, + bits_per_pixel); + printf("%s\n", gdev->modeIdent); + + memset((void *)gdev->pciBase, 0, + gdev->winSizeX * gdev->winSizeY * gdev->gdfBytesPP); + + return (void *)gdev; +} -- cgit v1.1 From ae63057446b8bb45c37a6ea4e5db162ba4f25c78 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Sat, 3 Nov 2012 11:41:40 +0000 Subject: video: Check for valid FB pointer before clearing This command will start erasing at memory address zero if there is not a valid framebuffer address that was found during video_init(). This is a common case with Chrome OS devices in normal mode when we do not execute the video option rom in coreboot. Signed-off-by: Duncan Laurie Signed-off-by: Simon Glass --- drivers/video/cfb_console.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9388859..26f673a 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -2293,6 +2293,8 @@ int video_get_screen_columns(void) void video_clear(void) { + if (!video_fb_address) + return; #ifdef VIDEO_HW_RECTFILL video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ 0, /* dest pos x */ -- cgit v1.1