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 * SPDX-License-Identifier: GPL-2.0+
13 #include "asm/m5282.h"
14 #include <bmp_layout.h>
15 #include <status_led.h>
18 /*---------------------------------------------------------------------------*/
20 DECLARE_GLOBAL_DATA_PTR;
23 unsigned long display_width;
24 unsigned long display_height;
27 /*---------------------------------------------------------------------------*/
31 puts("Board: EB+CPU5282 (BuS Elektronik GmbH & Co. KG)\n");
32 #if (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE)
33 puts(" Boot from Internal FLASH\n");
43 MCFSDRAMC_DCR = MCFSDRAMC_DCR_RTIM_6 |
44 MCFSDRAMC_DCR_RC((15 * CONFIG_SYS_CLK / 1000000) >> 4);
46 #ifdef CONFIG_SYS_SDRAM_BASE0
47 MCFSDRAMC_DACR0 = MCFSDRAMC_DACR_BASE(CONFIG_SYS_SDRAM_BASE0)|
48 MCFSDRAMC_DACR_CASL(1) | MCFSDRAMC_DACR_CBM(3) |
52 MCFSDRAMC_DMR0 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
55 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IP;
57 for (i = 0; i < 10; i++)
60 *(unsigned long *)(CONFIG_SYS_SDRAM_BASE0) = 0xA5A5A5A5;
62 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_RE;
65 for (i = 0; i < 2000; i++)
68 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IMRS;
70 /* write SDRAM mode register */
71 *(unsigned long *)(CONFIG_SYS_SDRAM_BASE0 + 0x80440) = 0xA5A5A5A5;
73 size += CONFIG_SYS_SDRAM_SIZE0 * 1024 * 1024;
75 #ifdef CONFIG_SYS_SDRAM_BASE1xx
76 MCFSDRAMC_DACR1 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE1)
77 | MCFSDRAMC_DACR_CASL (1)
78 | MCFSDRAMC_DACR_CBM (3)
79 | MCFSDRAMC_DACR_PS_16;
81 MCFSDRAMC_DMR1 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
83 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IP;
85 *(unsigned short *) (CONFIG_SYS_SDRAM_BASE1) = 0xA5A5;
86 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_RE;
88 for (i = 0; i < 2000; i++)
91 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IMRS;
92 *(unsigned int *) (CONFIG_SYS_SDRAM_BASE1 + 0x220) = 0xA5A5;
93 size += CONFIG_SYS_SDRAM_SIZE1 * 1024 * 1024;
100 #if defined(CONFIG_SYS_DRAM_TEST)
103 uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
104 uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
107 printf("SDRAM test phase 1:\n");
108 for (p = pstart; p < pend; p++)
111 for (p = pstart; p < pend; p++) {
112 if (*p != 0xaaaaaaaa) {
113 printf ("SDRAM test fails at: %08x\n", (uint) p);
118 printf("SDRAM test phase 2:\n");
119 for (p = pstart; p < pend; p++)
122 for (p = pstart; p < pend; p++) {
123 if (*p != 0x55555555) {
124 printf ("SDRAM test fails at: %08x\n", (uint) p);
129 printf("SDRAM test passed.\n");
134 #if defined(CONFIG_HW_WATCHDOG)
136 void hw_watchdog_init(void)
142 s = getenv("watchdog");
144 if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0))
147 MCFGPTA_GPTDDR |= (1<<2);
149 MCFGPTA_GPTDDR &= ~(1<<2);
152 void hw_watchdog_reset(void)
154 MCFGPTA_GPTPORT ^= (1<<2);
158 int misc_init_r(void)
160 #ifdef CONFIG_HW_WATCHDOG
166 void __led_toggle(led_id_t mask)
168 MCFGPTA_GPTPORT ^= (1 << 3);
171 void __led_init(led_id_t mask, int state)
173 __led_set(mask, state);
174 MCFGPTA_GPTDDR |= (1 << 3);
177 void __led_set(led_id_t mask, int state)
179 if (state == CONFIG_LED_STATUS_ON)
180 MCFGPTA_GPTPORT |= (1 << 3);
182 MCFGPTA_GPTPORT &= ~(1 << 3);
185 #if defined(CONFIG_VIDEO)
187 int drv_video_init(void)
190 #ifdef CONFIG_SPLASH_SCREEN
191 unsigned long splash;
193 printf("Init Video as ");
194 s = getenv("displaywidth");
196 display_width = simple_strtoul(s, NULL, 10);
200 s = getenv("displayheight");
202 display_height = simple_strtoul(s, NULL, 10);
204 display_height = 256;
206 printf("%lu x %lu pixel matrix\n", display_width, display_height);
208 MCFCCM_CCR &= ~MCFCCM_CCR_SZEN;
209 MCFGPIO_PEPAR &= ~MCFGPIO_PEPAR_PEPA2;
211 vcxk_init(display_width, display_height);
213 #ifdef CONFIG_SPLASH_SCREEN
214 s = getenv("splashimage");
216 splash = simple_strtoul(s, NULL, 16);
217 vcxk_acknowledge_wait();
218 video_display_bitmap(splash, 0, 0);
225 /*---------------------------------------------------------------------------*/
228 int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
236 side = simple_strtoul(argv[1], NULL, 10);
237 bright = simple_strtoul(argv[2], NULL, 10);
238 if ((side >= 0) && (side <= 3) &&
239 (bright >= 0) && (bright <= 1000)) {
240 vcxk_setbrightness(side, bright);
243 printf("parameters out of range\n");
244 printf("Usage:\n%s\n", cmdtp->usage);
249 printf("Usage:\n%s\n", cmdtp->usage);
256 /*---------------------------------------------------------------------------*/
259 bright, 3, 0, do_brightness,
260 "sets the display brightness\n",
261 " <side> <0..1000>\n side: 0/3=both; 1=first; 2=second\n"
266 /* EOF EB+MCF-EV123.c */