1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <common.h>
25#include <command.h>
26#include <mpc106.h>
27#include <video_fb.h>
28#include <netdev.h>
29
30DECLARE_GLOBAL_DATA_PTR;
31
32
33
34int checkboard (void)
35{
36 puts ("Board: ELTEC PowerPC\n");
37 return (0);
38}
39
40
41
42int checkflash (void)
43{
44
45 printf ("Test not implemented !\n");
46 return (0);
47}
48
49
50
51static unsigned int mpc106_read_cfg_dword (unsigned int reg)
52{
53 unsigned int reg_addr = MPC106_REG | (reg & 0xFFFFFFFC);
54
55 out32r (MPC106_REG_ADDR, reg_addr);
56
57 return (in32r (MPC106_REG_DATA | (reg & 0x3)));
58}
59
60
61
62long int dram_size (int board_type)
63{
64
65
66
67
68
69 register unsigned long i, msar1, mear1, memSize;
70
71#if defined(CONFIG_SYS_MEMTEST)
72 register unsigned long reg;
73
74 printf ("Testing DRAM\n");
75
76
77 for (reg = CONFIG_SYS_MEMTEST_START; reg < CONFIG_SYS_MEMTEST_END; reg += 4)
78 *reg = reg;
79
80 for (reg = CONFIG_SYS_MEMTEST_START; reg < CONFIG_SYS_MEMTEST_END; reg += 4) {
81 if (*reg != reg)
82 return -1;
83 }
84#endif
85
86
87
88
89
90 memSize = 0;
91 msar1 = mpc106_read_cfg_dword (MPC106_MSAR1);
92 mear1 = mpc106_read_cfg_dword (MPC106_MEAR1);
93 i = mpc106_read_cfg_dword (MPC106_MBER) & 0xf;
94
95 do {
96 if (i & 0x01)
97 memSize += (mear1 & 0xff) - (msar1 & 0xff) + 1;
98 msar1 >>= 8;
99 mear1 >>= 8;
100 i >>= 1;
101 } while (i);
102
103 return (memSize * 0x100000);
104}
105
106
107
108phys_size_t initdram (int board_type)
109{
110 return dram_size (board_type);
111}
112
113
114
115
116
117
118
119
120int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
121{
122 out8 (MPC107_EUMB_PI, 1);
123 return (0);
124}
125
126
127
128#if defined(CONFIG_WATCHDOG)
129
130
131
132
133
134void watchdog_reset (void)
135{
136}
137#endif
138
139
140
141void after_reloc (ulong dest_addr)
142{
143
144
145
146 board_init_r ((gd_t *)gd, dest_addr);
147}
148
149
150
151#ifdef CONFIG_CONSOLE_EXTRA_INFO
152extern GraphicDevice smi;
153
154void video_get_info_str (int line_number, char *info)
155{
156
157 switch (line_number) {
158 case 1:
159 sprintf (info, " MPC7xx V%d.%d at %d / %d MHz",
160 (get_pvr () >> 8) & 0xFF, get_pvr () & 0xFF, 400, 100);
161 return;
162 case 2:
163 sprintf (info, " ELTEC ELPPC with %ld MB DRAM and %ld MB FLASH",
164 dram_size (0) / 0x100000, flash_init () / 0x100000);
165 return;
166 case 3:
167 sprintf (info, " %s", smi.modeIdent);
168 return;
169 }
170
171
172 *info = 0;
173 return;
174}
175#endif
176
177int board_eth_init(bd_t *bis)
178{
179 return pci_eth_init(bis);
180}
181