Skip to contentSkip to conversation

powerpc: 'monitor' environment variable contains full video configuration

PATCH New Timur Tabi 1 participant 2 messages Mar 10, 2011 – Mar 11, 2011 Framebuffer layer

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH 1/1 powerpc: 'monitor' environment variable contains full video configuration

Update the "monitor" environment variable (for Freescale chips that have a DIU display controller) to display the full video configuration, instead of just the output monitor.

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.

Instead, the "monitor" variable is now set to a string that indicates not only the part name, but also the resolution, color depth, and refresh rate. This string is then parsed for all needed information, and can be passed to the kernel via the 'diubootargs' environment variable.

---

This patch depends on my previous patch, "[v4] powerpc: clean up DIU macro definitions for Freescale reference boards".

 README                                        |    9 +-
 board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c |   68 +-
 board/freescale/p1022ds/diu.c                 |   27 +-
 doc/README.video                              |   28 +
 drivers/video/fsl_diu_fb.c                    |  980 ++++++++++++-------------
 include/configs/MPC8610HPCD.h                 |   14 +-
 include/configs/P1022DS.h                     |   12 +-
 include/fsl_diu_fb.h                          |   91 +--
 8 files changed, 586 insertions(+), 643 deletions(-)

rewrite drivers/video/fsl_diu_fb.c (62%)
rewrite include/fsl_diu_fb.h (60%)

README +3 -6
index 9597fed..4fc35f4 100644
@@ -1072,12 +1072,9 @@ The following options need to be configured:
 			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
+		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 +29 -39

85 lines not on this page · raw message

board/freescale/p1022ds/diu.c +16 -11
index 8f5305c..a7144be 100644
@@ -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,11 @@ 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)
 {
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-	char *monitor_port;
+	const char *monitor_port;
+	const char *name;
 	u32 pixel_format;
 	u8 temp;
 
@@ -101,20 +103,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(monitor_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 +141,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
doc/README.video +28 -0
index 34e199c..fe598c6 100644
@@ -28,3 +28,31 @@ 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
+
+
+Freescale DIU video controller
+===============================
+
+This controller is found on some Freescale PowerPC SOCs, such as the MPC8610
+and the P1022.  Currently, setting the 'stdout' environment variable to 'video'
+will *not* work with this controller.  Instead, the 'monitor' environment
+variable can be used to enable and configure the driver.
+
+	monitor=<port>,<xres>x<yres>-<depth>@<freq>
+
+Example: monitor=dvi,1280x1024-32 at 60
+
+	<port>	The monitor port, usually either "lvds" or "dvi".  This
+		is a board-specific value.
+
+	<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.
+
+The "diubootargs" environment variable is also set to the string
+"video=fslfb:<xres>x<yres>-<depth>@<freq>,monitor=<port> tty0".  This variable
+allows the string to be passed to the Linux kernel via the kernel command line.
drivers/video/fsl_diu_fb.c +467 -513

980 lines not on this page · raw message

include/configs/MPC8610HPCD.h +6 -8
index de01c31..f2d47e0 100644
@@ -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
index ed2bada..29380a1 100644
@@ -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
author
#1 lore raw

PATCH 1/1 powerpc: 'monitor' environment variable contains full video configuration

Quoted 3 lines · Timur Tabi

Update the "monitor" environment variable (for Freescale chips that have a DIU display controller) to display the full video configuration, instead of just the output monitor.

This patch has a couple issues, so I'll be posting a V2 next week.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale