1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2005-2009
6 * (C) Copyright 2000-2003
12 #include "asm/m5282.h"
13 #include <bmp_layout.h>
16 #include <status_led.h>
19 /*---------------------------------------------------------------------------*/
21 DECLARE_GLOBAL_DATA_PTR;
24 unsigned long display_width;
25 unsigned long display_height;
28 /*---------------------------------------------------------------------------*/
32 puts("Board: EB+CPU5282 (BuS Elektronik GmbH & Co. KG)\n");
33 #if (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE)
34 puts(" Boot from Internal FLASH\n");
44 MCFSDRAMC_DCR = MCFSDRAMC_DCR_RTIM_6 |
45 MCFSDRAMC_DCR_RC((15 * CONFIG_SYS_CLK / 1000000) >> 4);
47 #ifdef CONFIG_SYS_SDRAM_BASE0
48 MCFSDRAMC_DACR0 = MCFSDRAMC_DACR_BASE(CONFIG_SYS_SDRAM_BASE0)|
49 MCFSDRAMC_DACR_CASL(1) | MCFSDRAMC_DACR_CBM(3) |
53 MCFSDRAMC_DMR0 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
56 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IP;
58 for (i = 0; i < 10; i++)
61 *(unsigned long *)(CONFIG_SYS_SDRAM_BASE0) = 0xA5A5A5A5;
63 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_RE;
66 for (i = 0; i < 2000; i++)
69 MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IMRS;
71 /* write SDRAM mode register */
72 *(unsigned long *)(CONFIG_SYS_SDRAM_BASE0 + 0x80440) = 0xA5A5A5A5;
74 size += CONFIG_SYS_SDRAM_SIZE0 * 1024 * 1024;
76 #ifdef CONFIG_SYS_SDRAM_BASE1xx
77 MCFSDRAMC_DACR1 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE1)
78 | MCFSDRAMC_DACR_CASL (1)
79 | MCFSDRAMC_DACR_CBM (3)
80 | MCFSDRAMC_DACR_PS_16;
82 MCFSDRAMC_DMR1 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
84 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IP;
86 *(unsigned short *) (CONFIG_SYS_SDRAM_BASE1) = 0xA5A5;
87 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_RE;
89 for (i = 0; i < 2000; i++)
92 MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IMRS;
93 *(unsigned int *) (CONFIG_SYS_SDRAM_BASE1 + 0x220) = 0xA5A5;
94 size += CONFIG_SYS_SDRAM_SIZE1 * 1024 * 1024;
101 #if defined(CONFIG_SYS_DRAM_TEST)
104 uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
105 uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
108 printf("SDRAM test phase 1:\n");
109 for (p = pstart; p < pend; p++)
112 for (p = pstart; p < pend; p++) {
113 if (*p != 0xaaaaaaaa) {
114 printf ("SDRAM test fails at: %08x\n", (uint) p);
119 printf("SDRAM test phase 2:\n");
120 for (p = pstart; p < pend; p++)
123 for (p = pstart; p < pend; p++) {
124 if (*p != 0x55555555) {
125 printf ("SDRAM test fails at: %08x\n", (uint) p);
130 printf("SDRAM test passed.\n");
135 #if defined(CONFIG_HW_WATCHDOG)
137 void hw_watchdog_init(void)
143 s = env_get("watchdog");
145 if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0))
148 MCFGPTA_GPTDDR |= (1<<2);
150 MCFGPTA_GPTDDR &= ~(1<<2);
153 void hw_watchdog_reset(void)
155 MCFGPTA_GPTPORT ^= (1<<2);
159 int misc_init_r(void)
161 #ifdef CONFIG_HW_WATCHDOG
167 void __led_toggle(led_id_t mask)
169 MCFGPTA_GPTPORT ^= (1 << 3);
172 void __led_init(led_id_t mask, int state)
174 __led_set(mask, state);
175 MCFGPTA_GPTDDR |= (1 << 3);
178 void __led_set(led_id_t mask, int state)
180 if (state == CONFIG_LED_STATUS_ON)
181 MCFGPTA_GPTPORT |= (1 << 3);
183 MCFGPTA_GPTPORT &= ~(1 << 3);
186 #if defined(CONFIG_VIDEO)
188 int drv_video_init(void)
191 #ifdef CONFIG_SPLASH_SCREEN
192 unsigned long splash;
194 printf("Init Video as ");
195 s = env_get("displaywidth");
197 display_width = simple_strtoul(s, NULL, 10);
201 s = env_get("displayheight");
203 display_height = simple_strtoul(s, NULL, 10);
205 display_height = 256;
207 printf("%lu x %lu pixel matrix\n", display_width, display_height);
209 MCFCCM_CCR &= ~MCFCCM_CCR_SZEN;
210 MCFGPIO_PEPAR &= ~MCFGPIO_PEPAR_PEPA2;
212 vcxk_init(display_width, display_height);
214 #ifdef CONFIG_SPLASH_SCREEN
215 s = env_get("splashimage");
217 splash = simple_strtoul(s, NULL, 16);
218 vcxk_acknowledge_wait();
219 video_display_bitmap(splash, 0, 0);
226 /*---------------------------------------------------------------------------*/
229 int do_brightness(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
237 side = simple_strtoul(argv[1], NULL, 10);
238 bright = simple_strtoul(argv[2], NULL, 10);
239 if ((side >= 0) && (side <= 3) &&
240 (bright >= 0) && (bright <= 1000)) {
241 vcxk_setbrightness(side, bright);
244 printf("parameters out of range\n");
245 printf("Usage:\n%s\n", cmdtp->usage);
250 printf("Usage:\n%s\n", cmdtp->usage);
257 /*---------------------------------------------------------------------------*/
260 bright, 3, 0, do_brightness,
261 "sets the display brightness\n",
262 " <side> <0..1000>\n side: 0/3=both; 1=first; 2=second\n"
267 /* EOF EB+MCF-EV123.c */