2 * Copyright 2007 Freescale Semiconductor, Inc.
5 * FSL DIU Framebuffer driver
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 #ifdef CONFIG_FSL_DIU_FB
32 #include "../common/pixis.h"
33 #include "../common/fsl_diu_fb.h"
35 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
40 extern unsigned int FSL_Logo_BMP[];
42 static int xres, yres;
45 void mpc8610hpcd_diu_init(void)
49 unsigned int pixel_format;
50 unsigned char tmp_val;
51 unsigned char pixis_arch;
53 tmp_val = in8(PIXIS_BASE + PIXIS_BRDCFG0);
54 pixis_arch = in8(PIXIS_BASE + PIXIS_VER);
56 monitor_port = getenv("monitor");
57 if (!strncmp(monitor_port, "0", 1)) { /* 0 - DVI */
60 if (pixis_arch == 0x01)
61 pixel_format = 0x88882317;
63 pixel_format = 0x88883316;
65 out8(PIXIS_BASE + PIXIS_BRDCFG0, tmp_val | 0x08);
67 } else if (!strncmp(monitor_port, "1", 1)) { /* 1 - Single link LVDS */
70 pixel_format = 0x88883316;
72 out8(PIXIS_BASE + PIXIS_BRDCFG0, (tmp_val & 0xf7) | 0x10);
74 } else if (!strncmp(monitor_port, "2", 1)) { /* 2 - Double link LVDS */
77 pixel_format = 0x88883316;
79 out8(PIXIS_BASE + PIXIS_BRDCFG0, tmp_val & 0xe7);
84 pixel_format = 0x88882317;
86 out8(PIXIS_BASE + PIXIS_BRDCFG0, tmp_val | 0x08);
89 fsl_diu_init(xres, pixel_format, gamma_fix,
90 (unsigned char *)FSL_Logo_BMP);
93 int mpc8610diu_init_show_bmp(cmd_tbl_t *cmdtp,
94 int flag, int argc, char *argv[])
99 printf ("Usage:\n%s\n", cmdtp->usage);
103 if (!strncmp(argv[1],"init",4)) {
104 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
105 fsl_diu_clear_screen();
108 mpc8610hpcd_diu_init();
111 addr = simple_strtoul(argv[1], NULL, 16);
112 fsl_diu_clear_screen();
113 fsl_diu_display_bmp((unsigned char *)addr, 0, 0, 0);
120 diufb, CFG_MAXARGS, 1, mpc8610diu_init_show_bmp,
121 "diufb init | addr - Init or Display BMP file\n",
122 "init\n - initialize DIU\n"
123 "addr\n - display bmp at address 'addr'\n"
127 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
133 void *video_hw_init(void)
135 GraphicDevice *pGD = (GraphicDevice *) &ctfb;
136 struct fb_info *info;
138 mpc8610hpcd_diu_init();
140 /* fill in Graphic device struct */
141 sprintf(pGD->modeIdent,
142 "%dx%dx%d %ldkHz %ldHz",
143 xres, yres, 32, 64, 60);
145 pGD->frameAdrs = (unsigned int)fsl_fb_open(&info);
146 pGD->winSizeX = xres;
147 pGD->winSizeY = yres - info->logo_height;
148 pGD->plnSizeX = pGD->winSizeX;
149 pGD->plnSizeY = pGD->winSizeY;
152 pGD->gdfIndex = GDF_32BIT_X888RGB;
156 pGD->memSize = info->screen_size - info->logo_size;
158 /* Cursor Start Address */
166 void video_set_lut (unsigned int index, /* color number */
167 unsigned char r, /* red */
168 unsigned char g, /* green */
169 unsigned char b /* blue */
175 #endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
177 #endif /* CONFIG_FSL_DIU_FB */