1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#include <common.h>
28#include <asm/immap.h>
29#include <netdev.h>
30
31int checkboard(void)
32{
33 puts("Board: ");
34 puts("Freescale MCF5253 DEMO\n");
35 return 0;
36};
37
38phys_size_t initdram(int board_type)
39{
40 u32 dramsize = 0;
41
42
43
44
45
46 if (!(mbar_readLong(MCFSIM_DCR) & 0x8000)) {
47 u32 RC, temp;
48
49 RC = (CONFIG_SYS_CLK / 1000000) >> 1;
50 RC = (RC * 15) >> 4;
51
52
53 mbar_writeShort(MCFSIM_DCR, (0x8400 | RC));
54 __asm__("nop");
55
56 mbar_writeLong(MCFSIM_DACR0, 0x00003224);
57 __asm__("nop");
58
59
60 dramsize = (CONFIG_SYS_SDRAM_SIZE << 20);
61 temp = (dramsize - 1) & 0xFFFC0000;
62 mbar_writeLong(MCFSIM_DMR0, temp | 1);
63 __asm__("nop");
64
65 mbar_writeLong(MCFSIM_DACR0, 0x0000322c);
66 __asm__("nop");
67
68
69 *(u32 *) (CONFIG_SYS_SDRAM_BASE) = 0xa5a5a5a5;
70 __asm__("nop");
71
72
73 mbar_writeLong(MCFSIM_DACR0,
74 mbar_readLong(MCFSIM_DACR0) | 0x8000);
75 __asm__("nop");
76
77
78 udelay(500);
79
80
81 mbar_writeLong(MCFSIM_DACR0,
82 mbar_readLong(MCFSIM_DACR0) | 0x0040);
83 __asm__("nop");
84
85 *(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x800) = 0xa5a5a5a5;
86 }
87
88 return dramsize;
89}
90
91int testdram(void)
92{
93
94 printf("DRAM test not implemented!\n");
95
96 return (0);
97}
98
99#ifdef CONFIG_CMD_IDE
100#include <ata.h>
101int ide_preinit(void)
102{
103 return (0);
104}
105
106void ide_set_reset(int idereset)
107{
108 volatile atac_t *ata = (atac_t *) CONFIG_SYS_ATA_BASE_ADDR;
109 long period;
110
111 int piotms[5][9] = { {70, 165, 60, 30, 50, 5, 20, 0, 35},
112 {50, 125, 45, 20, 35, 5, 15, 0, 35},
113 {30, 100, 30, 15, 20, 5, 10, 0, 35},
114 {30, 80, 30, 10, 20, 5, 10, 0, 35},
115 {25, 70, 20, 10, 20, 5, 10, 0, 35}
116 };
117
118 if (idereset) {
119 ata->cr = 0;
120 udelay(100);
121 } else {
122 mbar2_writeLong(CIM_MISCCR, CIM_MISCCR_CPUEND);
123
124#define CALC_TIMING(t) (t + period - 1) / period
125 period = 1000000000 / (CONFIG_SYS_CLK / 2);
126
127
128 ata->t1 = CALC_TIMING(piotms[2][0]);
129 ata->t2w = CALC_TIMING(piotms[2][1]);
130 ata->t2r = CALC_TIMING(piotms[2][1]);
131 ata->ta = CALC_TIMING(piotms[2][8]);
132 ata->trd = CALC_TIMING(piotms[2][7]);
133 ata->t4 = CALC_TIMING(piotms[2][3]);
134 ata->t9 = CALC_TIMING(piotms[2][6]);
135
136 ata->cr = 0x40;
137 udelay(2000);
138 ata->cr |= 0x01;
139 }
140}
141#endif
142
143
144#ifdef CONFIG_DRIVER_DM9000
145int board_eth_init(bd_t *bis)
146{
147 return dm9000_initialize(bis);
148}
149#endif
150