/*
 * (C) Copyright 2000
 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
 * (C) Copyright 2002
 * Wolfgang Denk, wd@denx.de
 *
 * 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
 */

/* #define DEBUG */

/************************************************************************/
/* ** HEADER FILES							*/
/************************************************************************/

#include <stdarg.h>
#include <common.h>
#include <config.h>
#include <version.h>
#include <i2c.h>
#include <linux/types.h>
#include <devices.h>

#ifdef CONFIG_VIDEO

DECLARE_GLOBAL_DATA_PTR;

/************************************************************************/
/* ** DEBUG SETTINGS							*/
/************************************************************************/

#if 0
#define VIDEO_DEBUG_COLORBARS	/* Force colorbars output */
#endif

/************************************************************************/
/* ** VIDEO MODE SETTINGS						*/
/************************************************************************/

#if 0
#define VIDEO_MODE_EXTENDED		/* Allow screen size bigger than visible area */
#define VIDEO_MODE_NTSC
#endif

#define VIDEO_MODE_PAL

#if 0
#define VIDEO_BLINK			/* This enables cursor blinking (under construction) */
#endif

#define VIDEO_INFO			/* Show U-Boot information */
#define VIDEO_INFO_X		VIDEO_LOGO_WIDTH+8
#define VIDEO_INFO_Y		16

/************************************************************************/
/* ** VIDEO ENCODER CONSTANTS						*/
/************************************************************************/

#ifdef CONFIG_VIDEO_ENCODER_AD7176

#include <video_ad7176.h>	/* Sets encoder data, mode, and visible and active area */

#define VIDEO_I2C		1
#define VIDEO_I2C_ADDR		CONFIG_VIDEO_ENCODER_AD7176_ADDR
#endif

#ifdef CONFIG_VIDEO_ENCODER_AD7177

#include <video_ad7177.h>	/* Sets encoder data, mode, and visible and active area */

#define VIDEO_I2C		1
#define VIDEO_I2C_ADDR		CONFIG_VIDEO_ENCODER_AD7177_ADDR
#endif

#ifdef CONFIG_VIDEO_ENCODER_AD7179

#include <video_ad7179.h>	/* Sets encoder data, mode, and visible and active area */

#define VIDEO_I2C		1
#define VIDEO_I2C_ADDR		CONFIG_VIDEO_ENCODER_AD7179_ADDR
#endif

/************************************************************************/
/* ** VIDEO MODE CONSTANTS						*/
/************************************************************************/

#ifdef VIDEO_MODE_EXTENDED
#define VIDEO_COLS	VIDEO_ACTIVE_COLS
#define VIDEO_ROWS	VIDEO_ACTIVE_ROWS
#else
#define VIDEO_COLS	VIDEO_VISIBLE_COLS
#define VIDEO_ROWS	VIDEO_VISIBLE_ROWS
#endif

#define VIDEO_PIXEL_SIZE	(VIDEO_MODE_BPP/8)
#define VIDEO_SIZE		(VIDEO_ROWS*VIDEO_COLS*VIDEO_PIXEL_SIZE)	/* Total size of buffer */
#define VIDEO_PIX_BLOCKS	(VIDEO_SIZE >> 2)	/* Number of ints */
#define VIDEO_LINE_LEN		(VIDEO_COLS*VIDEO_PIXEL_SIZE)	/* Number of bytes per line */
#define VIDEO_BURST_LEN		(VIDEO_COLS/8)

#ifdef VIDEO_MODE_YUYV
#define VIDEO_BG_COL	0x80D880D8	/* Background color in YUYV format */
#else
#define VIDEO_BG_COL	0xF8F8F8F8	/* Background color in RGB format */
#endif

/************************************************************************/
/* ** FONT AND LOGO DATA						*/
/************************************************************************/

#include <video_font.h>			/* Get font data, width and height */

#ifdef CONFIG_VIDEO_LOGO
#include <video_logo.h>			/* Get logo data, width and height */

#define VIDEO_LOGO_WIDTH	DEF_U_BOOT_LOGO_WIDTH
#define VIDEO_LOGO_HEIGHT	DEF_U_BOOT_LOGO_HEIGHT
#define VIDEO_LOGO_ADDR		&u_boot_logo
#endif

/************************************************************************/
/* ** VIDEO CONTROLLER CONSTANTS					*/
/************************************************************************/

/* VCCR - VIDEO CONTROLLER CONFIGURATION REGISTER */

#define VIDEO_VCCR_VON	0		/* Video controller ON */
#define VIDEO_VCCR_CSRC	1		/* Clock source */
#define VIDEO_VCCR_PDF	13		/* Pixel display format */
#define VIDEO_VCCR_IEN	11		/* Interrupt enable */

/* VSR - VIDEO STATUS REGISTER */

#define VIDEO_VSR_CAS	6		/* Active set */
#define VIDEO_VSR_EOF	0		/* End of frame */

/* VCMR - VIDEO COMMAND REGISTER */

#define VIDEO_VCMR_BD	0		/* Blank display */
#define VIDEO_VCMR_ASEL	1		/* Active set selection */

/* VBCB - VIDEO BACKGROUND COLOR BUFFER REGISTER */

#define VIDEO_BCSR4_RESET_BIT	21	/* BCSR4 - Extern video encoder reset */
#define VIDEO_BCSR4_EXTCLK_BIT	22	/* BCSR4 - Extern clock enable */
#define VIDEO_BCSR4_VIDLED_BIT	23	/* BCSR4 - Video led disable */

/************************************************************************/
/* ** CONSOLE CONSTANTS							*/
/************************************************************************/

#ifdef	CONFIG_VIDEO_LOGO
#define CONSOLE_ROWS		((VIDEO_ROWS - VIDEO_LOGO_HEIGHT) / VIDEO_FONT_HEIGHT)
#define VIDEO_LOGO_SKIP		(VIDEO_COLS - VIDEO_LOGO_WIDTH)
#else
#define CONSOLE_ROWS		(VIDEO_ROWS / VIDEO_FONT_HEIGHT)
#endif

#define CONSOLE_COLS		(VIDEO_COLS / VIDEO_FONT_WIDTH)
#define CONSOLE_ROW_SIZE	(VIDEO_FONT_HEIGHT * VIDEO_LINE_LEN)
#define CONSOLE_ROW_FIRST	(video_console_address)
#define CONSOLE_ROW_SECOND	(video_console_address + CONSOLE_ROW_SIZE)
#define CONSOLE_ROW_LAST	(video_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE)
#define CONSOLE_SIZE		(CONSOLE_ROW_SIZE * CONSOLE_ROWS)
#define CONSOLE_SCROLL_SIZE	(CONSOLE_SIZE - CONSOLE_ROW_SIZE)

/*
 * Simple color definitions
 */
#define CONSOLE_COLOR_BLACK	 0
#define CONSOLE_COLOR_RED	 1
#define CONSOLE_COLOR_GREEN	 2
#define CONSOLE_COLOR_YELLOW	 3
#define CONSOLE_COLOR_BLUE	 4
#define CONSOLE_COLOR_MAGENTA	 5
#define CONSOLE_COLOR_CYAN	 6
#define CONSOLE_COLOR_GREY	13
#define CONSOLE_COLOR_GREY2	14
#define CONSOLE_COLOR_WHITE	15	/* Must remain last / highest */

/************************************************************************/
/* ** BITOPS MACROS							*/
/************************************************************************/

#define HISHORT(i)	((i >> 16)&0xffff)
#define LOSHORT(i)	(i & 0xffff)
#define HICHAR(s)	((i >> 8)&0xff)
#define LOCHAR(s)	(i & 0xff)
#define HI(c)		((c >> 4)&0xf)
#define LO(c)		(c & 0xf)
#define SWAPINT(i)	(HISHORT(i) | (LOSHORT(i) << 16))
#define SWAPSHORT(s)	(HICHAR(s) | (LOCHAR(s) << 8))
#define SWAPCHAR(c)	(HI(c) | (LO(c) << 4))
#define BITMASK(b)	(1 << (b))
#define GETBIT(v,b)	(((v) & BITMASK(b)) > 0)
#define SETBIT(v,b,d)	(v = (((d)>0) ? (v) | BITMASK(b): (v) & ~BITMASK(b)))

/************************************************************************/
/* ** STRUCTURES							*/
/************************************************************************/

typedef struct {
	unsigned char V, Y1, U, Y2;
} tYUYV;

/* This structure is based on the Video Ram in the MPC823. */
typedef struct VRAM {
	unsigned	hx:2,		/* Horizontal sync */
			vx:2,		/* Vertical sync */
			fx:2,		/* Frame */
			bx:2,		/* Blank */
			res1:6,		/* Reserved */
			vds:2,		/* Video Data Select */
			inter:1,	/* Interrupt */
			res2:2,		/* Reserved */
			lcyc:11,	/* Loop/video cycles */
			lp:1,		/* Loop start/end */
			lst:1;		/* Last entry */
} VRAM;

/************************************************************************/
/* ** VARIABLES								*/
/************************************************************************/

static int
	video_panning_range_x = 0,	/* Video mode invisible pixels x range */
	video_panning_range_y = 0,	/* Video mode invisible pixels y range */
	video_panning_value_x = 0,	/* Video mode x panning value (absolute) */
	video_panning_value_y = 0,	/* Video mode y panning value (absolute) */
	video_panning_factor_x = 0,	/* Video mode x panning value (-127 +127) */
	video_panning_factor_y = 0,	/* Video mode y panning value (-127 +127) */
	console_col = 0,		/* Cursor col */
	console_row = 0,		/* Cursor row */
	video_palette[16];		/* Our palette */

static const int video_font_draw_table[] =
	{ 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff };

static char
	video_color_fg = 0,		/* Current fg color index (0-15) */
	video_color_bg = 0,		/* Current bg color index (0-15) */
	video_enable = 0;		/* Video has been initialized? */

static void
	*video_fb_address,		/* Frame buffer address */
	*video_console_address;		/* Console frame buffer start address */

/************************************************************************/
/* ** MEMORY FUNCTIONS (32bit)						*/
/************************************************************************/

static void memsetl (int *p, int c, int v)
{
	while (c--)
		*(p++) = v;
}

static void memcpyl (int *d, int *s, int c)
{
	while (c--)
		*(d++) = *(s++);
}

/************************************************************************/
/* ** VIDEO DRAWING AND COLOR FUNCTIONS					*/
/************************************************************************/

static int video_maprgb (int r, int g, int b)
{
#ifdef VIDEO_MODE_YUYV
	unsigned int pR, pG, pB;
	tYUYV YUYV;
	unsigned int *ret = (unsigned int *) &YUYV;

	/* Transform (0-255) components to (0-100) */

	pR = r * 100 / 255;
	pG = g * 100 / 255;
	pB = b * 100 / 255;

	/* Calculate YUV values (0-255) from RGB beetween 0-100 */

	YUYV.Y1 = YUYV.Y2 = 209 * (pR + pG + pB) / 300 + 16;
	YUYV.U	= pR - (pG * 3 / 4) - (pB / 4) + 128;
	YUYV.V	= pB - (pR / 4) - (pG * 3 / 4) + 128;
	return *ret;
#endif
#ifdef VIDEO_MODE_RGB
	return ((r >> 3) << 11) | ((g > 2) << 6) | (b >> 3);
#endif
}

static void video_setpalette (int color, int r, int g, int b)
{
	color &= 0xf;

	video_palette[color] = video_maprgb (r, g, b);

	/* Swap values if our panning offset is odd */
	if (video_panning_value_x & 1)
		video_palette[color] = SWAPINT (video_palette[color]);
}

static void video_fill (int color)
{
	memsetl (video_fb_address, VIDEO_PIX_BLOCKS, color);
}

static void video_setfgcolor (int i)
{
	video_color_fg = i & 0xf;
}

static void video_setbgcolor (int i)
{
	video_color_bg = i & 0xf;
}

static int video_pickcolor (int i)
{
	return video_palette[i & 0xf];
}

/* Absolute console plotting functions */

#ifdef VIDEO_BLINK
static void video_revchar (int xx, int yy)
{
	int rows;
	u8 *dest;

	dest = video_fb_address + yy * VIDEO_LINE_LEN + xx * 2;

	for (rows = VIDEO_FONT_HEIGHT; rows--; dest += VIDEO_LINE_LEN) {
		switch (VIDEO_FONT_WIDTH) {
		case 16:
			((u32 *) dest)[6] ^= 0xffffffff;
			((u32 *) dest)[7] ^= 0xffffffff;
			/* FALL THROUGH */
		case 12:
			((u32 *) dest)[4] ^= 0xffffffff;
			((u32 *) dest)[5] ^= 0xffffffff;
			/* FALL THROUGH */
		case 8:
			((u32 *) dest)[2] ^= 0xffffffff;
			((u32 *) dest)[3] ^= 0xffffffff;
			/* FALL THROUGH */
		case 4:
			((u32 *) dest)[0] ^= 0xffffffff;
			((u32 *) dest)[1] ^= 0xffffffff;
		}
	}
}
#endif

static void video_drawchars (int xx, int yy, unsigned char *s, int count)
{
	u8 *cdat, *dest, *dest0;
	int rows, offset, c;
	u32 eorx, fgx, bgx;

	offset = yy * VIDEO_LINE_LEN + xx * 2;
	dest0 = video_fb_address + offset;

	fgx = video_pickcolor (video_color_fg);
	bgx = video_pickcolor (video_color_bg);

	if (xx & 1) {
		fgx = SWAPINT (fgx);
		bgx = SWAPINT (bgx);
	}

	eorx = fgx ^ bgx;

	switch (VIDEO_FONT_WIDTH) {
	case 4:
	case 8:
		while (count--) {
			c = *s;
			cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
			for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
			     rows--;
			     dest += VIDEO_LINE_LEN) {
				u8 bits = *cdat++;

				((u32 *) dest)[0] =
					(video_font_draw_table[bits >> 6] & eorx) ^ bgx;
				((u32 *) dest)[1] =
					(video_font_draw_table[bits >> 4 & 3] & eorx) ^ bgx;
				if (VIDEO_FONT_WIDTH == 8) {
					((u32 *) dest)[2] =
						(video_font_draw_table[bits >> 2 & 3] & eorx) ^ bgx;
					((u32 *) dest)[3] =
						(video_font_draw_table[bits & 3] & eorx) ^ bgx;
				}
			}
			dest0 += VIDEO_FONT_WIDTH * 2;
			s++;
		}
		break;
	case 12:
	case 16:
		while (count--) {
			cdat = video_fontdata + (*s) * (VIDEO_FONT_HEIGHT << 1);
			for (rows = VIDEO_FONT_HEIGHT, dest = dest0; rows--;
				 dest += VIDEO_LINE_LEN) {
				u8 bits = *cdat++;

				((u32 *) dest)[0] =
					(video_font_draw_table[bits >> 6] & eorx) ^ bgx;
				((u32 *) dest)[1] =
					(video_font_draw_table[bits >> 4 & 3] & eorx) ^ bgx;
				((u32 *) dest)[2] =
					(video_font_draw_table[bits >> 2 & 3] & eorx) ^ bgx;
				((u32 *) dest)[3] =
					(video_font_draw_table[bits & 3] & eorx) ^ bgx;
				bits = *cdat++;
				((u32 *) dest)[4] =
					(video_font_draw_table[bits >> 6] & eorx) ^ bgx;
				((u32 *) dest)[5] =
					(video_font_draw_table[bits >> 4 & 3] & eorx) ^ bgx;
				if (VIDEO_FONT_WIDTH == 16) {
					((u32 *) dest)[6] =
						(video_font_draw_table[bits >> 2 & 3] & eorx) ^ bgx;
					((u32 *) dest)[7] =
						(video_font_draw_table[bits & 3] & eorx) ^ bgx;
				}
			}
			s++;
			dest0 += VIDEO_FONT_WIDTH * 2;
		}
		break;
	}
}

static inline void video_drawstring (int xx, int yy, char *s)
{
	video_drawchars (xx, yy, (unsigned char *)s, strlen (s));
}

/* Relative to console plotting functions */

static void video_putchars (int xx, int yy, unsigned char *s, int count)
{
#ifdef CONFIG_VIDEO_LOGO
	video_drawchars (xx, yy + VIDEO_LOGO_HEIGHT, s, count);
#else
	video_drawchars (xx, yy, s, count);
#endif
}

static void video_putchar (int xx, int yy, unsigned char c)
{
#ifdef CONFIG_VIDEO_LOGO
	video_drawchars (xx, yy + VIDEO_LOGO_HEIGHT, &c, 1);
#else
	video_drawchars (xx, yy, &c, 1);
#endif
}

static inline void video_putstring (int xx, int yy, unsigned char *s)
{
	video_putchars (xx, yy, (unsigned char *)s, strlen ((char *)s));
}

/************************************************************************/
/* ** VIDEO CONTROLLER LOW-LEVEL FUNCTIONS				*/
/************************************************************************/

#if !defined(CONFIG_RRVISION)
static void video_mode_dupefield (VRAM * source, VRAM * dest, int entries)
{
	int i;

	for (i = 0; i < entries; i++) {
		dest[i] = source[i];	/* Copy the entire record */
		dest[i].fx = (!dest[i].fx) * 3;	/* Negate field bit */
	}

	dest[0].lcyc++;			/* Add a cycle to the first entry */
	dest[entries - 1].lst = 1;	/* Set end of ram entries */
}
#endif

static void inline video_mode_addentry (VRAM * vr,
	int Hx, int Vx, int Fx, int Bx,
	int VDS, int INT, int LCYC, int LP, int LST)
{
	vr->hx = Hx;
	vr->vx = Vx;
	vr->fx = Fx;
	vr->bx = Bx;
	vr->vds = VDS;
	vr->inter = INT;
	vr->lcyc = LCYC;
	vr->lp = LP;
	vr->lst = LST;
}

#define ADDENTRY(a,b,c,d,e,f,g,h,i)	video_mode_addentry(&vr[entry++],a,b,c,d,e,f,g,h,i)

static int video_mode_generate (void)
{
	immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
	VRAM *vr = (VRAM *) (((void *) immap) + 0xb00);	/* Pointer to the VRAM table */
	int DX, X1, X2, DY, Y1, Y2, entry = 0, fifo;

	/* CHECKING PARAMETERS */

	if (video_panning_factor_y < -128)
		video_panning_factor_y = -128;

	if (video_panning_factor_y > 128)
		video_panning_factor_y = 128;

	if (video_panning_factor_x < -128)
		video_panning_factor_x = -128;

	if (video_panning_factor_x > 128)
		video_panning_factor_x = 128;

	/* Setting panning */

	DX = video_panning_range_x = (VIDEO_ACTIVE_COLS - VIDEO_COLS) * 2;
	DY = video_panning_range_y = (VIDEO_ACTIVE_ROWS - VIDEO_ROWS) / 2;

	video_panning_value_x = (video_panning_factor_x + 128) * DX / 256;
	video_panning_value_y = (video_panning_factor_y + 128) * DY / 256;

	/* We assume these are burst units (multiplied by 2, we need it pari) */
	X1 = video_panning_value_x & 0xfffe;
	X2 = DX - X1;

	/* We assume these are field line units (divided by 2, we need it pari) */
	Y1 = video_panning_value_y & 0xfffe;
	Y2 = DY - Y1;

	debug("X1=%d, X2=%d, Y1=%d, Y2=%d, DX=%d, DY=%d VIDEO_COLS=%d \n",
	      X1, X2, Y1, Y2, DX, DY, VIDEO_COLS);

#ifdef VIDEO_MODE_NTSC
/*
 *	     Hx Vx Fx Bx VDS INT LCYC LP LST
 *
 * Retrace blanking
 */
	ADDENTRY (0, 0, 3, 0, 1, 0, 3, 1, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 243, 0, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 1440, 0, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
/*
 * Vertical blanking
 */
	ADDENTRY (0, 0, 0, 0, 1, 0, 18, 1, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 243, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
/*
 * Odd field active area (TOP)
 */
	if (Y1 > 0) {
		ADDENTRY (0, 0, 0, 0, 1, 0, Y1, 1, 0);
		ADDENTRY (3, 0, 0, 0, 1, 0, 235, 0, 0);
		ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
		ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
	}
/*
 * Odd field active area
 */
	ADDENTRY (0, 0, 0, 0, 1, 0, 240 - DY, 1, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 235, 0, 0);
	ADDENTRY (3, 0, 0, 3, 1, 0, 8 + X1, 0, 0);
	ADDENTRY (3, 0, 0, 3, 0, 0, VIDEO_COLS * 2, 0, 0);

	if (X2 > 0)
		ADDENTRY (3, 0, 0, 3, 1, 0, X2, 0, 0);

	ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);

/*
 * Odd field active area (BOTTOM)
 */
	if (Y1 > 0) {
		ADDENTRY (0, 0, 0, 0, 1, 0, Y2, 1, 0);
		ADDENTRY (3, 0, 0, 0, 1, 0, 235, 0, 0);
		ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
		ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
	}
/*
 * Vertical blanking
 */
	ADDENTRY (0, 0, 0, 0, 1, 0, 4, 1, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 243, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
/*
 * Vertical blanking
 */
	ADDENTRY (0, 0, 3, 0, 1, 0, 19, 1, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 243, 0, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 1440, 0, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
/*
 * Even field active area (TOP)
 */
	if (Y1 > 0) {
		ADDENTRY (0, 0, 3, 0, 1, 0, Y1, 1, 0);
		ADDENTRY (3, 0, 3, 0, 1, 0, 235, 0, 0);
		ADDENTRY (3, 0, 3, 3, 1, 0, 1448, 0, 0);
		ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
	}
/*
 * Even field active area (CENTER)
 */
	ADDENTRY (0, 0, 3, 0, 1, 0, 240 - DY, 1, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 235, 0, 0);
	ADDENTRY (3, 0, 3, 3, 1, 0, 8 + X1, 0, 0);
	ADDENTRY (3, 0, 3, 3, 0, 0, VIDEO_COLS * 2, 0, 0);

	if (X2 > 0)
		ADDENTRY (3, 0, 3, 3, 1, 0, X2, 0, 0);

	ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
/*
 * Even field active area (BOTTOM)
 */
	if (Y1 > 0) {
		ADDENTRY (0, 0, 3, 0, 1, 0, Y2, 1, 0);
		ADDENTRY (3, 0, 3, 0, 1, 0, 235, 0, 0);
		ADDENTRY (3, 0, 3, 3, 1, 0, 1448, 0, 0);
		ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
	}
/*
 * Vertical blanking
 */
	ADDENTRY (0, 0, 3, 0, 1, 0, 1, 1, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 243, 0, 0);
	ADDENTRY (3, 0, 3, 0, 1, 0, 1440, 0, 0);
	ADDENTRY (3, 0, 3, 0, 1, 1, 32, 1, 1);
#endif

#ifdef VIDEO_MODE_PAL

#if defined(CONFIG_RRVISION)

#define HPW   160  /* horizontal pulse width (was 139)	*/
#define VPW	2  /* vertical pulse width		*/
#define HBP   104  /* horizontal back porch (was 112)	*/
#define VBP    19  /* vertical back porch (was 19)	*/
#define VID_R 240  /* number of rows			*/

	debug ("[VIDEO CTRL] Starting to add controller entries...");
/*
 * Even field
 */
	ADDENTRY (0, 3, 0, 3, 1, 0, 2, 0, 0);
	ADDENTRY (0, 0, 0, 3, 1, 0, HPW, 0, 0);
	ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 0, 0);

	ADDENTRY (0, 0, 0, 3, 1, 0, VPW, 1, 0);
	ADDENTRY (0, 0, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);

	ADDENTRY (0, 3, 0, 3, 1, 0, VBP, 1, 0);
	ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);
/*
 * Active area
 */
	ADDENTRY (0, 3, 0, 3, 1, 0, VID_R , 1, 0);
	ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, HBP, 0, 0);
	ADDENTRY (3, 3, 0, 3, 0, 0, VIDEO_COLS*2, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, 72, 1, 1);

	ADDENTRY (0, 3, 0, 3, 1, 0, 51, 1, 0);
	ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, HBP +(VIDEO_COLS * 2) + 72 , 1, 0);
/*
 * Odd field
 */
	ADDENTRY (0, 3, 0, 3, 1, 0, 2, 0, 0);
	ADDENTRY (0, 0, 0, 3, 1, 0, HPW, 0, 0);
	ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 0, 0);

	ADDENTRY (0, 0, 0, 3, 1, 0, VPW+1, 1, 0);
	ADDENTRY (0, 0, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);

	ADDENTRY (0, 3, 0, 3, 1, 0, VBP, 1, 0);
	ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);
/*
 * Active area
 */
	ADDENTRY (0, 3, 0, 3, 1, 0, VID_R , 1, 0);
	ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, HBP, 0, 0);
	ADDENTRY (3, 3, 0, 3, 0, 0, VIDEO_COLS*2, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, 72, 1, 1);

	ADDENTRY (0, 3, 0, 3, 1, 0, 51, 1, 0);
	ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
	ADDENTRY (3, 3, 0, 3, 1, 0, HBP +(VIDEO_COLS * 2) + 72 , 1, 0);

	debug ("done\n");

#else  /* !CONFIG_RRVISION */

/*
 *	Hx Vx Fx Bx VDS INT LCYC LP LST
 *
 * vertical; blanking
 */
	ADDENTRY (0, 0, 0, 0, 1, 0, 22, 1, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 263, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
/*
 * active area (TOP)
 */
	if (Y1 > 0) {
		ADDENTRY (0, 0, 0, 0, 1, 0, Y1, 1, 0);	/* 11? */
		ADDENTRY (3, 0, 0, 0, 1, 0, 255, 0, 0);
		ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
		ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
	}
/*
 * field active area (CENTER)
 */
	ADDENTRY (0, 0, 0, 0, 1, 0, 288 - DY, 1, 0);	/* 265? */
	ADDENTRY (3, 0, 0, 0, 1, 0, 255, 0, 0);
	ADDENTRY (3, 0, 0, 3, 1, 0, 8 + X1, 0, 0);
	ADDENTRY (3, 0, 0, 3, 0, 0, VIDEO_COLS * 2, 0, 0);

	if (X2 > 0)
		ADDENTRY (3, 0, 0, 1, 1, 0, X2, 0, 0);

	ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
/*
 * field active area (BOTTOM)
 */
	if (Y2 > 0) {
		ADDENTRY (0, 0, 0, 0, 1, 0, Y2, 1, 0);	/* 12? */
		ADDENTRY (3, 0, 0, 0, 1, 0, 255, 0, 0);
		ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
		ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
	}
/*
 * field vertical; blanking
 */
	ADDENTRY (0, 0, 0, 0, 1, 0, 2, 1, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 263, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
	ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
/*
 * Create the other field (like this, but whit other field selected,
 * one more cycle loop and a last identifier)
 */
	video_mode_dupefield (vr, &vr[entry], entry);
#endif /* CONFIG_RRVISION */

#endif /* VIDEO_MODE_PAL */

	/* See what FIFO are we using */
	fifo = GETBIT (immap->im_vid.vid_vsr, VIDEO_VSR_CAS);

	/* Set number of lines and burst (only one frame for now) */
	if (fifo) {
		immap->im_vid.vid_vfcr0 = VIDEO_BURST_LEN |
			(VIDEO_BURST_LEN << 8) | ((VIDEO_ROWS / 2) << 19);
	} else {
		immap->im_vid.vid_vfcr1 = VIDEO_BURST_LEN |
			(VIDEO_BURST_LEN << 8) | ((VIDEO_ROWS / 2) << 19);
	}

	SETBIT (immap->im_vid.vid_vcmr, VIDEO_VCMR_ASEL, !fifo);

/*
 * Wait until changes are applied (not done)
 * while (GETBIT(immap->im_vid.vid_vsr, VIDEO_VSR_CAS) == fifo) ;
 */

	/* Return number of VRAM entries */
	return entry * 2;
}

static void video_encoder_init (void)
{
#ifdef VIDEO_I2C
	int rc;

	/* Initialize the I2C */
	debug ("[VIDEO ENCODER] Initializing I2C bus...\n");
	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);

#ifdef CONFIG_FADS
	/* Reset ADV7176 chip */
	debug ("[VIDEO ENCODER] Resetting encoder...\n");
	(*(int *) BCSR4) &= ~(1 << 21);

	/* Wait for 5 ms inside the reset */
	debug ("[VIDEO ENCODER] Waiting for encoder reset...\n");
	udelay (5000);

	/* Take ADV7176 out of reset */
	(*(int *) BCSR4) |= 1 << 21;

	/* Wait for 5 ms after the reset */
	udelay (5000);
#endif	/* CONFIG_FADS */

	/* Send configuration */
#ifdef DEBUG
	{
		int i;

		puts ("[VIDEO ENCODER] Configuring the encoder...\n");

		printf ("Sending %zu bytes (@ %08lX) to I2C 0x%lX:\n   ",
			sizeof(video_encoder_data),
			(ulong)video_encoder_data,
			(ulong)VIDEO_I2C_ADDR);
		for (i=0; i<sizeof(video_encoder_data); ++i) {
			printf(" %02X", video_encoder_data[i]);
		}
		putc ('\n');
	}
#endif	/* DEBUG */

	if ((rc = i2c_write (VIDEO_I2C_ADDR, 0, 1,
			 video_encoder_data,
			 sizeof(video_encoder_data))) != 0) {
		printf ("i2c_send error: rc=%d\n", rc);
		return;
	}
#endif	/* VIDEO_I2C */
	return;
}

static void video_ctrl_init (void *memptr)
{
	immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;

	video_fb_address = memptr;

	/* Set background */
	debug ("[VIDEO CTRL] Setting background color...\n");
	immap->im_vid.vid_vbcb = VIDEO_BG_COL;

	/* Show the background */
	debug ("[VIDEO CTRL] Forcing background...\n");
	SETBIT (immap->im_vid.vid_vcmr, VIDEO_VCMR_BD, 1);

	/* Turn off video controller */
	debug ("[VIDEO CTRL] Turning off video controller...\n");
	SETBIT (immap->im_vid.vid_vccr, VIDEO_VCCR_VON, 0);

#ifdef CONFIG_FADS
	/* Turn on Video Port LED */
	debug ("[VIDEO CTRL] Turning off video port led...\n");
	SETBIT (*(int *) BCSR4, VIDEO_BCSR4_VIDLED_BIT, 1);

	/* Disable internal clock */
	debug ("[VIDEO CTRL] Disabling internal clock...\n");
	SETBIT (*(int *) BCSR4, VIDEO_BCSR4_EXTCLK_BIT, 0);
#endif

	/* Generate and make active a new video mode */
	debug ("[VIDEO CTRL] Generating video mode...\n");
	video_mode_generate ();

	/* Start of frame buffer (even and odd frame, to make it working with */
	/* any selected active set) */
	debug ("[VIDEO CTRL] Setting frame buffer address...\n");
	immap->im_vid.vid_vfaa1 =
		immap->im_vid.vid_vfaa0 = (u32) video_fb_address;
	immap->im_vid.vid_vfba1 =
	immap->im_vid.vid_vfba0 =
		(u32) video_fb_address + VIDEO_LINE_LEN;

	/* YUV, Big endian, SHIFT/CLK/CLK input (BEFORE ENABLING 27MHZ EXT CLOCK) */
	debug ("[VIDEO CTRL] Setting pixel mode and clocks...\n");
	immap->im_vid.vid_vccr = 0x2042;

	/* Configure port pins */
	debug ("[VIDEO CTRL] Configuring input/output pins...\n");
	immap->im_ioport.iop_pdpar = 0x1fff;
	immap->im_ioport.iop_pddir = 0x0000;

#ifdef CONFIG_FADS
	/* Turn on Video Port Clock - ONLY AFTER SET VCCR TO ENABLE EXTERNAL CLOCK */
	debug ("[VIDEO CTRL] Turning on video clock...\n");
	SETBIT (*(int *) BCSR4, VIDEO_BCSR4_EXTCLK_BIT, 1);

	/* Turn on Video Port LED */
	debug ("[VIDEO CTRL] Turning on video port led...\n");
	SETBIT (*(int *) BCSR4, VIDEO_BCSR4_VIDLED_BIT, 0);
#endif
#ifdef CONFIG_RRVISION
	debug ("PC5->Output(1): enable PAL clock");
	immap->im_ioport.iop_pcpar &= ~(0x0400);
	immap->im_ioport.iop_pcdir |=   0x0400 ;
	immap->im_ioport.iop_pcdat |=   0x0400 ;
	debug ("PDPAR=0x%04X PDDIR=0x%04X PDDAT=0x%04X\n",
	       immap->im_ioport.iop_pdpar,
	       immap->im_ioport.iop_pddir,
	       immap->im_ioport.iop_pddat);
	debug ("PCPAR=0x%04X PCDIR=0x%04X PCDAT=0x%04X\n",
	       immap->im_ioport.iop_pcpar,
	       immap->im_ioport.iop_pcdir,
	       immap->im_ioport.iop_pcdat);
#endif	/* CONFIG_RRVISION */

	/* Blanking the screen. */
	debug ("[VIDEO CTRL] Blanking the screen...\n");
	video_fill (VIDEO_BG_COL);

	/*
	 * Turns on Aggressive Mode. Normally, turning on the caches
	 * will cause the screen to flicker when the caches try to
	 * fill. This gives the FIFO's for the Video Controller
	 * higher priority and prevents flickering because of
	 * underrun. This may still be an issue when using FLASH,
	 * since accessing data from Flash is so slow.
	 */
	debug ("[VIDEO CTRL] Turning on aggressive mode...\n");
	immap->im_siu_conf.sc_sdcr = 0x40;

	/* Turn on video controller */
	debug ("[VIDEO CTRL] Turning on video controller...\n");
	SETBIT (immap->im_vid.vid_vccr, VIDEO_VCCR_VON, 1);

	/* Show the display */
	debug ("[VIDEO CTRL] Enabling the video...\n");
	SETBIT (immap->im_vid.vid_vcmr, VIDEO_VCMR_BD, 0);
}

/************************************************************************/
/* ** CONSOLE FUNCTIONS							*/
/************************************************************************/

static void console_scrollup (void)
{
	/* Copy up rows ignoring the first one */
	memcpyl (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE >> 2);

	/* Clear the last one */
	memsetl (CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, VIDEO_BG_COL);
}

static inline void console_back (void)
{
	console_col--;

	if (console_col < 0) {
		console_col = CONSOLE_COLS - 1;
		console_row--;
		if (console_row < 0)
			console_row = 0;
	}

	video_putchar ( console_col * VIDEO_FONT_WIDTH,
			console_row * VIDEO_FONT_HEIGHT, ' ');
}

static inline void console_newline (void)
{
	console_row++;
	console_col = 0;

	/* Check if we need to scroll the terminal */
	if (console_row >= CONSOLE_ROWS) {
		/* Scroll everything up */
		console_scrollup ();

		/* Decrement row number */
		console_row--;
	}
}

void video_putc (const char c)
{
	if (!video_enable) {
		serial_putc (c);
		return;
	}

	switch (c) {
	case 13:			/* Simply ignore this */
		break;

	case '\n':			/* Next line, please */
		console_newline ();
		break;

	case 9:				/* Tab (8 chars alignment) */
		console_col |= 0x0008;	/* Next 8 chars boundary */
		console_col &= ~0x0007;	/* Set this bit to zero */

		if (console_col >= CONSOLE_COLS)
			console_newline ();
		break;

	case 8:				/* Eat last character */
		console_back ();
		break;

	default:			/* Add to the console */
		video_putchar ( console_col * VIDEO_FONT_WIDTH,
				console_row * VIDEO_FONT_HEIGHT, c);
		console_col++;
		/* Check if we need to go to next row */
		if (console_col >= CONSOLE_COLS)
			console_newline ();
	}
}

void video_puts (const char *s)
{
	int count = strlen (s);

	if (!video_enable)
		while (count--)
			serial_putc (*s++);
	else
		while (count--)
			video_putc (*s++);
}

/************************************************************************/
/* ** CURSOR BLINKING FUNCTIONS						*/
/************************************************************************/

#ifdef VIDEO_BLINK

#define BLINK_TIMER_ID		0
#define BLINK_TIMER_HZ		2

static unsigned char blink_enabled = 0;
static timer_t blink_timer;

static void blink_update (void)
{
	static int blink_row = -1, blink_col = -1, blink_old = 0;

	/* Check if we have a new position to invert */
	if ((console_row != blink_row) || (console_col != blink_col)) {
		/* Check if we need to reverse last character */
		if (blink_old)
			video_revchar ( blink_col * VIDEO_FONT_WIDTH,
					(blink_row
#ifdef CONFIG_VIDEO_LOGO
					 + VIDEO_LOGO_HEIGHT
#endif
					) * VIDEO_FONT_HEIGHT);

		/* Update values */
		blink_row = console_row;
		blink_col = console_col;
		blink_old = 0;
	}

/* Reverse this character */
	blink_old = !blink_old;
	video_revchar ( console_col * VIDEO_FONT_WIDTH,
			(console_row
#ifdef CONFIG_VIDEO_LOGO
			+ VIDEO_LOGO_HEIGHT
#endif
			) * VIDEO_FONT_HEIGHT);

}

/*
 * Handler for blinking cursor
 */
static void blink_handler (void *arg)
{
/* Blink */
	blink_update ();
/* Ack the timer */
	timer_ack (&blink_timer);
}

int blink_set (int blink)
{
	int ret = blink_enabled;

	if (blink)
		timer_enable (&blink_timer);
	else
		timer_disable (&blink_timer);

	blink_enabled = blink;

	return ret;
}

static inline void blink_close (void)
{
	timer_close (&blink_timer);
}

static inline void blink_init (void)
{
	timer_init (&blink_timer,
			BLINK_TIMER_ID, BLINK_TIMER_HZ,
			blink_handler);
}
#endif

/************************************************************************/
/* ** LOGO PLOTTING FUNCTIONS						*/
/************************************************************************/

#ifdef CONFIG_VIDEO_LOGO
void easylogo_plot (fastimage_t * image, void *screen, int width, int x,
					int y)
{
	int skip = width - image->width, xcount, ycount = image->height;

#ifdef VIDEO_MODE_YUYV
	ushort *source = (ushort *) image->data;
	ushort *dest   = (ushort *) screen + y * width + x;

	while (ycount--) {
		xcount = image->width;
		while (xcount--)
			*dest++ = *source++;
		dest += skip;
	}
#endif
#ifdef VIDEO_MODE_RGB
	unsigned char
	*source = (unsigned short *) image->data,
			*dest = (unsigned short *) screen + ((y * width) + x) * 3;

	while (ycount--) {
		xcount = image->width * 3;
		memcpy (dest, source, xcount);
		source += xcount;
		dest += ycount;
	}
#endif
}

static void *video_logo (void)
{
	u16 *screen = video_fb_address, width = VIDEO_COLS;
#ifdef VIDEO_INFO
# ifndef CONFIG_FADS
	char temp[32];
# endif
	char info[80];
#endif /* VIDEO_INFO */

	easylogo_plot (VIDEO_LOGO_ADDR, screen, width, 0, 0);

#ifdef VIDEO_INFO
	sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, info);

	sprintf (info, "(C) 2002 DENX Software Engineering");
	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
					info);

	sprintf (info, "    Wolfgang DENK, wd@denx.de");
	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 2,
					info);
#ifndef CONFIG_FADS		/* all normal boards */
	/* leave one blank line */

	sprintf (info, "MPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash",
		strmhz(temp, gd->cpu_clk),
		gd->ram_size >> 20,
		gd->bd->bi_flashsize >> 20 );
	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 4,
					info);
#else				/* FADS :-( */
	sprintf (info, "MPC823 CPU at 50 MHz on FADS823 board");
	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
					  info);

	sprintf (info, "2MB FLASH - 8MB DRAM - 4MB SRAM");
	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 2,
					  info);
#endif
#endif

	return video_fb_address + VIDEO_LOGO_HEIGHT * VIDEO_LINE_LEN;
}
#endif

/************************************************************************/
/* ** VIDEO HIGH-LEVEL FUNCTIONS					*/
/************************************************************************/

static int video_init (void *videobase)
{
	/* Initialize the encoder */
	debug ("[VIDEO] Initializing video encoder...\n");
	video_encoder_init ();

	/* Initialize the video controller */
	debug ("[VIDEO] Initializing video controller at %08x...\n",
		   (int) videobase);
	video_ctrl_init (videobase);

	/* Setting the palette */
	video_setpalette  (CONSOLE_COLOR_BLACK,	     0,	   0,	 0);
	video_setpalette  (CONSOLE_COLOR_RED,	  0xFF,	   0,	 0);
	video_setpalette  (CONSOLE_COLOR_GREEN,	     0, 0xFF,	 0);
	video_setpalette  (CONSOLE_COLOR_YELLOW,  0xFF, 0xFF,	 0);
	video_setpalette  (CONSOLE_COLOR_BLUE,	     0,	   0, 0xFF);
	video_setpalette  (CONSOLE_COLOR_MAGENTA, 0xFF,	   0, 0xFF);
	video_setpalette  (CONSOLE_COLOR_CYAN,	     0, 0xFF, 0xFF);
	video_setpalette  (CONSOLE_COLOR_GREY,	  0xAA, 0xAA, 0xAA);
	video_setpalette  (CONSOLE_COLOR_GREY2,	  0xF8, 0xF8, 0xF8);
	video_setpalette  (CONSOLE_COLOR_WHITE,	  0xFF, 0xFF, 0xFF);

#ifndef CONFIG_SYS_WHITE_ON_BLACK
	video_setfgcolor (CONSOLE_COLOR_BLACK);
	video_setbgcolor (CONSOLE_COLOR_GREY2);
#else
	video_setfgcolor (CONSOLE_COLOR_GREY2);
	video_setbgcolor (CONSOLE_COLOR_BLACK);
#endif	/* CONFIG_SYS_WHITE_ON_BLACK */

#ifdef CONFIG_VIDEO_LOGO
	/* Paint the logo and retrieve tv base address */
	debug ("[VIDEO] Drawing the logo...\n");
	video_console_address = video_logo ();
#else
	video_console_address = video_fb_address;
#endif

#ifdef VIDEO_BLINK
	/* Enable the blinking (under construction) */
	blink_init ();
	blink_set (0);				/* To Fix! */
#endif

	/* Initialize the console */
	console_col = 0;
	console_row = 0;
	video_enable = 1;

#ifdef VIDEO_MODE_PAL
# define VIDEO_MODE_TMP1	"PAL"
#endif
#ifdef VIDEO_MODE_NTSC
# define VIDEO_MODE_TMP1	"NTSC"
#endif
#ifdef VIDEO_MODE_YUYV
# define VIDEO_MODE_TMP2	"YCbYCr"
#endif
#ifdef VIDEO_MODE_RGB
# define VIDEO_MODE_TMP2	"RGB"
#endif
	debug ( VIDEO_MODE_TMP1
		" %dx%dx%d (" VIDEO_MODE_TMP2 ") on %s - console %dx%d\n",
			VIDEO_COLS, VIDEO_ROWS, VIDEO_MODE_BPP,
			VIDEO_ENCODER_NAME, CONSOLE_COLS, CONSOLE_ROWS);
	return 0;
}

int drv_video_init (void)
{
	int error, devices = 1;

	device_t videodev;

	video_init ((void *)(gd->fb_base));	/* Video initialization */

/* Device initialization */

	memset (&videodev, 0, sizeof (videodev));

	strcpy (videodev.name, "video");
	videodev.ext = DEV_EXT_VIDEO;	/* Video extensions */
	videodev.flags = DEV_FLAGS_OUTPUT;	/* Output only */
	videodev.putc = video_putc;	/* 'putc' function */
	videodev.puts = video_puts;	/* 'puts' function */

	error = device_register (&videodev);

	return (error == 0) ? devices : error;
}

/************************************************************************/
/* ** ROM capable initialization part - needed to reserve FB memory	*/
/************************************************************************/

/*
 * This is called early in the system initialization to grab memory
 * for the video controller.
 * Returns new address for monitor, after reserving video buffer memory
 *
 * Note that this is running from ROM, so no write access to global data.
 */
ulong video_setmem (ulong addr)
{
	/* Allocate pages for the frame buffer. */
	addr -= VIDEO_SIZE;

	debug ("Reserving %dk for Video Framebuffer at: %08lx\n",
		VIDEO_SIZE>>10, addr);

	return (addr);
}

#endif
