// SPDX-License-Identifier: GPL-2.0-only /* * Old U-boot compatibility for PowerQUICC II * (a.k.a. 82xx with CPM, not the 8240 family of chips) * * Author: Scott Wood <scottwood@freescale.com> * * Copyright (c) 2007 Freescale Semiconductor, Inc.
*/
/* Different versions of u-boot put the BCSR in different places, and * some don't set up the PCI PIC at all, so we assume the device tree is * sane and update the BRx registers appropriately. * * For any node defined as compatible with fsl,pq2-localbus, * #address/#size must be 2/1 for the localbus, and 1/1 for the parent bus. * Ranges must be for whole chip selects.
*/ staticvoid update_cs_ranges(void)
{ void *bus_node, *parent_node;
u32 *ctrl_addr; unsignedlong ctrl_size;
u32 naddr, nsize; int len; int i;
bus_node = finddevice("/localbus"); if (!bus_node || !dt_is_compatible(bus_node, "fsl,pq2-localbus")) return;
/* Older u-boots don't set PCI up properly. Update the hardware to match * the device tree. The prefetch mem region and non-prefetch mem region * must be contiguous in the host bus. As required by the PCI binding, * PCI #addr/#size must be 3/2. The parent bus must be 1/1. Only * 32-bit PCI is supported. All three region types (prefetchable mem, * non-prefetchable mem, and I/O) must be present.
*/ staticvoid fixup_pci(void)
{ struct pci_range *mem = NULL, *mmio = NULL,
*io = NULL, *mem_base = NULL;
u32 *pci_regs[3];
u8 *soc_regs; int i, len; void *node, *parent_node;
u32 naddr, nsize, mem_pow2, mem_mask;
node = finddevice("/pci"); if (!node || !dt_is_compatible(node, "fsl,pq2-pci")) return;
for (i = 0; i < 3; i++) if (!dt_xlate_reg(node, i,
(unsignedlong *)&pci_regs[i], NULL)) goto err;
soc_regs = (u8 *)fsl_get_immr(); if (!soc_regs) goto unhandled;
/* If PCI is disabled, drive RST high to enable. */ if (!(in_le32(&pci_regs[0][32]) & 1)) { /* Tpvrh (Power valid to RST# high) 100 ms */
udelay(100000);
out_le32(&pci_regs[0][32], 1);
/* Trhfa (RST# high to first cfg access) 2^25 clocks */
udelay(1020000);
}
/* Enable bus master and memory access */
out_le32(&pci_regs[0][64], 0x80000004);
out_le32(&pci_regs[0][65], in_le32(&pci_regs[0][65]) | 6);
/* Park the bus on PCI, and elevate PCI's arbitration priority, * as required by section 9.6 of the user's manual.
*/
out_8(&soc_regs[0x10028], 3);
out_be32((u32 *)&soc_regs[0x1002c], 0x01236745);
return;
err:
printf("Bad PCI node -- using existing firmware setup.\r\n"); return;
unhandled:
printf("Unsupported PCI node -- using existing firmware setup.\r\n");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.