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 <asm/io.h>
26#include <asm/ic/sc520.h>
27
28#ifdef CONFIG_HW_WATCHDOG
29#include <watchdog.h>
30#endif
31
32#include "hardware.h"
33
34DECLARE_GLOBAL_DATA_PTR;
35
36#undef SC520_CDP_DEBUG
37
38#ifdef SC520_CDP_DEBUG
39#define PRINTF(fmt,args...) printf (fmt ,##args)
40#else
41#define PRINTF(fmt,args...)
42#endif
43
44unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;
45
46void init_sc520_enet (void)
47{
48
49 sc520_mmcr->cpuctl = 0x01;
50
51
52 asm("movl $0x2000,%%ecx\n"
53 "0: pushl %%ecx\n"
54 "popl %%ecx\n"
55 "loop 0b\n": : : "ecx");
56
57
58 sc520_mmcr->dbctl = 0x11;
59
60
61 asm("movl %%cr0, %%eax\n"
62 "andl $0x9fffffff, %%eax\n"
63 "movl %%eax, %%cr0\n" : : : "eax");
64}
65
66
67
68
69int board_early_init_f(void)
70{
71 init_sc520_enet();
72
73 sc520_mmcr->gpcsrt = 0x01;
74 sc520_mmcr->gpcspw = 0x07;
75 sc520_mmcr->gpcsoff = 0x00;
76 sc520_mmcr->gprdw = 0x05;
77 sc520_mmcr->gprdoff = 0x01;
78 sc520_mmcr->gpwrw = 0x05;
79 sc520_mmcr->gpwroff = 0x01;
80
81 sc520_mmcr->piodata15_0 = 0x0630;
82 sc520_mmcr->piodata31_16 = 0x2000;
83 sc520_mmcr->piodir31_16 = 0x2000;
84 sc520_mmcr->piodir15_0 = 0x87b5;
85 sc520_mmcr->piopfs31_16 = 0x0dfe;
86 sc520_mmcr->piopfs15_0 = 0x200a;
87 sc520_mmcr->cspfs = 0x00f8;
88
89 sc520_mmcr->par[2] = 0x200713f8;
90 sc520_mmcr->par[3] = 0x2c0712f8;
91 sc520_mmcr->par[4] = 0x300711f8;
92 sc520_mmcr->par[5] = 0x340710f8;
93 sc520_mmcr->par[6] = 0xe3ffc000;
94 sc520_mmcr->par[7] = 0xaa3fd000;
95 sc520_mmcr->par[8] = 0xca3fd100;
96 sc520_mmcr->par[9] = 0x4203d900;
97 sc520_mmcr->par[10] = 0x4e03d910;
98 sc520_mmcr->par[11] = 0x50018100;
99 sc520_mmcr->par[12] = 0x54020000;
100 sc520_mmcr->par[13] = 0x5c020001;
101
102
103
104
105 sc520_mmcr->wdtmrctl = 0x3333;
106 sc520_mmcr->wdtmrctl = 0xcccc;
107 sc520_mmcr->wdtmrctl = 0x0000;
108
109
110 sc520_mmcr->bootcsctl = 0x0033;
111 sc520_mmcr->romcs1ctl = 0x0615;
112 sc520_mmcr->romcs2ctl = 0x0615;
113
114 sc520_mmcr->adddecctl = 0x02;
115 sc520_mmcr->uart1ctl = 0x07;
116 sc520_mmcr->sysarbctl = 0x06;
117 sc520_mmcr->sysarbmenb = 0x0003;
118
119 return 0;
120}
121
122int board_early_init_r(void)
123{
124
125 gd->cpu_clk = 100000000;
126
127
128 gd->bus_clk = 33000000;
129
130 return 0;
131}
132
133int dram_init(void)
134{
135 init_sc520_dram();
136 return 0;
137}
138
139void show_boot_progress(int val)
140{
141 uchar led_mask;
142
143 led_mask = 0x00;
144
145 if (val < 0)
146 led_mask |= LED_ERR_BITMASK;
147
148 led_mask |= (uchar)(val & 0x001f);
149 outb(led_mask, LED_LATCH_ADDRESS);
150}
151
152
153int last_stage_init(void)
154{
155 int minor;
156 int major;
157
158 major = minor = 0;
159
160 printf("Serck Controls eNET\n");
161
162 return 0;
163}
164
165ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t * info)
166{
167 if (banknum == 0) {
168 info->portwidth = FLASH_CFI_8BIT;
169 info->chipwidth = FLASH_CFI_BY8;
170 info->interface = FLASH_CFI_X8;
171 return 1;
172 } else
173 return 0;
174}
175