21 #define TARGET_HAS_ETH1
51 static void update_cs_ranges(
void)
55 unsigned long ctrl_size;
60 bus_node = finddevice(
"/localbus");
65 if (naddr != 2 || nsize != 1)
68 parent_node = get_parent(bus_node);
73 if (naddr != 1 || nsize != 1)
76 if (!
dt_xlate_reg(bus_node, 0, (
unsigned long *)&ctrl_addr,
82 for (i = 0; i < len /
sizeof(
struct cs_range); i++) {
85 if (cs >= ctrl_size / 8)
91 base =
in_be32(&ctrl_addr[cs * 2]);
98 option =
in_be32(&ctrl_addr[cs * 2 + 1]) & 0x7fff;
113 printf(
"Bad /localbus node\r\n");
123 static void fixup_pci(
void)
131 u32 naddr,
nsize, mem_pow2, mem_mask;
133 node = finddevice(
"/pci");
137 for (i = 0; i < 3; i++)
139 (
unsigned long *)&pci_regs[i],
NULL))
147 if (naddr != 3 || nsize != 2)
150 parent_node = get_parent(node);
155 if (naddr != 1 || nsize != 1)
161 for (i = 0; i < len /
sizeof(
struct pci_range); i++) {
164 if (flags == 0x42000000)
166 else if (flags == 0x02000000)
168 else if (flags == 0x01000000)
172 if (!mem || !mmio || !io)
174 if (mem->
size[1] != mmio->size[1])
176 if (mem->
size[1] & (mem->
size[1] - 1))
178 if (io->size[1] & (io->size[1] - 1))
183 else if (mmio->phys_addr + mmio->size[1] == mem->
phys_addr)
188 out_be32(&pci_regs[1][0], mem_base->phys_addr | 1);
189 out_be32(&pci_regs[2][0], ~(mem->
size[1] + mmio->size[1] - 1));
191 out_be32(&pci_regs[1][1], io->phys_addr | 1);
192 out_be32(&pci_regs[2][1], ~(io->size[1] - 1));
196 out_le32(&pci_regs[0][4], (~(mem->
size[1] - 1) >> 12) | 0xa0000000);
198 out_le32(&pci_regs[0][6], mmio->pci_addr[1] >> 12);
199 out_le32(&pci_regs[0][8], mmio->phys_addr >> 12);
200 out_le32(&pci_regs[0][10], (~(mmio->size[1] - 1) >> 12) | 0x80000000);
202 out_le32(&pci_regs[0][12], io->pci_addr[1] >> 12);
203 out_le32(&pci_regs[0][14], io->phys_addr >> 12);
204 out_le32(&pci_regs[0][16], (~(io->size[1] - 1) >> 12) | 0xc0000000);
210 mem_pow2 = 1 << (__ilog2_u32(bd.
bi_memsize - 1) + 1);
211 mem_mask = ~(mem_pow2 - 1) >> 12;
212 out_le32(&pci_regs[0][62], 0xa0000000 | mem_mask);
215 if (!(
in_le32(&pci_regs[0][32]) & 1)) {
226 out_le32(&pci_regs[0][64], 0x80000004);
232 out_8(&soc_regs[0x10028], 3);
238 printf(
"Bad PCI node -- using existing firmware setup.\r\n");
242 printf(
"Unsupported PCI node -- using existing firmware setup.\r\n");
245 static void pq2_platform_fixups(
void)
253 node = finddevice(
"/soc/cpm");
255 setprop(node,
"clock-frequency", &bd.
bi_cpmfreq, 4);
257 node = finddevice(
"/soc/cpm/brg");
259 setprop(node,
"clock-frequency", &bd.
bi_brgfreq, 4);
266 unsigned long r6,
unsigned long r7)