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#include <common.h>
26#include <asm/ppc440.h>
27#include <libfdt.h>
28#include <fdt_support.h>
29#include <i2c.h>
30#include <asm/processor.h>
31#include <asm/io.h>
32#include <asm/mmu.h>
33#include <asm/4xx_pcie.h>
34#include <asm/ppc4xx-gpio.h>
35
36extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
37
38DECLARE_GLOBAL_DATA_PTR;
39
40#define CONFIG_SYS_BCSR3_PCIE 0x10
41
42int board_early_init_f(void)
43{
44
45
46
47 mtdcr(UIC0SR, 0xffffffff);
48 mtdcr(UIC0ER, 0x00000000);
49 mtdcr(UIC0CR, 0x00000005);
50 mtdcr(UIC0PR, 0xffffffff);
51 mtdcr(UIC0TR, 0x00000000);
52 mtdcr(UIC0VR, 0x00000000);
53 mtdcr(UIC0SR, 0xffffffff);
54
55 mtdcr(UIC1SR, 0xffffffff);
56 mtdcr(UIC1ER, 0x00000000);
57 mtdcr(UIC1CR, 0x00000000);
58 mtdcr(UIC1PR, 0xffffffff);
59 mtdcr(UIC1TR, 0x00000000);
60 mtdcr(UIC1VR, 0x00000000);
61 mtdcr(UIC1SR, 0xffffffff);
62
63 mtdcr(UIC2SR, 0xffffffff);
64 mtdcr(UIC2ER, 0x00000000);
65 mtdcr(UIC2CR, 0x00000000);
66 mtdcr(UIC2PR, 0xffffffff);
67 mtdcr(UIC2TR, 0x00000000);
68 mtdcr(UIC2VR, 0x00000000);
69 mtdcr(UIC2SR, 0xffffffff);
70
71 mtdcr(UIC3SR, 0xffffffff);
72 mtdcr(UIC3ER, 0x00000000);
73 mtdcr(UIC3CR, 0x00000000);
74 mtdcr(UIC3PR, 0xffffffff);
75 mtdcr(UIC3TR, 0x00000000);
76 mtdcr(UIC3VR, 0x00000000);
77 mtdcr(UIC3SR, 0xffffffff);
78
79
80
81
82
83
84 mtsdr(SDR0_PFC0, 0x00007fff);
85 mtsdr(SDR0_PFC1, 0x00040000);
86
87
88 mtsdr(SDR0_PCI0, 0xe0000000);
89
90 mtsdr(SDR0_SRST1, 0);
91
92
93 mtdcr(AHB_TOP, 0x8000004B);
94 mtdcr(AHB_BOT, 0x8000004B);
95
96
97
98
99
100
101
102 gpio_config(16, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
103 gpio_config(19, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
104
105
106 out_le16((void *)CONFIG_SYS_IO_BASE, 0xffff);
107 out_le16((void *)CONFIG_SYS_IO_BASE + 0x100, 0xffff);
108 udelay(50);
109 out_le16((void *)CONFIG_SYS_IO_BASE, 0xffbf);
110 out_le16((void *)CONFIG_SYS_IO_BASE + 0x100, 0xffbf);
111 udelay(50);
112 out_le16((void *)CONFIG_SYS_IO_BASE, 0xffff);
113 out_le16((void *)CONFIG_SYS_IO_BASE + 0x100, 0xffff);
114
115 return 0;
116}
117
118int get_cpu_num(void)
119{
120 int cpu = NA_OR_UNKNOWN_CPU;
121
122 return cpu;
123}
124
125int checkboard(void)
126{
127 char *s = getenv("serial#");
128
129#ifdef CONFIG_DEVCONCENTER
130 printf("Board: DevCon-Center");
131#else
132 printf("Board: Intip");
133#endif
134
135 if (s != NULL) {
136 puts(", serial# ");
137 puts(s);
138 }
139 putc('\n');
140
141 return 0;
142}
143
144int board_early_init_r(void)
145{
146
147
148
149
150
151
152
153
154
155
156 u32 bxcr_bw = (CONFIG_SYS_FLASH_SIZE == 128 << 20) ?
157 EBC_BXCR_BS_128MB : EBC_BXCR_BS_64MB;
158
159
160 mtebc(PB0CR, CONFIG_SYS_FLASH_BASE_PHYS_L
161 | bxcr_bw
162 | EBC_BXCR_BU_RW
163 | EBC_BXCR_BW_16BIT);
164
165
166 remove_tlb(CONFIG_SYS_BOOT_BASE_ADDR, 16 << 20);
167
168
169 program_tlb(CONFIG_SYS_FLASH_BASE_PHYS, CONFIG_SYS_FLASH_BASE,
170 CONFIG_SYS_FLASH_SIZE, TLB_WORD2_I_ENABLE);
171
172
173
174
175
176
177
178
179
180
181
182 set_mcsr(get_mcsr());
183
184 return 0;
185}
186
187int misc_init_r(void)
188{
189 u32 sdr0_srst1 = 0;
190 u32 eth_cfg;
191
192
193
194
195
196 mfsdr(SDR0_ETH_CFG, eth_cfg);
197
198 eth_cfg &= ~(SDR0_ETH_CFG_SGMII2_ENABLE |
199 SDR0_ETH_CFG_SGMII1_ENABLE |
200 SDR0_ETH_CFG_SGMII0_ENABLE);
201
202
203 eth_cfg &= ~SDR0_ETH_CFG_GMC0_BRIDGE_SEL;
204 eth_cfg |= SDR0_ETH_CFG_GMC1_BRIDGE_SEL;
205 mtsdr(SDR0_ETH_CFG, eth_cfg);
206
207
208
209
210
211 mfsdr(SDR0_SRST1, sdr0_srst1);
212 sdr0_srst1 &= ~SDR0_SRST1_AHB;
213 mtsdr(SDR0_SRST1, sdr0_srst1);
214
215 return 0;
216}
217
218#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
219extern void __ft_board_setup(void *blob, bd_t *bd);
220
221void ft_board_setup(void *blob, bd_t *bd)
222{
223 __ft_board_setup(blob, bd);
224
225 fdt_find_and_setprop(blob, "/plb/pciex@d00000000", "status",
226 "disabled", sizeof("disabled"), 1);
227
228 fdt_find_and_setprop(blob, "/plb/sata@bffd1000", "status",
229 "disabled", sizeof("disabled"), 1);
230}
231#endif
232