1
2
3
4
5
6
7
8
9
10
11
12#include <common.h>
13#include <asm/ppc4xx.h>
14#include <asm/processor.h>
15#include <asm/io.h>
16#include <asm/4xx_pci.h>
17
18DECLARE_GLOBAL_DATA_PTR;
19
20
21extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
22
23int board_early_init_f(void)
24{
25 register uint reg;
26
27
28
29
30 mfebc(EBC0_CFG, reg);
31 mtebc(EBC0_CFG, reg | 0x04000000);
32
33
34
35
36
37
38 out32(GPIO0_OSRL, in32(GPIO0_OSRL) | 0x54000000);
39 out32(GPIO0_TSRL, in32(GPIO0_TSRL) | 0x54000000);
40 out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) | 0x54000000);
41
42
43 out32(GPIO0_TCR, in32(GPIO0_TCR) | 0xC080);
44 out32(GPIO0_TSRL, in32(GPIO0_TSRL) | 0x40);
45 out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) | 0x55);
46 out32(GPIO0_OSRH, in32(GPIO0_OSRH) | 0x50004000);
47 out32(GPIO0_ISR1H, in32(GPIO0_ISR1H) | 0x00440000);
48
49
50 out32(GPIO1_TCR, in32(GPIO1_TCR) | 0x16000000);
51 out32(GPIO1_OSRL, in32(GPIO1_OSRL) | 0x02180000);
52 out32(GPIO1_ISR1L, in32(GPIO1_ISR1L) | 0x00400000);
53 out32(GPIO1_ISR2L, in32(GPIO1_ISR2L) | 0x04010000);
54
55
56 out32(GPIO0_OSRL, in32(GPIO0_OSRL) & ~0x00C00000);
57 out32(GPIO0_TSRL, in32(GPIO0_TSRL) & ~0x00C00000);
58 out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) & ~0x00C00000);
59 out32(GPIO0_TCR, in32(GPIO0_TCR) | 0x08000000);
60 out32(GPIO0_OR, in32(GPIO0_OR) & ~0x08000000);
61
62
63 out32(GPIO1_TCR, in32(GPIO1_TCR) & ~0x00f00000);
64 out32(GPIO1_TSRL, in32(GPIO1_TSRL) & ~0x00005500);
65 out32(GPIO1_ISR1L, in32(GPIO1_ISR1L) | 0x00005500);
66
67
68
69
70
71 mtdcr(UIC0SR, 0xffffffff);
72 mtdcr(UIC0ER, 0x00000000);
73 mtdcr(UIC0CR, 0x00000009);
74 mtdcr(UIC0PR, 0xfffffe13);
75 mtdcr(UIC0TR, 0x01c00008);
76 mtdcr(UIC0VR, 0x00000001);
77 mtdcr(UIC0SR, 0xffffffff);
78
79 mtdcr(UIC1SR, 0xffffffff);
80 mtdcr(UIC1ER, 0x00000000);
81 mtdcr(UIC1CR, 0x00000000);
82 mtdcr(UIC1PR, 0xffffe0ff);
83 mtdcr(UIC1TR, 0x00ffc000);
84 mtdcr(UIC1VR, 0x00000001);
85 mtdcr(UIC1SR, 0xffffffff);
86
87
88
89
90 mfsdr(SDR0_PCI0, reg);
91 mtsdr(SDR0_PCI0, 0x80000000 | reg);
92 mtsdr(SDR0_PFC0, 0x00003e00);
93 mtsdr(SDR0_PFC1, 0x00048000);
94
95 return 0;
96}
97
98int misc_init_r(void)
99{
100 uint pbcr;
101 int size_val;
102 uint sz;
103
104
105 mfebc(PB0CR, pbcr);
106
107 if (gd->bd->bi_flashsize > 0x08000000)
108 panic("Max. flash banksize is 128 MB!\n");
109
110 for (sz = gd->bd->bi_flashsize, size_val = 7;
111 ((sz & 0x08000000) == 0) && (size_val > 0); --size_val)
112 sz <<= 1;
113
114 pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
115 mtebc(PB0CR, pbcr);
116
117
118 gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
119 gd->bd->bi_flashoffset = 0;
120
121
122 (void)flash_protect(FLAG_PROTECT_SET,
123 -CONFIG_SYS_MONITOR_LEN,
124 0xffffffff,
125 &flash_info[0]);
126
127 return 0;
128}
129
130int checkboard(void)
131{
132 char buf[64];
133 int i = getenv_f("serial#", buf, sizeof(buf));
134
135 printf("Board: GDPPC440ETX - G&D PPC440EP/GR ETX-module");
136
137 if (i > 0) {
138 puts(", serial# ");
139 puts(buf);
140 }
141 putc('\n');
142
143 return 0;
144}
145
146
147
148
149#if defined(CONFIG_PCI)
150int pci_pre_init(struct pci_controller *hose)
151{
152
153 __pci_pre_init(hose);
154
155
156 out32(GPIO1_TCR, in32(GPIO1_TCR) | 0x00008000);
157 out32(GPIO1_OR, in32(GPIO1_OR) | 0x00008000);
158
159 return 1;
160}
161#endif
162