]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/BuS/EB+MCF-EV123/EB+MCF-EV123.c
update the EB+MCF-EV123 board support
[people/ms/u-boot.git] / board / BuS / EB+MCF-EV123 / EB+MCF-EV123.c
CommitLineData
9acb626f 1/*
35cf3b57 2 * (C) Copyright 2005-2009
9acb626f
HS
3 * BuS Elektronik GmbH & Co.KG <esw@bus-elektonik.de>
4 *
5 * (C) Copyright 2000-2003
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 *
8 * See file CREDITS for list of people who contributed to this
9 * project.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 * MA 02111-1307 USA
25 */
26
27#include <common.h>
28#include <command.h>
29#include "asm/m5282.h"
35cf3b57
JS
30#include <bmp_layout.h>
31#include <status_led.h>
32#include <bus_vcxk.h>
33
34/*---------------------------------------------------------------------------*/
35
36DECLARE_GLOBAL_DATA_PTR;
37
38unsigned long display_width;
39unsigned long display_height;
40
41/*---------------------------------------------------------------------------*/
9acb626f
HS
42
43int checkboard (void)
44{
45 puts ("Board: MCF-EV1 + MCF-EV23 (BuS Elektronik GmbH & Co. KG)\n");
6d0f6bcf 46#if (TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE)
9acb626f
HS
47 puts (" Boot from Internal FLASH\n");
48#endif
49
50 return 0;
51}
52
9973e3c6 53phys_size_t initdram (int board_type)
9acb626f 54{
0fe34058 55 int size, i;
9acb626f
HS
56
57 size = 0;
0fe34058 58 MCFSDRAMC_DCR = MCFSDRAMC_DCR_RTIM_6
6d0f6bcf
JCPV
59 | MCFSDRAMC_DCR_RC ((15 * CONFIG_SYS_CLK) >> 4);
60#ifdef CONFIG_SYS_SDRAM_BASE0
0fe34058 61
6d0f6bcf 62 MCFSDRAMC_DACR0 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE0)
0fe34058
WD
63 | MCFSDRAMC_DACR_CASL (1)
64 | MCFSDRAMC_DACR_CBM (3)
65 | MCFSDRAMC_DACR_PS_16;
66
67 MCFSDRAMC_DMR0 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
68
69 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IP;
70
6d0f6bcf 71 *(unsigned short *) (CONFIG_SYS_SDRAM_BASE0) = 0xA5A5;
0fe34058
WD
72 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_RE;
73 for (i = 0; i < 2000; i++)
74 asm (" nop");
75 mbar_writeLong (MCFSDRAMC_DACR0,
76 mbar_readLong (MCFSDRAMC_DACR0) | MCFSDRAMC_DACR_IMRS);
6d0f6bcf
JCPV
77 *(unsigned int *) (CONFIG_SYS_SDRAM_BASE0 + 0x220) = 0xA5A5;
78 size += CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
0fe34058 79#endif
6d0f6bcf
JCPV
80#ifdef CONFIG_SYS_SDRAM_BASE1
81 MCFSDRAMC_DACR1 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE1)
0fe34058
WD
82 | MCFSDRAMC_DACR_CASL (1)
83 | MCFSDRAMC_DACR_CBM (3)
84 | MCFSDRAMC_DACR_PS_16;
85
86 MCFSDRAMC_DMR1 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
87
88 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IP;
89
6d0f6bcf 90 *(unsigned short *) (CONFIG_SYS_SDRAM_BASE1) = 0xA5A5;
0fe34058
WD
91 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_RE;
92
93 for (i = 0; i < 2000; i++)
94 asm (" nop");
95
96 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IMRS;
6d0f6bcf
JCPV
97 *(unsigned int *) (CONFIG_SYS_SDRAM_BASE1 + 0x220) = 0xA5A5;
98 size += CONFIG_SYS_SDRAM_SIZE1 * 1024 * 1024;
0fe34058 99#endif
9acb626f
HS
100 return size;
101}
102
6d0f6bcf 103#if defined(CONFIG_SYS_DRAM_TEST)
9acb626f
HS
104int testdram (void)
105{
6d0f6bcf
JCPV
106 uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
107 uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
9acb626f
HS
108 uint *p;
109
110 printf("SDRAM test phase 1:\n");
111 for (p = pstart; p < pend; p++)
112 *p = 0xaaaaaaaa;
113
114 for (p = pstart; p < pend; p++) {
115 if (*p != 0xaaaaaaaa) {
116 printf ("SDRAM test fails at: %08x\n", (uint) p);
117 return 1;
118 }
119 }
120
121 printf("SDRAM test phase 2:\n");
122 for (p = pstart; p < pend; p++)
123 *p = 0x55555555;
124
125 for (p = pstart; p < pend; p++) {
126 if (*p != 0x55555555) {
127 printf ("SDRAM test fails at: %08x\n", (uint) p);
128 return 1;
129 }
130 }
131
132 printf("SDRAM test passed.\n");
133 return 0;
134}
135#endif
136
137int misc_init_r(void)
138{
35cf3b57
JS
139#ifdef CONFIG_HW_WATCHDOG
140 hw_watchdog_init();
141#endif
142#ifndef CONFIG_VIDEO
143 vcxk_init(16, 16);
144#endif
9acb626f
HS
145 return 1;
146}
147
35cf3b57
JS
148#if defined(CONFIG_VIDEO)
149
150/*
151 ****h* EB+CPU5282-T1/drv_video_init
152 * FUNCTION
153 ***
154 */
155
156int drv_video_init(void)
157{
158 char *s;
159 unsigned long splash;
160
161 printf("Init Video as ");
162
163 if ((s = getenv("displaywidth")) != NULL)
164 display_width = simple_strtoul(s, NULL, 10);
165 else
166 display_width = 256;
167
168 if ((s = getenv("displayheight")) != NULL)
169 display_height = simple_strtoul(s, NULL, 10);
170 else
171 display_height = 256;
172
173 printf("%lu x %lu pixel matrix\n", display_width, display_height);
174
175 MCFCCM_CCR &= ~MCFCCM_CCR_SZEN;
176 MCFGPIO_PEPAR &= ~MCFGPIO_PEPAR_PEPA2;
177
178 vcxk_init(display_width, display_height);
179
180#ifdef CONFIG_SPLASH_SCREEN
181 if ((s = getenv("splashimage")) != NULL) {
182 debug("use splashimage: %s\n", s);
183 splash = simple_strtoul(s, NULL, 16);
184 debug("use splashimage: %x\n", splash);
185 vcxk_acknowledge_wait();
186 video_display_bitmap(splash, 0, 0);
187 }
188#endif
189 return 0;
190}
191#endif
192
9acb626f
HS
193/*---------------------------------------------------------------------------*/
194
35cf3b57
JS
195#ifdef CONFIG_VIDEO
196int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
9acb626f
HS
197{
198 int rcode = 0;
35cf3b57
JS
199 ulong side;
200 ulong bright;
9acb626f
HS
201
202 switch (argc) {
35cf3b57
JS
203 case 3:
204 side = simple_strtoul(argv[1], NULL, 10);
205 bright = simple_strtoul(argv[2], NULL, 10);
206 if ((side >= 0) && (side <= 3) &&
207 (bright >= 0) && (bright <= 1000)) {
208 vcxk_setbrightness(side, bright);
209 rcode = 0;
210 } else {
211 printf("parameters out of range\n");
212 printf("Usage:\n%s\n", cmdtp->usage);
213 rcode = 1;
214 }
9acb626f
HS
215 break;
216 default:
35cf3b57 217 printf("Usage:\n%s\n", cmdtp->usage);
9acb626f
HS
218 rcode = 1;
219 break;
220 }
221 return rcode;
222}
223
35cf3b57 224/*---------------------------------------------------------------------------*/
9acb626f
HS
225
226U_BOOT_CMD(
35cf3b57
JS
227 bright, 3, 0, do_brightness,
228 "sets the display brightness\n",
229 " <side> <0..1000>\n side: 0/3=both; 1=first; 2=second\n"
9acb626f
HS
230);
231
35cf3b57
JS
232#endif
233
234/* EOF EB+MCF-EV123.c */