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