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
28
29
30
31
32#include <common.h>
33#include <netdev.h>
34#if defined(CONFIG_OMAP730)
35#include <./configs/omap730.h>
36#endif
37
38DECLARE_GLOBAL_DATA_PTR;
39
40int test_boot_mode(void);
41void spin_up_leds(void);
42void flash__init (void);
43void ether__init (void);
44void set_muxconf_regs (void);
45void peripheral_power_enable (void);
46
47#define FLASH_ON_CS0 1
48#define FLASH_ON_CS3 0
49
50static inline void delay (unsigned long loops)
51{
52 __asm__ volatile ("1:\n"
53 "subs %0, %1, #1\n"
54 "bne 1b":"=r" (loops):"0" (loops));
55}
56
57int test_boot_mode(void)
58{
59
60 if (*((volatile int *)EMIFS_CONFIG) & 0x00000002)
61 return(FLASH_ON_CS3);
62 else
63 return(FLASH_ON_CS0);
64}
65
66
67void toggle_backup_led(void)
68{
69 static int backupLEDState = 0;
70 volatile unsigned int *IOConfReg;
71
72
73 IOConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_5 + GPIO_DATA_OUTPUT);
74
75 if (backupLEDState != 0) {
76 *IOConfReg &= (0xFFFFEFFF);
77 backupLEDState = 0;
78 } else {
79 *IOConfReg |= (0x00001000);
80 backupLEDState = 1;
81 }
82}
83
84
85
86
87
88int board_init (void)
89{
90
91 gd->bd->bi_arch_number = MACH_TYPE_OMAP_PERSEUS2;
92
93
94 gd->bd->bi_boot_params = 0x10000100;
95
96
97 set_muxconf_regs ();
98
99 peripheral_power_enable ();
100
101
102 toggle_backup_led();
103
104
105 *((volatile unsigned short *)M_CTL) &= ~1;
106
107
108
109
110
111
112 *((volatile unsigned int *) FLASH_CFG_0) = 0x0000fff3;
113 *((volatile unsigned int *) FLASH_ACFG_0_1) = 0x00000088;
114
115
116
117 *((volatile unsigned int *) FLASH_CFG_1) = 0x0000fff3;
118 *((volatile unsigned int *) FLASH_ACFG_0_1) = 0x00000000;
119
120
121
122
123
124 icache_enable ();
125
126 flash__init ();
127 ether__init ();
128
129 return 0;
130}
131
132int misc_init_r (void)
133{
134
135 return (0);
136}
137
138
139
140
141
142void flash__init (void)
143{
144 unsigned int regval;
145
146 regval = *((volatile unsigned int *) EMIFS_CONFIG);
147
148 regval = regval | 0x0001;
149 *((volatile unsigned int *) EMIFS_CONFIG) = regval;
150}
151
152
153
154
155
156
157void ether__init (void)
158{
159#define LAN_RESET_REGISTER 0x0400001c
160
161 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0000;
162 do {
163 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0001;
164 udelay (100);
165 } while (*((volatile unsigned short *) LAN_RESET_REGISTER) != 0x0001);
166
167 do {
168 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0000;
169 udelay (100);
170 } while (*((volatile unsigned short *) LAN_RESET_REGISTER) != 0x0000);
171
172#define ETH_CONTROL_REG 0x0400030b
173
174 *((volatile unsigned char *) ETH_CONTROL_REG) &= ~0x01;
175 udelay (100);
176}
177
178
179
180
181
182int dram_init (void)
183{
184 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
185 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
186
187 return 0;
188}
189
190
191
192
193
194
195void set_muxconf_regs (void)
196{
197 volatile unsigned int *MuxConfReg;
198
199
200
201
202
203
204
205 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF10);
206 *MuxConfReg &= (0xFFFFFF1F);
207 *MuxConfReg |= 0x000000C0;
208
209
210 MuxConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_5 + GPIO_DIRECTION_CONTROL);
211 *MuxConfReg &= (0xFFFFEFFF);
212
213
214
215
216
217
218 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF3);
219 *MuxConfReg &= 0xFFFFFFF1;
220 *MuxConfReg |= 0x0000000C;
221
222
223 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF5);
224 *MuxConfReg &= 0xFFFF1FFF;
225 *MuxConfReg |= 0x0000C000;
226
227 MuxConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_3 + GPIO_DIRECTION_CONTROL);
228 *MuxConfReg |= 0x00000100;
229 *MuxConfReg &= 0xFFFFFDFF;
230
231
232
233
234
235 MuxConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_3 + GPIO_DATA_OUTPUT);
236 *MuxConfReg &= (0xFFFFFDFF);
237
238
239
240
241
242 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF9);
243 *MuxConfReg &= 0x1FFFFFFF;
244}
245
246
247
248
249
250void peripheral_power_enable (void)
251{
252 volatile unsigned int *MuxConfReg;
253
254
255
256
257
258 MuxConfReg = (volatile unsigned int *) (PERSEUS_PCC_CONF_REG);
259 *MuxConfReg &= (0xFFFFFFF7);
260 *MuxConfReg |= (0x00000008);
261
262
263 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF3);
264 *MuxConfReg &= (0xFF1FFFFF);
265 *MuxConfReg &= (0xF1FFFFFF);
266}
267
268#ifdef CONFIG_CMD_NET
269int board_eth_init(bd_t *bis)
270{
271 int rc = 0;
272#ifdef CONFIG_LAN91C96
273 rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
274#endif
275 return rc;
276}
277#endif
278