]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/ads5121/ads5121_diu.c
2 * Copyright 2008 Freescale Semiconductor, Inc.
3 * York Sun <yorksun@freescale.com>
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 "../freescale/common/pixis.h"
33 #include "../freescale/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
;
44 void diu_set_pixel_clock(unsigned int pixclock
)
46 volatile immap_t
*immap
= (immap_t
*)CONFIG_SYS_IMMR
;
47 volatile clk512x_t
*clk
= &immap
->clk
;
48 volatile unsigned int *clkdvdr
= &clk
->scfr
[0];
49 unsigned long speed_ccb
, temp
, pixval
;
51 speed_ccb
= get_bus_freq(0) * 4;
52 temp
= 1000000000/pixclock
;
54 pixval
= speed_ccb
/ temp
;
55 debug("DIU pixval = %lu\n", pixval
);
57 /* Modify PXCLK in GUTS CLKDVDR */
58 debug("DIU: Current value of CLKDVDR = 0x%08x\n", *clkdvdr
);
59 temp
= *clkdvdr
& 0xFFFFFF00;
60 *clkdvdr
= temp
| (pixval
& 0xFF);
61 debug("DIU: Modified value of CLKDVDR = 0x%08x\n", *clkdvdr
);
64 int ads5121_diu_init(void)
66 unsigned int pixel_format
;
70 pixel_format
= 0x88883316;
72 return fsl_diu_init(xres
, pixel_format
, 0,
73 (unsigned char *)FSL_Logo_BMP
);
76 int ads5121diu_init_show_bmp(cmd_tbl_t
*cmdtp
,
77 int flag
, int argc
, char *argv
[])
86 if (!strncmp(argv
[1], "init", 4)) {
87 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
88 fsl_diu_clear_screen();
91 return ads5121_diu_init();
94 addr
= simple_strtoul(argv
[1], NULL
, 16);
95 fsl_diu_clear_screen();
96 fsl_diu_display_bmp((unsigned char *)addr
, 0, 0, 0);
103 diufb
, CONFIG_SYS_MAXARGS
, 1, ads5121diu_init_show_bmp
,
104 "Init or Display BMP file",
105 "init\n - initialize DIU\n"
106 "addr\n - display bmp at address 'addr'\n"
110 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
116 void *video_hw_init(void)
118 GraphicDevice
*pGD
= (GraphicDevice
*) &ctfb
;
119 struct fb_info
*info
;
121 if (ads5121_diu_init() < 0)
124 /* fill in Graphic device struct */
125 sprintf(pGD
->modeIdent
, "%dx%dx%d %ldkHz %ldHz",
126 xres
, yres
, 32, 64, 60);
128 pGD
->frameAdrs
= (unsigned int)fsl_fb_open(&info
);
129 pGD
->winSizeX
= xres
;
130 pGD
->winSizeY
= yres
- info
->logo_height
;
131 pGD
->plnSizeX
= pGD
->winSizeX
;
132 pGD
->plnSizeY
= pGD
->winSizeY
;
135 pGD
->gdfIndex
= GDF_32BIT_X888RGB
;
139 pGD
->memSize
= info
->screen_size
- info
->logo_size
;
141 /* Cursor Start Address */
152 * @index: color number
158 (unsigned int index
, unsigned char r
, unsigned char g
, unsigned char b
)
163 #endif /* defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) */
165 #endif /* CONFIG_FSL_DIU_FB */