1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include <common.h>
23#include <command.h>
24#include <asm/io.h>
25#include <asm/processor.h>
26#include <i2c.h>
27#include <netdev.h>
28
29
30#define UPONCR0 0xA40501D4
31
32int checkboard(void)
33{
34 puts("BOARD: ecovec\n");
35 return 0;
36}
37
38int dram_init(void)
39{
40 DECLARE_GLOBAL_DATA_PTR;
41
42 gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
43 gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
44 printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
45 return 0;
46}
47
48static void debug_led(u8 led)
49{
50
51 outb((inb(PGDR) & ~0x0F) | (led & 0x0F), PGDR);
52}
53
54int board_late_init(void)
55{
56 u8 mac[6];
57 char env_mac[17];
58
59 udelay(1000);
60
61
62 outw(inw(PLCR) & ~0xFFF0, PLCR);
63 outw(inw(PNCR) & ~0x000F, PNCR);
64 outw(inw(PXCR) & ~0x0FC0, PXCR);
65 outw((inw(PSELB) & ~0x030F) | 0x020A, PSELB);
66 outw((inw(PSELC) & ~0x0307) | 0x0207, PSELC);
67 outw((inw(PSELE) & ~0x00c0) | 0x0080, PSELE);
68
69 debug_led(1 << 3);
70
71 outl(inl(MSTPCR2) & ~0x10000000, MSTPCR2);
72
73 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
74 i2c_set_bus_num(CONFIG_SYS_I2C_MODULE);
75
76
77 i2c_read(0x50, 0x10, 0, mac, 6);
78
79
80 sprintf(env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
81 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
82 setenv("ethaddr", env_mac);
83
84 debug_led(0x0F);
85
86 return 0;
87}
88
89int board_init(void)
90{
91
92
93 outw((inw(PGCR) & ~0xFF) | 0x66, PGCR);
94 outw((inw(HIZCRA) & ~0x02), HIZCRA);
95
96 debug_led(1 << 0);
97
98
99 outw(inw(PFCR) & ~0x30, PFCR);
100 outw(inw(PMCR) & ~0x0C, PMCR);
101 outw((inw(PSELA) & ~0x40) | 0x40, PSELA);
102
103 debug_led(1 << 1);
104
105
106 outw((inw(PACR) & ~0x0C) | 0x04, PACR);
107 outb((inb(PADR) & ~0x02) | 0x02, PADR);
108
109 debug_led(1 << 2);
110
111
112 outw((inw(PBCR) & ~0x300) | 0x100, PBCR);
113 outb((inb(PBDR) & ~0x10) | 0x10, PBDR);
114 outl(inl(MSTPCR2) & 0x100000, MSTPCR2);
115 outw(0x0600, UPONCR0);
116
117 debug_led(1 << 3);
118
119
120 outw((inw(PVCR) & ~0x03) | 0x02 , PVCR);
121
122 return 0;
123}
124