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
33
34#include <common.h>
35#include <netdev.h>
36#if defined(CONFIG_OMAP1610)
37#include <./configs/omap1510.h>
38#endif
39
40DECLARE_GLOBAL_DATA_PTR;
41
42#ifdef CONFIG_CS_AUTOBOOT
43unsigned long omap_flash_base;
44#endif
45
46void flash__init (void);
47void ether__init (void);
48void set_muxconf_regs (void);
49void peripheral_power_enable (void);
50
51#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
52
53static inline void delay (unsigned long loops)
54{
55 __asm__ volatile ("1:\n"
56 "subs %0, %1, #1\n"
57 "bne 1b":"=r" (loops):"0" (loops));
58}
59
60
61
62
63
64int board_init (void)
65{
66
67 gd->bd->bi_boot_params = 0x10000100;
68
69
70 set_muxconf_regs ();
71 peripheral_power_enable ();
72
73
74
75
76
77 icache_enable ();
78
79 flash__init ();
80 ether__init ();
81 return 0;
82}
83
84
85int misc_init_r (void)
86{
87
88 return (0);
89}
90
91
92
93
94
95void flash__init (void)
96{
97#define EMIFS_GlB_Config_REG 0xfffecc0c
98 unsigned int regval;
99
100#ifdef CONFIG_CS_AUTOBOOT
101
102 omap_flash_base = ((*((u32 *)OMAP_EMIFS_CONFIG_REG) & 0x02) == 0) ?
103 PHYS_FLASH_1_BM0 : PHYS_FLASH_1_BM1;
104#endif
105 regval = *((volatile unsigned int *) EMIFS_GlB_Config_REG);
106
107 regval = regval | 0x0001;
108 *((volatile unsigned int *) EMIFS_GlB_Config_REG) = regval;
109}
110
111
112
113
114
115void ether__init (void)
116{
117#define ETH_CONTROL_REG 0x0400030b
118
119#ifdef CONFIG_H2_OMAP1610
120 #define LAN_RESET_REGISTER 0x0400001c
121
122
123
124
125
126
127
128 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0000;
129 do {
130 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0001;
131 udelay (3);
132 } while (*((volatile unsigned short *) LAN_RESET_REGISTER) != 0x0001);
133
134 do {
135 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0000;
136 udelay (3);
137 } while (*((volatile unsigned short *) LAN_RESET_REGISTER) != 0x0000);
138#endif
139
140 *((volatile unsigned char *) ETH_CONTROL_REG) &= ~0x01;
141 udelay (3);
142}
143
144
145
146
147
148int dram_init (void)
149{
150 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
151 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
152
153 return 0;
154}
155
156
157
158
159
160
161void set_muxconf_regs (void)
162{
163 volatile unsigned int *MuxConfReg;
164
165 MuxConfReg =
166 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_0);
167
168 *MuxConfReg &= ~(0x02000000);
169
170 *MuxConfReg &= ~(0x01000000);
171
172 *MuxConfReg |= 0x08000000;
173 MuxConfReg =
174 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_3);
175 *MuxConfReg = 0x00000000;
176 MuxConfReg =
177 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_4);
178 *MuxConfReg = 0x00000000;
179 MuxConfReg =
180 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_5);
181 *MuxConfReg = 0x00000000;
182 MuxConfReg =
183 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_6);
184
185 *MuxConfReg |= 0x00000001;
186 *MuxConfReg &= ~0x0000003e;
187 MuxConfReg =
188 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_7);
189 *MuxConfReg = 0x00000000;
190 MuxConfReg =
191 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_8);
192
193 *MuxConfReg |= 0x00001200;
194 MuxConfReg =
195 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_9);
196
197
198
199 *MuxConfReg |= 0x00201000;
200 MuxConfReg =
201 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_A);
202 *MuxConfReg = 0x00000000;
203 MuxConfReg =
204 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_B);
205 *MuxConfReg = 0x00000000;
206 MuxConfReg =
207 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_C);
208
209
210
211
212 *MuxConfReg |= 0x09000000;
213 MuxConfReg =
214 (volatile unsigned int *) ((unsigned int) PULL_DWN_CTRL_0);
215 *MuxConfReg = 0x00000000;
216 MuxConfReg =
217 (volatile unsigned int *) ((unsigned int) PULL_DWN_CTRL_1);
218 *MuxConfReg = 0x00000000;
219
220 MuxConfReg =
221 (volatile unsigned int *) ((unsigned int) PULL_DWN_CTRL_2);
222 *MuxConfReg &= 0xFFFE0FFF;
223 MuxConfReg =
224 (volatile unsigned int *) ((unsigned int) PULL_DWN_CTRL_3);
225 *MuxConfReg = 0x00000000;
226 MuxConfReg =
227 (volatile unsigned int *) ((unsigned int) MOD_CONF_CTRL_0);
228
229 *MuxConfReg &= ~(0x00002000);
230
231 *MuxConfReg &= ~(0x00002000);
232 MuxConfReg =
233 (volatile unsigned int *) ((unsigned int) FUNC_MUX_CTRL_0);
234
235 *MuxConfReg |= 0x000C0000;
236 MuxConfReg =
237 (volatile unsigned int *) ((unsigned int)USB_TRANSCEIVER_CTRL);
238 *MuxConfReg &= ~(0x00000070);
239 *MuxConfReg &= ~(0x00000008);
240 *MuxConfReg |= 0x00000003;
241 *MuxConfReg |= 0x00000180;
242 MuxConfReg =
243 (volatile unsigned int *) ((unsigned int) MOD_CONF_CTRL_0);
244
245 *MuxConfReg &= ~(0x00020000);
246
247 *MuxConfReg |= 0x00000200;
248 *MuxConfReg &= ~(0x00000180);
249
250 MuxConfReg =
251 (volatile unsigned int *) ((unsigned int) VOLTAGE_CTRL_0);
252 *MuxConfReg = 0x00001FE7;
253 MuxConfReg =
254 (volatile unsigned int *) ((unsigned int) PU_PD_SEL_0);
255 *MuxConfReg = 0x00000000;
256 MuxConfReg =
257 (volatile unsigned int *) ((unsigned int) PU_PD_SEL_1);
258 *MuxConfReg = 0x00000000;
259 MuxConfReg =
260 (volatile unsigned int *) ((unsigned int) PU_PD_SEL_2);
261 *MuxConfReg = 0x00000000;
262 MuxConfReg =
263 (volatile unsigned int *) ((unsigned int) PU_PD_SEL_3);
264 *MuxConfReg = 0x00000000;
265 MuxConfReg =
266 (volatile unsigned int *) ((unsigned int) PU_PD_SEL_4);
267 *MuxConfReg = 0x00000000;
268 MuxConfReg =
269 (volatile unsigned int *) ((unsigned int) PULL_DWN_CTRL_4);
270 *MuxConfReg = 0x00000000;
271
272 MuxConfReg =
273 (volatile unsigned int *) ((unsigned int) MOD_CONF_CTRL_0);
274 *MuxConfReg |= 0x40000000;
275 MuxConfReg =
276 (volatile unsigned int *) ((unsigned int) USB_OTG_CTRL);
277
278 *MuxConfReg |= 0x00040000;
279 MuxConfReg =
280 (volatile unsigned int *) ((unsigned int) PU_PD_SEL_2);
281
282 *MuxConfReg |= ~(0xFFFE0FFF);
283 MuxConfReg =
284 (volatile unsigned int *) ((unsigned int)COMP_MODE_CTRL_0);
285 *MuxConfReg = COMP_MODE_ENABLE;
286}
287
288
289
290
291
292void peripheral_power_enable (void)
293{
294#define UART1_48MHZ_ENABLE ((unsigned short)0x0200)
295#define SW_CLOCK_REQUEST ((volatile unsigned short *)0xFFFE0834)
296
297 *SW_CLOCK_REQUEST |= UART1_48MHZ_ENABLE;
298}
299
300#ifdef CONFIG_CMD_NET
301int board_eth_init(bd_t *bis)
302{
303 int rc = 0;
304#ifdef CONFIG_LAN91C96
305 rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
306#endif
307 return rc;
308}
309#endif
310