2 * (C) Copyright 2005-2009
3 * BuS Elektronik GmbH & Co.KG <esw@bus-elektonik.de>
5 * (C) Copyright 2000-2003
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 * See file CREDITS for list of people who contributed to this
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.
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.
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,
29 #include "asm/m5282.h"
30 #include <bmp_layout.h>
31 #include <status_led.h>
34 /*---------------------------------------------------------------------------*/
36 DECLARE_GLOBAL_DATA_PTR;
38 unsigned long display_width;
39 unsigned long display_height;
41 /*---------------------------------------------------------------------------*/
45 puts ("Board: MCF-EV1 + MCF-EV23 (BuS Elektronik GmbH & Co. KG)\n");
46 #if (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE)
47 puts (" Boot from Internal FLASH\n");
53 phys_size_t initdram (int board_type)
58 MCFSDRAMC_DCR = MCFSDRAMC_DCR_RTIM_6
59 | MCFSDRAMC_DCR_RC ((15 * CONFIG_SYS_CLK) >> 4);
60 #ifdef CONFIG_SYS_SDRAM_BASE0
62 MCFSDRAMC_DACR0 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE0)
63 | MCFSDRAMC_DACR_CASL (1)
64 | MCFSDRAMC_DACR_CBM (3)
65 | MCFSDRAMC_DACR_PS_16;
67 MCFSDRAMC_DMR0 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
69 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IP;
71 *(unsigned short *) (CONFIG_SYS_SDRAM_BASE0) = 0xA5A5;
72 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_RE;
73 for (i = 0; i < 2000; i++)
75 mbar_writeLong (MCFSDRAMC_DACR0,
76 mbar_readLong (MCFSDRAMC_DACR0) | MCFSDRAMC_DACR_IMRS);
77 *(unsigned int *) (CONFIG_SYS_SDRAM_BASE0 + 0x220) = 0xA5A5;
78 size += CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
80 #ifdef CONFIG_SYS_SDRAM_BASE1
81 MCFSDRAMC_DACR1 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE1)
82 | MCFSDRAMC_DACR_CASL (1)
83 | MCFSDRAMC_DACR_CBM (3)
84 | MCFSDRAMC_DACR_PS_16;
86 MCFSDRAMC_DMR1 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
88 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IP;
90 *(unsigned short *) (CONFIG_SYS_SDRAM_BASE1) = 0xA5A5;
91 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_RE;
93 for (i = 0; i < 2000; i++)
96 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IMRS;
97 *(unsigned int *) (CONFIG_SYS_SDRAM_BASE1 + 0x220) = 0xA5A5;
98 size += CONFIG_SYS_SDRAM_SIZE1 * 1024 * 1024;
103 #if defined(CONFIG_SYS_DRAM_TEST)
106 uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
107 uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
110 printf("SDRAM test phase 1:\n");
111 for (p = pstart; p < pend; p++)
114 for (p = pstart; p < pend; p++) {
115 if (*p != 0xaaaaaaaa) {
116 printf ("SDRAM test fails at: %08x\n", (uint) p);
121 printf("SDRAM test phase 2:\n");
122 for (p = pstart; p < pend; p++)
125 for (p = pstart; p < pend; p++) {
126 if (*p != 0x55555555) {
127 printf ("SDRAM test fails at: %08x\n", (uint) p);
132 printf("SDRAM test passed.\n");
137 int misc_init_r(void)
139 #ifdef CONFIG_HW_WATCHDOG
148 #if defined(CONFIG_VIDEO)
151 ****h* EB+CPU5282-T1/drv_video_init
156 int drv_video_init(void)
159 unsigned long splash;
161 printf("Init Video as ");
163 if ((s = getenv("displaywidth")) != NULL)
164 display_width = simple_strtoul(s, NULL, 10);
168 if ((s = getenv("displayheight")) != NULL)
169 display_height = simple_strtoul(s, NULL, 10);
171 display_height = 256;
173 printf("%lu x %lu pixel matrix\n", display_width, display_height);
175 MCFCCM_CCR &= ~MCFCCM_CCR_SZEN;
176 MCFGPIO_PEPAR &= ~MCFGPIO_PEPAR_PEPA2;
178 vcxk_init(display_width, display_height);
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);
193 /*---------------------------------------------------------------------------*/
196 int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);
211 printf("parameters out of range\n");
212 printf("Usage:\n%s\n", cmdtp->usage);
217 printf("Usage:\n%s\n", cmdtp->usage);
224 /*---------------------------------------------------------------------------*/
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"
234 /* EOF EB+MCF-EV123.c */