1
2
3
4
5
6
7
8
9
10#include <config.h>
11#include <common.h>
12#include <init.h>
13#include <asm/global_data.h>
14#include <asm/immap.h>
15#include <asm/io.h>
16#include <linux/delay.h>
17
18DECLARE_GLOBAL_DATA_PTR;
19
20int checkboard(void)
21{
22 puts("Board: ");
23 puts("Freescale M53017EVB\n");
24 return 0;
25};
26
27int dram_init(void)
28{
29 sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
30 u32 dramsize, i;
31
32 dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
33
34 for (i = 0x13; i < 0x20; i++) {
35 if (dramsize == (1 << i))
36 break;
37 }
38 i--;
39
40 out_be32(&sdram->cs0, CONFIG_SYS_SDRAM_BASE | i);
41#ifdef CONFIG_SYS_SDRAM_BASE1
42 out_be32(&sdram->cs1, CONFIG_SYS_SDRAM_BASE | i);
43#endif
44 out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1);
45 out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2);
46
47 udelay(500);
48
49
50 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
51 asm("nop");
52
53
54 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
55 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
56 asm("nop");
57
58
59 out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE);
60 asm("nop");
61 out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD);
62 asm("nop");
63
64 out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
65 asm("nop");
66
67 out_be32(&sdram->ctrl,
68 (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000c00);
69 asm("nop");
70
71 udelay(100);
72
73 gd->ram_size = dramsize;
74
75 return 0;
76};
77
78int testdram(void)
79{
80
81 printf("DRAM test not implemented!\n");
82
83 return (0);
84}
85