/* * pci.c -- PCI bus support for ColdFire processors * * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.com> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details.
*/
/* * Memory and IO mappings. We use a 1:1 mapping for local host memory to * PCI bus memory (no reason not to really). IO space is mapped in its own * separate address region. The device configuration space is mapped over * the IO map space when we enable it in the PCICAR register.
*/ staticstruct pci_bus *rootbus; staticunsignedlong iospace;
/* * We need to be careful probing on bus 0 (directly connected to host * bridge). We should only access the well defined possible devices in * use, ignore aliases and the like.
*/ staticunsignedchar mcf_host_slot2sid[32] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 0, 3, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
/* * Configuration space access functions. Configuration space access is * through the IO mapping window, enabling it via the PCICAR register.
*/ staticunsignedlong mcf_mk_pcicar(int bus, unsignedint devfn, int where)
{ return (bus << PCICAR_BUSN) | (devfn << PCICAR_DEVFNN) | (where & 0xfc);
}
staticint mcf_pci_readconfig(struct pci_bus *bus, unsignedint devfn, int where, int size, u32 *value)
{ unsignedlong addr;
*value = 0xffffffff;
if (bus->number == 0) { if (mcf_host_slot2sid[PCI_SLOT(devfn)] == 0) return PCIBIOS_SUCCESSFUL;
}
/* Set required multi-function pins for PCI bus use */
__raw_writew(0x3ff, MCFGPIO_PAR_PCIBG);
__raw_writew(0x3ff, MCFGPIO_PAR_PCIBR);
/* Set up config space for local host bus controller */
__raw_writel(PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
PCI_COMMAND_INVALIDATE, PCISCR);
__raw_writel(PCICR1_LT(32) | PCICR1_CL(8), PCICR1);
__raw_writel(0, PCICR2);
/* * Set up the initiator windows for memory and IO mapping. * These give the CPU bus access onto the PCI bus. One for each of * PCI memory and IO address spaces.
*/
__raw_writel(WXBTAR(PCI_MEM_PA, PCI_MEM_BA, PCI_MEM_SIZE),
PCIIW0BTAR);
__raw_writel(WXBTAR(PCI_IO_PA, PCI_IO_BA, PCI_IO_SIZE),
PCIIW1BTAR);
__raw_writel(PCIIWCR_W0_MEM /*| PCIIWCR_W0_MRDL*/ | PCIIWCR_W0_E |
PCIIWCR_W1_IO | PCIIWCR_W1_E, PCIIWCR);
/* * Set up the target windows for access from the PCI bus back to the * CPU bus. All we need is access to system RAM (for mastering).
*/
__raw_writel(CONFIG_RAMBASE, PCIBAR1);
__raw_writel(CONFIG_RAMBASE | PCITBATR1_E, PCITBATR1);
/* Keep a virtual mapping to IO/config space active */
iospace = (unsignedlong) ioremap(PCI_IO_PA, PCI_IO_SIZE); if (iospace == 0) {
pci_free_host_bridge(bridge); return -ENODEV;
}
pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n",
(u32) iospace);
/* Turn of PCI reset, and wait for devices to settle */
__raw_writel(0, PCIGSCR);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(200));
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.