video: parse the video-mode environment variable
PATCH 1/2 video: parse the video-mode environment variable
Add function video_get_video_mode(), which parses the "video-mode" environment variable and returns each of its components. The format matches the video= command-line option used for Linux:
video-mode=<driver>:<xres>x<yres>-<depth>@<freq><,option=string>
<driver> The video driver, ignored by U-Boot <xres> The X resolution (in pixels) to use. <yres> The Y resolution (in pixels) to use. <depth> The color depth (in bits) to use.
<freq> The frequency (in Hz) to use.
<options> A comma-separated list of device-specific options
--- doc/README.video | 19 +++++++++++++ drivers/video/videomodes.c | 64 ++++++++++++++++++++++++++++++++++++++++++++ drivers/video/videomodes.h | 3 ++ 3 files changed, 86 insertions(+), 0 deletions(-)
doc/README.video +19 -0
@@ -28,3 +28,22 @@ The driver has been tested with the following configurations: - MPC823FADS with AD7176 on a PAL TV (YCbYCr) - arsenio at tin.it - GENIETV with AD7177 on a PAL TV (YCbYCr) - arsenio at tin.it + + +"video-mode" environment variable +=============================== + +The 'video-mode' environment variable can be used to enable and configure +some video drivers. The format matches the video= command-line option used +for Linux: + + video-mode=<driver>:<xres>x<yres>-<depth>@<freq><,option=string> + + <driver> The video driver name, ignored by U-Boot + <xres> The X resolution (in pixels) to use. + <yres> The Y resolution (in pixels) to use. + <depth> The color depth (in bits) to use. + <freq> The frequency (in Hz) to use. + <options> A comma-separated list of device-specific options + +Example: video-mode=fslfb:1280x1024-32 at 60,monitor=dvi
drivers/video/videomodes.c +64 -0
79 lines not on this page · raw message
drivers/video/videomodes.h +3 -0
@@ -86,3 +86,6 @@ extern const struct ctfb_vesa_modes vesa_modes[];extern const struct ctfb_res_modes res_mode_init[];int video_get_params (struct ctfb_res_modes *pPar,char *penv); + +int video_get_video_mode (unsigned int *xres,unsigned int *yres, +unsigned int *depth,unsigned int *freq,const char **options);
Signature · 1 line
1.7.3.4
PATCH v3 2/2 powerpc: user 'video-mode' environment variable to configure DIU
Use the 'video-mode' environment variable (for Freescale chips that have a DIU display controller) to designate the full video configuration. Previously, the DIU driver used the 'monitor' variable, and only to determine the output video port.
The old definition of the "monitor" environment variable only determines which video port to use for output. This variable is set to a number (0, 1, or sometimes 2) to specify a DVI, LVDS, or Dual-LVDS port. The resolution is hard-coded into board-specific code. The Linux command-line arguments need to be hard-coded to the proper video definition string.
---
This patch depends on my previous patch, "[v4] powerpc: clean up DIU macro definitions for Freescale reference boards".
README | 11 +- board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c | 73 +-- board/freescale/p1022ds/diu.c | 29 +- drivers/video/Makefile | 2 +- drivers/video/fsl_diu_fb.c | 938 +++++++++++-------------- include/configs/MPC8610HPCD.h | 16 +- include/configs/P1022DS.h | 12 +- include/fsl_diu_fb.h | 91 +-- 8 files changed, 521 insertions(+), 651 deletions(-)
rewrite drivers/video/fsl_diu_fb.c (63%)
rewrite include/fsl_diu_fb.h (62%)
README +4 -7
@@ -1071,13 +1071,10 @@ The following options need to be configured: CONFIG_VIDEO_LOGO CONFIG_VIDEO_BMP_LOGO - The DIU driver will look for the 'monitor' environment variable, - and if defined, enable the DIU as a console during boot. This - variable should be set to one of these values: - - '0' Output video to the DVI connector - '1' Output video to the LVDS connector - '2' Output video to the Dual-Link LVDS connector + The DIU driver will look for the 'video-mode' environment + variable, and if defined, enable the DIU as a console during + boot. See the documentation file README.video for a + description of this variable. - Keyboard Support: CONFIG_KEYBOARD
board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c +31 -42
93 lines not on this page · raw message
board/freescale/p1022ds/diu.c +16 -13
@@ -1,5 +1,5 @@/* -* Copyright 2010 Freescale Semiconductor, Inc. +* Copyright 2010-2011 Freescale Semiconductor, Inc. * Authors: Timur Tabi <[email protected]> * * FSL DIU Framebuffer driver
@@ -12,6 +12,7 @@#include <common.h> #include <command.h> +#include <linux/ctype.h> #include <asm/io.h> #include <stdio_dev.h> #include <video_fb.h>
@@ -81,10 +82,10 @@ void diu_set_pixel_clock(unsigned int pixclock)out_be32 (&gur->clkdvdr, temp |0x80000000 | ((pixval &0x1F ) <<16 )); } -int platform_diu_init (unsigned int *xres,unsigned int *yres) +int platform_diu_init (unsigned int xres,unsigned int yres,const char *port) {ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); -char *monitor_port; +const char *name;u32 pixel_format;u8 temp;
@@ -100,21 +101,23 @@ int platform_diu_init(unsigned int *xres, unsigned int *yres) temp =in_8 (&pixis->brdcfg1); - monitor_port =getenv ("monitor" ); -if (!strncmp (monitor_port,"1" ,1 )) {/* 1 - Single link LVDS */ - *xres =1024 ; - *yres =768 ; -/* Enable the DFP port, disable the DVI and the backlight */ - temp &= ~(PX_BRDCFG1_DVIEN |PX_BRDCFG1_BACKLIGHT ); - temp |=PX_BRDCFG1_DFPEN ; +if (strncmp (port,"lvds" ,4 ) ==0 ) { +/* Single link LVDS */ + temp &= ~PX_BRDCFG1_DVIEN ; +/* +* LVDS also needs backlight enabled, otherwise the display +* will be blank. +*/ + temp |= (PX_BRDCFG1_DFPEN |PX_BRDCFG1_BACKLIGHT ); + name ="Single-Link LVDS" ; }else {/* DVI */ - *xres =1280 ; - *yres =1024 ;/* Enable the DVI port, disable the DFP and the backlight */ temp &= ~(PX_BRDCFG1_DFPEN |PX_BRDCFG1_BACKLIGHT ); temp |=PX_BRDCFG1_DVIEN ; + name ="DVI" ; } +printf ("DIU: Switching to %s monitor @ %ux%u\n" , name, xres, yres);out_8 (&pixis->brdcfg1, temp);/*
@@ -136,7 +139,7 @@ int platform_diu_init(unsigned int *xres, unsigned int *yres)clrsetbits_be32 (&gur->pmuxcr,PMUXCR_ELBCDIU_MASK ,PMUXCR_ELBCDIU_DIU ); pmuxcr =in_be32 (&gur->pmuxcr); -return fsl_diu_init (*xres, pixel_format,0 ); +return fsl_diu_init (xres, pixel_format,0 ); }#ifdef CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
drivers/video/Makefile +1 -1
@@ -28,7 +28,7 @@ LIB := $(obj)libvideo.o COBJS-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o COBJS-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o COBJS-$(CONFIG_CFB_CONSOLE) += cfb_console.o -COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o +COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o COBJS-$(CONFIG_S6E63D6) += s6e63d6.o COBJS-$(CONFIG_VIDEO_AMBA) += amba.o COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
drivers/video/fsl_diu_fb.c +425 -513
938 lines not on this page · raw message
include/configs/MPC8610HPCD.h +7 -9
@@ -1,5 +1,5 @@/* -* Copyright 2007, 2010 Freescale Semiconductor, Inc. +* Copyright 2007-2011 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License
@@ -23,6 +23,8 @@/* video */ +#define CONFIG_FSL_DIU_FB +#ifdef CONFIG_FSL_DIU_FB #define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x2c000)#define CONFIG_VIDEO
@@ -625,8 +627,6 @@"diuregs=md e002c000 1d\0" \"dium=mw e002c01c\0" \"diuerr=md e002c014 1\0" \ -"othbootargs=diufb=15M video=fslfb:1280x1024-32 at 60,monitor=0 debug\0" \ -"monitor=0-DVI\0" \"pmregs=md e00e1000 2b\0" \"lawregs=md e0000c08 4b\0" \"lbcregs=md e0005000 36\0" \
@@ -646,23 +646,21 @@"ramdiskfile=8610hpcd/ramdisk.uboot\0" \"fdtaddr=c00000\0" \"fdtfile=8610hpcd/mpc8610_hpcd.dtb\0" \ -"bdev=sda3\0" \ -"othbootargs=diufb=15M video=fslfb:1280x1024-32@60,monitor=0\0" \ - "monitor=0-DVI\0" + "bdev=sda3\0"#endif #define CONFIG_NFSBOOTCOMMAND \ "setenv bootargs root=/dev/nfs rw " \ "nfsroot=$serverip:$rootpath " \ "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \ - "console=$consoledev,$baudrate $othbootargs;" \ + "console=$consoledev,$baudrate $diubootargs $othbootargs;" \ "tftp $loadaddr $bootfile;" \ "tftp $fdtaddr $fdtfile;" \ "bootm $loadaddr - $fdtaddr"#define CONFIG_RAMBOOTCOMMAND \ "setenv bootargs root=/dev/ram rw " \ - "console=$consoledev,$baudrate $othbootargs;" \ + "console=$consoledev,$baudrate $diubootargs $othbootargs;" \ "tftp $ramdiskaddr $ramdiskfile;" \ "tftp $loadaddr $bootfile;" \ "tftp $fdtaddr $fdtfile;" \
@@ -670,7 +668,7 @@#define CONFIG_BOOTCOMMAND \ "setenv bootargs root=/dev/$bdev rw " \ - "console=$consoledev,$baudrate $othbootargs;" \ + "console=$consoledev,$baudrate $diubootargs $othbootargs;" \ "tftp $loadaddr $bootfile;" \ "tftp $fdtaddr $fdtfile;" \ "bootm $loadaddr - $fdtaddr"
include/configs/P1022DS.h +6 -6
@@ -185,6 +185,8 @@#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "/* Video */ +#define CONFIG_FSL_DIU_FB +#ifdef CONFIG_FSL_DIU_FB #define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x10000)#define CONFIG_VIDEO
@@ -445,13 +447,11 @@"bdev=sda3\0" \"diuregs=md e002c000 1d\0" \"dium=mw e002c01c\0" \ -"diuerr=md e002c014 1\0" \ -"othbootargs=diufb=15M video=fslfb:1280x1024-32 at 60,monitor=0 tty0\0" \ -"monitor=0-DVI\0" +"diuerr=md e002c014 1\0" #define CONFIG_HDBOOT \"setenv bootargs root=/dev/$bdev rw " \ -"console=$consoledev,$baudrate $othbootargs;" \ +"console=$consoledev,$baudrate $diubootargs $othbootargs;" \"tftp $loadaddr $bootfile;" \"tftp $fdtaddr $fdtfile;" \"bootm $loadaddr - $fdtaddr"
@@ -460,14 +460,14 @@"setenv bootargs root=/dev/nfs rw " \"nfsroot=$serverip:$rootpath " \"ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \ -"console=$consoledev,$baudrate $othbootargs;" \ +"console=$consoledev,$baudrate $diubootargs $othbootargs;" \"tftp $loadaddr $bootfile;" \"tftp $fdtaddr $fdtfile;" \"bootm $loadaddr - $fdtaddr" #define CONFIG_RAMBOOTCOMMAND \"setenv bootargs root=/dev/ram rw " \ -"console=$consoledev,$baudrate $othbootargs;" \ +"console=$consoledev,$baudrate $diubootargs $othbootargs;" \"tftp $ramdiskaddr $ramdiskfile;" \"tftp $loadaddr $bootfile;" \"tftp $fdtaddr $fdtfile;" \
include/fsl_diu_fb.h +31 -60
91 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH 1/2 video: parse the video-mode environment variable
In reply to Timur TabiQuoted 13 lines · On Mon, 21 Mar 2011 16:38:49 -0500 Timur Tabi <[email protected]> wrote:
Add function
video_get_video_mode(), which parses the "video-mode" environment variable and returns each of its components. The format matches the video= command-line option used for Linux:video-mode=<driver>:<xres>x<yres>-<depth>@<freq><,option=string>
<driver> The video driver, ignored by U-Boot <xres> The X resolution (in pixels) to use. <yres> The Y resolution (in pixels) to use. <depth> The color depth (in bits) to use.
<freq> The frequency (in Hz) to use.
<options> A comma-separated list of device-specific options
Quoted 6 lines
Signed-off-by Timur Tabi <[email protected]>--- doc/README.video | 19 +++++++++++++ drivers/video/videomodes.c | 64 ++++++++++++++++++++++++++++++++++++++++++++ drivers/video/videomodes.h | 3 ++ 3 files changed, 86 insertions(+), 0 deletions(-)
appied to u-boot-video/master. Thanks!
Anatolij