blob: 8bed3d5ad59deb9feacea85a0cc5c6963f5ccb08 [file] [log] [blame]
wdenk56f94be2002-11-05 16:35:14 +00001/*
wdenk65faef92004-03-25 19:29:38 +00002 * (C) Copyright 2000-2004
wdenk56f94be2002-11-05 16:35:14 +00003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 * Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 * MA 02111-1307 USA
23 */
24
25#include <common.h>
26#include <mpc8xx.h>
wdenk65faef92004-03-25 19:29:38 +000027#include "../common/kup.h"
wdenk56f94be2002-11-05 16:35:14 +000028#ifdef CONFIG_KUP4K_LOGO
29 #include "s1d13706.h"
30#endif
31
wdenk65faef92004-03-25 19:29:38 +000032#undef DEBUG
33#ifdef DEBUG
34# define debugk(fmt,args...) printf(fmt ,##args)
35#else
36# define debugk(fmt,args...)
37#endif
wdenk56f94be2002-11-05 16:35:14 +000038
wdenk65faef92004-03-25 19:29:38 +000039typedef struct {
40 volatile unsigned char *VmemAddr;
41 volatile unsigned char *RegAddr;
42} FB_INFO_S1D13xxx;
43
wdenk56f94be2002-11-05 16:35:14 +000044
45/* ------------------------------------------------------------------------- */
46
47#if 0
48static long int dram_size (long int, long int *, long int);
49#endif
50
51#ifdef CONFIG_KUP4K_LOGO
wdenk65faef92004-03-25 19:29:38 +000052void lcd_logo(bd_t *bd);
wdenk56f94be2002-11-05 16:35:14 +000053#endif
54
wdenk65faef92004-03-25 19:29:38 +000055
wdenk56f94be2002-11-05 16:35:14 +000056/* ------------------------------------------------------------------------- */
57
58#define _NOT_USED_ 0xFFFFFFFF
59
wdenk65faef92004-03-25 19:29:38 +000060const uint sdram_table[] = {
wdenk56f94be2002-11-05 16:35:14 +000061 /*
62 * Single Read. (Offset 0 in UPMA RAM)
63 */
wdenk4e112c12003-06-03 23:54:09 +000064 0x1F07FC04, 0xEEAEFC04, 0x11ADFC04, 0xEFBBBC00,
wdenk56f94be2002-11-05 16:35:14 +000065 0x1FF77C47, /* last */
66
67 /*
68 * SDRAM Initialization (offset 5 in UPMA RAM)
69 *
70 * This is no UPM entry point. The following definition uses
71 * the remaining space to establish an initialization
72 * sequence, which is executed by a RUN command.
73 *
74 */
wdenk4e112c12003-06-03 23:54:09 +000075 0x1FF77C35, 0xEFEABC34, 0x1FB57C35, /* last */
wdenk56f94be2002-11-05 16:35:14 +000076
77 /*
78 * Burst Read. (Offset 8 in UPMA RAM)
79 */
wdenk4e112c12003-06-03 23:54:09 +000080 0x1F07FC04, 0xEEAEFC04, 0x10ADFC04, 0xF0AFFC00,
81 0xF0AFFC00, 0xF1AFFC00, 0xEFBBBC00, 0x1FF77C47, /* last */
wdenk56f94be2002-11-05 16:35:14 +000082 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
83 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
84
85 /*
86 * Single Write. (Offset 18 in UPMA RAM)
87 */
wdenk4e112c12003-06-03 23:54:09 +000088 0x1F27FC04, 0xEEAEBC00, 0x01B93C04, 0x1FF77C47, /* last */
wdenk56f94be2002-11-05 16:35:14 +000089 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
90
91 /*
92 * Burst Write. (Offset 20 in UPMA RAM)
93 */
wdenk4e112c12003-06-03 23:54:09 +000094 0x1F07FC04, 0xEEAEBC00, 0x10AD7C00, 0xF0AFFC00,
95 0xF0AFFC00, 0xE1BBBC04, 0x1FF77C47, /* last */
96 _NOT_USED_,
wdenk56f94be2002-11-05 16:35:14 +000097 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
98 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
99
100 /*
101 * Refresh (Offset 30 in UPMA RAM)
102 */
wdenk4e112c12003-06-03 23:54:09 +0000103 0x1FF5FC84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
104 0xFFFFFC84, 0xFFFFFC07, /* last */
105 _NOT_USED_, _NOT_USED_,
wdenk56f94be2002-11-05 16:35:14 +0000106 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
107
108 /*
109 * Exception. (Offset 3c in UPMA RAM)
110 */
111 0x7FFFFC07, /* last */
112 _NOT_USED_, _NOT_USED_, _NOT_USED_,
113};
114
115/* ------------------------------------------------------------------------- */
116
117
118/*
119 * Check Board Identity:
120 */
121
122int checkboard (void)
123{
wdenk65faef92004-03-25 19:29:38 +0000124 volatile immap_t *immap = (immap_t *) CFG_IMMR;
125 uchar *latch,rev,mod;
wdenk56f94be2002-11-05 16:35:14 +0000126
wdenk65faef92004-03-25 19:29:38 +0000127 /*
128 * Init ChipSelect #4 (CAN + HW-Latch)
129 */
130 immap->im_memctl.memc_or4 = 0xFFFF8926;
131 immap->im_memctl.memc_br4 = 0x90000401;
132
133 latch=(uchar *)0x90000200;
134 rev = (*latch & 0xF8) >> 3;
135 mod=(*latch & 0x03);
136 printf ("Board: KUP4K Rev %d.%d SN: %s\n",rev,mod,getenv("ethaddr"));
wdenk56f94be2002-11-05 16:35:14 +0000137 return (0);
138}
139
140/* ------------------------------------------------------------------------- */
141
142long int initdram (int board_type)
143{
wdenk4e112c12003-06-03 23:54:09 +0000144 volatile immap_t *immap = (immap_t *) CFG_IMMR;
145 volatile memctl8xx_t *memctl = &immap->im_memctl;
146 long int size_b0 = 0;
147 long int size_b1 = 0;
148 long int size_b2 = 0;
wdenk56f94be2002-11-05 16:35:14 +0000149
wdenk4e112c12003-06-03 23:54:09 +0000150 upmconfig (UPMA, (uint *) sdram_table,
151 sizeof (sdram_table) / sizeof (uint));
152
153 /*
154 * Preliminary prescaler for refresh (depends on number of
155 * banks): This value is selected for four cycles every 62.4 us
156 * with two SDRAM banks or four cycles every 31.2 us with one
157 * bank. It will be adjusted after memory sizing.
158 */
159 memctl->memc_mptpr = CFG_MPTPR;
wdenk56f94be2002-11-05 16:35:14 +0000160
wdenk4e112c12003-06-03 23:54:09 +0000161 memctl->memc_mar = 0x00000088;
wdenk56f94be2002-11-05 16:35:14 +0000162
wdenk4e112c12003-06-03 23:54:09 +0000163 /*
164 * Map controller banks 1 and 2 to the SDRAM banks 2 and 3 at
165 * preliminary addresses - these have to be modified after the
166 * SDRAM size has been determined.
167 */
168/* memctl->memc_or1 = CFG_OR1_PRELIM; */
169/* memctl->memc_br1 = CFG_BR1_PRELIM; */
wdenk56f94be2002-11-05 16:35:14 +0000170
wdenk56f94be2002-11-05 16:35:14 +0000171/* memctl->memc_or2 = CFG_OR2_PRELIM; */
172/* memctl->memc_br2 = CFG_BR2_PRELIM; */
173
174
wdenk4e112c12003-06-03 23:54:09 +0000175 memctl->memc_mamr = CFG_MAMR & (~(MAMR_PTAE)); /* no refresh yet */
wdenk56f94be2002-11-05 16:35:14 +0000176
wdenk4e112c12003-06-03 23:54:09 +0000177 udelay (200);
wdenk56f94be2002-11-05 16:35:14 +0000178
wdenk4e112c12003-06-03 23:54:09 +0000179 /* perform SDRAM initializsation sequence */
wdenk56f94be2002-11-05 16:35:14 +0000180
wdenk4e112c12003-06-03 23:54:09 +0000181 memctl->memc_mcr = 0x80002105; /* SDRAM bank 0 */
182 udelay (1);
183 memctl->memc_mcr = 0x80002830; /* SDRAM bank 0 - execute twice */
184 udelay (1);
185 memctl->memc_mcr = 0x80002106; /* SDRAM bank 0 - RUN MRS Pattern from loc 6 */
186 udelay (1);
wdenk56f94be2002-11-05 16:35:14 +0000187
wdenk4e112c12003-06-03 23:54:09 +0000188 memctl->memc_mcr = 0x80004105; /* SDRAM bank 1 */
189 udelay (1);
190 memctl->memc_mcr = 0x80004830; /* SDRAM bank 1 - execute twice */
191 udelay (1);
192 memctl->memc_mcr = 0x80004106; /* SDRAM bank 1 - RUN MRS Pattern from loc 6 */
193 udelay (1);
wdenk56f94be2002-11-05 16:35:14 +0000194
wdenk4e112c12003-06-03 23:54:09 +0000195 memctl->memc_mcr = 0x80006105; /* SDRAM bank 2 */
196 udelay (1);
197 memctl->memc_mcr = 0x80006830; /* SDRAM bank 2 - execute twice */
198 udelay (1);
199 memctl->memc_mcr = 0x80006106; /* SDRAM bank 2 - RUN MRS Pattern from loc 6 */
200 udelay (1);
wdenk56f94be2002-11-05 16:35:14 +0000201
wdenk4e112c12003-06-03 23:54:09 +0000202 memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
203 udelay (1000);
wdenk56f94be2002-11-05 16:35:14 +0000204
wdenk4e112c12003-06-03 23:54:09 +0000205#if 0 /* 3 x 8MB */
206 size_b0 = 0x00800000;
207 size_b1 = 0x00800000;
208 size_b2 = 0x00800000;
wdenk56f94be2002-11-05 16:35:14 +0000209 memctl->memc_mptpr = CFG_MPTPR;
wdenk4e112c12003-06-03 23:54:09 +0000210 udelay (1000);
wdenk56f94be2002-11-05 16:35:14 +0000211 memctl->memc_or1 = 0xFF800A00;
212 memctl->memc_br1 = 0x00000081;
wdenk4e112c12003-06-03 23:54:09 +0000213 memctl->memc_or2 = 0xFF000A00;
214 memctl->memc_br2 = 0x00800081;
wdenk56f94be2002-11-05 16:35:14 +0000215 memctl->memc_or3 = 0xFE000A00;
216 memctl->memc_br3 = 0x01000081;
wdenk4e112c12003-06-03 23:54:09 +0000217#else /* 3 x 16 MB */
218 size_b0 = 0x01000000;
219 size_b1 = 0x01000000;
220 size_b2 = 0x01000000;
221 memctl->memc_mptpr = CFG_MPTPR;
222 udelay (1000);
223 memctl->memc_or1 = 0xFF000A00;
224 memctl->memc_br1 = 0x00000081;
225 memctl->memc_or2 = 0xFE000A00;
226 memctl->memc_br2 = 0x01000081;
227 memctl->memc_or3 = 0xFC000A00;
228 memctl->memc_br3 = 0x02000081;
229#endif
wdenk56f94be2002-11-05 16:35:14 +0000230
wdenk4e112c12003-06-03 23:54:09 +0000231 udelay (10000);
wdenk56f94be2002-11-05 16:35:14 +0000232
wdenk4e112c12003-06-03 23:54:09 +0000233 return (size_b0 + size_b1 + size_b2);
wdenk56f94be2002-11-05 16:35:14 +0000234}
235
236/* ------------------------------------------------------------------------- */
237
238/*
239 * Check memory range for valid RAM. A simple memory test determines
240 * the actually available RAM size between addresses `base' and
241 * `base + maxsize'. Some (not all) hardware errors are detected:
242 * - short between address lines
243 * - short between data lines
244 */
245#if 0
wdenk4e112c12003-06-03 23:54:09 +0000246static long int dram_size (long int mamr_value, long int *base,
247 long int maxsize)
wdenk56f94be2002-11-05 16:35:14 +0000248{
wdenk4e112c12003-06-03 23:54:09 +0000249 volatile immap_t *immap = (immap_t *) CFG_IMMR;
250 volatile memctl8xx_t *memctl = &immap->im_memctl;
wdenk65faef92004-03-25 19:29:38 +0000251 volatile long int *addr;
252 ulong cnt, val;
253 ulong save[32]; /* to make test non-destructive */
254 unsigned char i = 0;
wdenk56f94be2002-11-05 16:35:14 +0000255
wdenk4e112c12003-06-03 23:54:09 +0000256 memctl->memc_mamr = mamr_value;
wdenk56f94be2002-11-05 16:35:14 +0000257
wdenk65faef92004-03-25 19:29:38 +0000258 for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
259 addr = base + cnt; /* pointer arith! */
260
261 save[i++] = *addr;
262 *addr = ~cnt;
263 }
264
265 /* write 0 to base address */
266 addr = base;
267 save[i] = *addr;
268 *addr = 0;
269
270 /* check at base address */
271 if ((val = *addr) != 0) {
272 *addr = save[i];
273 return (0);
274 }
275
276 for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
277 addr = base + cnt; /* pointer arith! */
278
279 val = *addr;
280 *addr = save[--i];
281
282 if (val != (~cnt)) {
283 return (cnt * sizeof (long));
284 }
285 }
286 return (maxsize);
wdenk56f94be2002-11-05 16:35:14 +0000287}
288#endif
289
290int misc_init_r (void)
291{
292 DECLARE_GLOBAL_DATA_PTR;
293
wdenk90e7e422002-12-04 23:39:58 +0000294#ifdef CONFIG_STATUS_LED
wdenk4e112c12003-06-03 23:54:09 +0000295 volatile immap_t *immap = (immap_t *) CFG_IMMR;
wdenk90e7e422002-12-04 23:39:58 +0000296#endif
wdenk56f94be2002-11-05 16:35:14 +0000297#ifdef CONFIG_KUP4K_LOGO
298 bd_t *bd = gd->bd;
299
wdenk4e112c12003-06-03 23:54:09 +0000300 lcd_logo (bd);
301#endif /* CONFIG_KUP4K_LOGO */
wdenk90e7e422002-12-04 23:39:58 +0000302#ifdef CONFIG_IDE_LED
303 /* Configure PA8 as output port */
304 immap->im_ioport.iop_padir |= 0x80;
305 immap->im_ioport.iop_paodr |= 0x80;
306 immap->im_ioport.iop_papar &= ~0x80;
wdenk4e112c12003-06-03 23:54:09 +0000307 immap->im_ioport.iop_padat |= 0x80; /* turn it off */
wdenk90e7e422002-12-04 23:39:58 +0000308#endif
wdenk65faef92004-03-25 19:29:38 +0000309 setenv("hw","4k");
310 poweron_key();
wdenk4e112c12003-06-03 23:54:09 +0000311 return (0);
wdenk56f94be2002-11-05 16:35:14 +0000312}
313
314#ifdef CONFIG_KUP4K_LOGO
wdenk4e112c12003-06-03 23:54:09 +0000315
wdenk56f94be2002-11-05 16:35:14 +0000316
wdenk4e112c12003-06-03 23:54:09 +0000317void lcd_logo (bd_t * bd)
318{
wdenk4e112c12003-06-03 23:54:09 +0000319 FB_INFO_S1D13xxx fb_info;
320 S1D_INDEX s1dReg;
321 S1D_VALUE s1dValue;
322 volatile immap_t *immr = (immap_t *) CFG_IMMR;
323 volatile memctl8xx_t *memctl;
wdenk56f94be2002-11-05 16:35:14 +0000324 ushort i;
325 uchar *fb;
wdenk4e112c12003-06-03 23:54:09 +0000326 int rs, gs, bs;
327 int r = 8, g = 8, b = 4;
328 int r1, g1, b1;
wdenk65faef92004-03-25 19:29:38 +0000329 int n;
330 uchar tmp[64]; /* long enough for environment variables */
331 int tft = 0;
wdenk4e112c12003-06-03 23:54:09 +0000332
wdenk65faef92004-03-25 19:29:38 +0000333 immr->im_cpm.cp_pbpar &= ~(PB_LCD_PWM);
334 immr->im_cpm.cp_pbodr &= ~(PB_LCD_PWM);
335 immr->im_cpm.cp_pbdat &= ~(PB_LCD_PWM); /* set to 0 = enabled */
336 immr->im_cpm.cp_pbdir |= (PB_LCD_PWM);
wdenk56f94be2002-11-05 16:35:14 +0000337
338/*----------------------------------------------------------------------------- */
wdenk56f94be2002-11-05 16:35:14 +0000339/* Initialize the chip and the frame buffer driver. */
wdenk56f94be2002-11-05 16:35:14 +0000340/*----------------------------------------------------------------------------- */
wdenk65faef92004-03-25 19:29:38 +0000341 memctl = &immr->im_memctl;
wdenk56f94be2002-11-05 16:35:14 +0000342
wdenk56f94be2002-11-05 16:35:14 +0000343
wdenk65faef92004-03-25 19:29:38 +0000344 /*
345 * Init ChipSelect #5 (S1D13768)
346 */
347 memctl->memc_or5 = 0xFFC007F0; /* 4 MB 17 WS or externel TA */
348 memctl->memc_br5 = 0x80080801; /* Start at 0x80080000 */
wdenk56f94be2002-11-05 16:35:14 +0000349
wdenk4e112c12003-06-03 23:54:09 +0000350 fb_info.VmemAddr = (unsigned char *) (S1D_PHYSICAL_VMEM_ADDR);
351 fb_info.RegAddr = (unsigned char *) (S1D_PHYSICAL_REG_ADDR);
wdenk56f94be2002-11-05 16:35:14 +0000352
wdenk4e112c12003-06-03 23:54:09 +0000353 if ((((S1D_VALUE *) fb_info.RegAddr)[0] != 0x28)
wdenk65faef92004-03-25 19:29:38 +0000354 || (((S1D_VALUE *) fb_info.RegAddr)[1] != 0x14)) {
wdenk4e112c12003-06-03 23:54:09 +0000355 printf ("Warning:LCD Controller S1D13706 not found\n");
wdenk65faef92004-03-25 19:29:38 +0000356 setenv ("lcd", "none");
wdenk4e112c12003-06-03 23:54:09 +0000357 return;
358 }
wdenk56f94be2002-11-05 16:35:14 +0000359
wdenk65faef92004-03-25 19:29:38 +0000360
361 for (i = 0; i < sizeof(aS1DRegs_prelimn) / sizeof(aS1DRegs_prelimn[0]); i++) {
362 s1dReg = aS1DRegs_prelimn[i].Index;
363 s1dValue = aS1DRegs_prelimn[i].Value;
364 debugk ("s13768 reg: %02x value: %02x\n",
365 aS1DRegs_prelimn[i].Index, aS1DRegs_prelimn[i].Value);
wdenk4e112c12003-06-03 23:54:09 +0000366 ((S1D_VALUE *) fb_info.RegAddr)[s1dReg / sizeof (S1D_VALUE)] =
wdenk65faef92004-03-25 19:29:38 +0000367 s1dValue;
wdenk4e112c12003-06-03 23:54:09 +0000368 }
wdenk56f94be2002-11-05 16:35:14 +0000369
wdenk65faef92004-03-25 19:29:38 +0000370
371 n = getenv_r ("lcd", tmp, sizeof (tmp));
372 if (n > 0) {
373 if (!strcmp ("tft", tmp))
374 tft = 1;
375 else
376 tft = 0;
wdenk56f94be2002-11-05 16:35:14 +0000377 }
wdenk56f94be2002-11-05 16:35:14 +0000378#if 0
wdenk65faef92004-03-25 19:29:38 +0000379 if (((S1D_VALUE *) fb_info.RegAddr)[0xAC] & 0x04)
380 tft = 0;
381 else
382 tft = 1;
wdenk56f94be2002-11-05 16:35:14 +0000383#endif
wdenk65faef92004-03-25 19:29:38 +0000384
385 debugk ("Port=0x%02x -> TFT=%d\n", tft,
386 ((S1D_VALUE *) fb_info.RegAddr)[0xAC]);
387
388 /* init controller */
389 if (!tft) {
390 for (i = 0; i < sizeof(aS1DRegs_stn) / sizeof(aS1DRegs_stn[0]); i++) {
391 s1dReg = aS1DRegs_stn[i].Index;
392 s1dValue = aS1DRegs_stn[i].Value;
393 debugk ("s13768 reg: %02x value: %02x\n",
394 aS1DRegs_stn[i].Index,
395 aS1DRegs_stn[i].Value);
396 ((S1D_VALUE *) fb_info.RegAddr)[s1dReg / sizeof(S1D_VALUE)] =
397 s1dValue;
398 }
399 n = getenv_r ("contrast", tmp, sizeof (tmp));
400 ((S1D_VALUE *) fb_info.RegAddr)[0xB3] =
401 (n > 0) ? (uchar) simple_strtoul (tmp, NULL, 10) * 255 / 100 : 0xA0;
402 switch (bd->bi_busfreq) {
403 case 40000000:
404 ((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
405 ((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x41;
406 break;
407 case 48000000:
408 ((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x22;
409 ((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x34;
410 break;
411 default:
412 printf ("KUP4K S1D1: unknown busfrequency: %ld assuming 64 MHz\n", bd->bi_busfreq);
413 case 64000000:
414 ((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
415 ((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x66;
416 break;
417 }
418 /* setenv("lcd","stn"); */
419 } else {
420 for (i = 0; i < sizeof(aS1DRegs_tft) / sizeof(aS1DRegs_tft[0]); i++) {
421 s1dReg = aS1DRegs_tft[i].Index;
422 s1dValue = aS1DRegs_tft[i].Value;
423 debugk ("s13768 reg: %02x value: %02x\n",
424 aS1DRegs_tft[i].Index,
425 aS1DRegs_tft[i].Value);
426 ((S1D_VALUE *) fb_info.RegAddr)[s1dReg / sizeof (S1D_VALUE)] =
427 s1dValue;
428 }
wdenk56f94be2002-11-05 16:35:14 +0000429
wdenk65faef92004-03-25 19:29:38 +0000430 switch (bd->bi_busfreq) {
431 default:
432 printf ("KUP4K S1D1: unknown busfrequency: %ld assuming 64 MHz\n", bd->bi_busfreq);
433 case 40000000:
434 ((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x42;
435 ((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x30;
436 break;
437 }
438 /* setenv("lcd","tft"); */
439 }
wdenk4e112c12003-06-03 23:54:09 +0000440
441 /* create and set colormap */
442 rs = 256 / (r - 1);
443 gs = 256 / (g - 1);
444 bs = 256 / (b - 1);
445 for (i = 0; i < 256; i++) {
446 r1 = (rs * ((i / (g * b)) % r)) * 255;
447 g1 = (gs * ((i / b) % g)) * 255;
448 b1 = (bs * ((i) % b)) * 255;
wdenk65faef92004-03-25 19:29:38 +0000449 debugk ("%d %04x %04x %04x\n", i, r1 >> 4, g1 >> 4, b1 >> 4);
wdenk4e112c12003-06-03 23:54:09 +0000450 S1D_WRITE_PALETTE (fb_info.RegAddr, i, (r1 >> 4), (g1 >> 4),
wdenk65faef92004-03-25 19:29:38 +0000451 (b1 >> 4));
wdenk4e112c12003-06-03 23:54:09 +0000452 }
wdenk56f94be2002-11-05 16:35:14 +0000453
wdenk4e112c12003-06-03 23:54:09 +0000454 /* copy bitmap */
455 fb = (char *) (fb_info.VmemAddr);
456 memcpy (fb, (uchar *) CONFIG_KUP4K_LOGO, 320 * 240);
wdenk56f94be2002-11-05 16:35:14 +0000457}
wdenk65faef92004-03-25 19:29:38 +0000458#endif /* CONFIG_KUP4K_LOGO */