Added support for the Hynix HY27US08121A 64MB Flash chip.
[u-boot-openmoko/mini2440.git] / board / BuS / EB+MCF-EV123 / VCxK.c
blob4b46b7c9a59ed5a05b2396c6192cca8e835b4d20
1 /*
2 * (C) Copyright 2005
3 * BuS Elektronik GmbH & Co.KG <esw@bus-elektonik.de>
5 * See file CREDITS for list of people who contributed to this
6 * project.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
24 #include <common.h>
25 #include <asm/m5282.h>
26 #include "VCxK.h"
28 vu_char *vcxk_bws = (vu_char *)(CFG_CS3_BASE);
29 #define VCXK_BWS vcxk_bws
31 static ulong vcxk_driver;
34 ulong search_vcxk_driver(void);
35 void vcxk_cls(void);
36 void vcxk_setbrightness(short brightness);
37 int vcxk_request(void);
38 int vcxk_acknowledge_wait(void);
39 void vcxk_clear(void);
41 int init_vcxk(void)
43 VIDEO_Invert_CFG &= ~VIDEO_Invert_IO;
44 VIDEO_INVERT_PORT |= VIDEO_INVERT_PIN;
45 VIDEO_INVERT_DDR |= VIDEO_INVERT_PIN;
47 VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN;
48 VIDEO_REQUEST_DDR |= VIDEO_REQUEST_PIN;
50 VIDEO_ACKNOWLEDGE_DDR &= ~VIDEO_ACKNOWLEDGE_PIN;
52 vcxk_driver = search_vcxk_driver();
53 if (vcxk_driver)
55 /* use flash resist driver */
57 else
59 vcxk_cls();
60 vcxk_cls();
61 vcxk_setbrightness(1000);
63 VIDEO_ENABLE_DDR |= VIDEO_ENABLE_PIN;
64 VIDEO_ENABLE_PORT |= VIDEO_ENABLE_PIN;
65 VIDEO_ENABLE_PORT &= ~VIDEO_ENABLE_PIN;
66 return 1;
69 void vcxk_loadimage(ulong source)
71 int cnt;
72 vcxk_acknowledge_wait();
73 for (cnt=0; cnt<16384; cnt++)
75 VCXK_BWS[cnt*2] = (*(vu_char*) source);
76 source++;
78 vcxk_request();
81 void vcxk_cls(void)
83 vcxk_acknowledge_wait();
84 vcxk_clear();
85 vcxk_request();
88 void vcxk_clear(void)
90 int cnt;
91 for (cnt=0; cnt<16384; cnt++)
93 VCXK_BWS[cnt*2] = 0x00;
97 void vcxk_setbrightness(short brightness)
99 VCXK_BWS[0x8000]=(brightness >> 4) +2;
100 VCXK_BWS[0xC000]= (brightness + 23) >> 8;
101 VCXK_BWS[0xC001]= (brightness + 23) & 0xFF;
104 int vcxk_request(void)
106 if (vcxk_driver)
108 /* use flash resist driver */
110 else
112 VIDEO_REQUEST_PORT &= ~VIDEO_REQUEST_PIN;
113 VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN;
115 return 1;
118 int vcxk_acknowledge_wait(void)
120 if (vcxk_driver)
122 /* use flash resist driver */
124 else
126 while (!(VIDEO_ACKNOWLEDGE_PORT & VIDEO_ACKNOWLEDGE_PIN));
128 return 1;
131 ulong search_vcxk_driver(void)
133 return 0;
136 /* eof */