Commit ba8e76bd authored by Timur Tabi's avatar Timur Tabi Committed by Anatolij Gustschin

powerpc: use '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 it was used 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 was set to a number (0,
1, or sometimes 2) to specify a DVI, LVDS, or Dual-LVDS port.  The
resolution was hard-coded into board-specific code.  The Linux command-line
arguments needed to be hard-coded to the proper video definition string.
Signed-off-by: 's avatarTimur Tabi <timur@freescale.com>
Signed-off-by: 's avatarAnatolij Gustschin <agust@denx.de>
parent a5dbdc81
......@@ -1096,13 +1096,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
......
......@@ -51,20 +51,10 @@ void diu_set_pixel_clock(unsigned int pixclock)
debug("DIU: Modified value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
}
int platform_diu_init(unsigned int *xres, unsigned int *yres)
int platform_diu_init(unsigned int xres, unsigned int yres, const char *port)
{
unsigned int pixel_format;
#if defined(CONFIG_VIDEO_XRES) & defined(CONFIG_VIDEO_YRES)
*xres = CONFIG_VIDEO_XRES;
*yres = CONFIG_VIDEO_YRES;
#else
*xres = 1024;
*yres = 768;
#endif
pixel_format = 0x88883316;
unsigned int pixel_format = 0x88883316;
debug("mpc5121_diu_init\n");
return fsl_diu_init(*xres, pixel_format, 0);
return fsl_diu_init(xres, pixel_format, 0);
}
/*
* Copyright 2007 Freescale Semiconductor, Inc.
* York Sun <yorksun@freescale.com>
* Copyright 2007-2011 Freescale Semiconductor, Inc.
* Authors: York Sun <yorksun@freescale.com>
* Timur Tabi <timur@freescale.com>
*
* FSL DIU Framebuffer driver
*
......@@ -27,6 +28,10 @@
#include <command.h>
#include <asm/io.h>
#include <fsl_diu_fb.h>
#include "../common/pixis.h"
#define PX_BRDCFG0_DLINK 0x10
#define PX_BRDCFG0_DVISEL 0x08
void diu_set_pixel_clock(unsigned int pixclock)
{
......@@ -49,50 +54,34 @@ void diu_set_pixel_clock(unsigned int pixclock)
debug("DIU: Modified value of CLKDVDR = 0x%08x\n", *guts_clkdvdr);
}
int platform_diu_init(unsigned int *xres, unsigned int *yres)
int platform_diu_init(unsigned int xres, unsigned int yres, const char *port)
{
char *monitor_port;
int gamma_fix;
unsigned int pixel_format;
unsigned char tmp_val;
unsigned char pixis_arch;
u8 *pixis_base = (u8 *)PIXIS_BASE;
tmp_val = in_8(pixis_base + PIXIS_BRDCFG0);
pixis_arch = in_8(pixis_base + PIXIS_VER);
monitor_port = getenv("monitor");
if (!strncmp(monitor_port, "0", 1)) { /* 0 - DVI */
*xres = 1280;
*yres = 1024;
if (pixis_arch == 0x01)
pixel_format = 0x88882317;
else
pixel_format = 0x88883316;
gamma_fix = 0;
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val | 0x08);
const char *name;
int gamma_fix = 0;
u32 pixel_format = 0x88883316;
u8 temp;
} else if (!strncmp(monitor_port, "1", 1)) { /* 1 - Single link LVDS */
*xres = 1024;
*yres = 768;
pixel_format = 0x88883316;
gamma_fix = 0;
out_8(pixis_base + PIXIS_BRDCFG0, (tmp_val & 0xf7) | 0x10);
temp = in_8(&pixis->brdcfg0);
} else if (!strncmp(monitor_port, "2", 1)) { /* 2 - Double link LVDS */
*xres = 1280;
*yres = 1024;
pixel_format = 0x88883316;
if (strncmp(port, "dlvds", 5) == 0) {
/* Dual link LVDS */
gamma_fix = 1;
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val & 0xe7);
} else { /* DVI */
*xres = 1280;
*yres = 1024;
pixel_format = 0x88882317;
gamma_fix = 0;
out_8(pixis_base + PIXIS_BRDCFG0, tmp_val | 0x08);
temp &= ~(PX_BRDCFG0_DLINK | PX_BRDCFG0_DVISEL);
name = "Dual-Link LVDS";
} else if (strncmp(port, "lvds", 4) == 0) {
/* Single link LVDS */
temp = (temp & ~PX_BRDCFG0_DVISEL) | PX_BRDCFG0_DLINK;
name = "Single-Link LVDS";
} else {
/* DVI */
if (in_8(&pixis->ver) == 1) /* Board version */
pixel_format = 0x88882317;
temp |= PX_BRDCFG0_DVISEL;
name = "DVI";
}
return fsl_diu_init(*xres, pixel_format, gamma_fix);
printf("DIU: Switching to %s monitor @ %ux%u\n", name, xres, yres);
out_8(&pixis->brdcfg0, temp);
return fsl_diu_init(xres, pixel_format, gamma_fix);
}
......@@ -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);
}
/*
......
......@@ -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
......
This diff is collapsed.
/*
* 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@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,9 +646,7 @@
"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 \
......
......@@ -202,6 +202,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
......@@ -219,7 +221,7 @@
#undef CONFIG_SYS_FLASH_EMPTY_INFO
#endif
#ifndef CONFIG_DIU
#ifndef CONFIG_FSL_DIU_FB
#define CONFIG_ATI
#endif
......@@ -507,9 +509,7 @@
"diuregs=md e002c000 1d\0" \
"dium=mw e002c01c\0" \
"diuerr=md e002c014 1\0" \
"othbootargs=diufb=15M video=fslfb:1280x1024-32@60,monitor=0 tty0\0" \
"hwconfig=esdhc;audclk:12\0" \
"monitor=0-DVI\0"
"hwconfig=esdhc;audclk:12\0"
#define CONFIG_HDBOOT \
"setenv bootargs root=/dev/$bdev rw " \
......
......@@ -64,8 +64,6 @@
#define CONFIG_SPLASH_SCREEN
#define CONFIG_VIDEO_LOGO
#define CONFIG_VIDEO_BMP_RLE8
#define CONFIG_VIDEO_XRES 800
#define CONFIG_VIDEO_YRES 480
#endif
#define CONFIG_SYS_MPC512X_CLKIN 33333333 /* in Hz */
......
/*
* Copyright 2007 Freescale Semiconductor, Inc.
* York Sun <yorksun@freescale.com>
* Copyright 2007, 2011 Freescale Semiconductor, Inc.
* Authors: York Sun <yorksun@freescale.com>
* Timur Tabi <timur@freescale.com>
*
* FSL DIU Framebuffer driver
*
......@@ -23,38 +24,8 @@
* MA 02111-1307 USA
*/
struct fb_var_screeninfo {
unsigned int xres; /* visible resolution */
unsigned int yres;
int fsl_diu_init(int xres, u32 pixel_format, int gamma_fix);
unsigned int bits_per_pixel; /* guess what */
/* Timing: All values in pixclocks, except pixclock (of course) */
unsigned int pixclock; /* pixel clock in ps (pico seconds) */
unsigned int left_margin; /* time from sync to picture */
unsigned int right_margin; /* time from picture to sync */
unsigned int upper_margin; /* time from sync to picture */
unsigned int lower_margin;
unsigned int hsync_len; /* length of horizontal sync */
unsigned int vsync_len; /* length of vertical sync */
unsigned int sync; /* see FB_SYNC_* */
unsigned int vmode; /* see FB_VMODE_* */
unsigned int rotate; /* angle we rotate counter clockwise */
};
struct fb_info {
struct fb_var_screeninfo var; /* Current var */
unsigned long smem_start; /* Start of frame buffer mem */
/* (physical address) */
unsigned int smem_len; /* Length of frame buffer mem */
unsigned int type; /* see FB_TYPE_* */
unsigned int line_length; /* length of a line in bytes */
char *screen_base;
unsigned long screen_size;
};
extern char *fsl_fb_open(struct fb_info **info);
int fsl_diu_init(int xres, unsigned int pixel_format, int gamma_fix);
int platform_diu_init(unsigned int *xres, unsigned int *yres);
/* Prototypes for external board-specific functions */
int platform_diu_init(unsigned int xres, unsigned int yres, const char *port);
void diu_set_pixel_clock(unsigned int pixclock);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment