17 #include <linux/kernel.h>
18 #include <linux/pci.h>
25 #include <mach/hardware.h>
40 #define __IO_ADDRESS(n) ((void __iomem *)(unsigned long)IO_ADDRESS(n))
41 #define SYS_PCICTL __IO_ADDRESS(VERSATILE_SYS_PCICTL)
42 #define PCI_IMAP0 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x0)
43 #define PCI_IMAP1 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x4)
44 #define PCI_IMAP2 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x8)
45 #define PCI_SMAP0 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x10)
46 #define PCI_SMAP1 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x14)
47 #define PCI_SMAP2 __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0x18)
48 #define PCI_SELFID __IO_ADDRESS(VERSATILE_PCI_CORE_BASE+0xc)
50 #define DEVICE_ID_OFFSET 0x00
51 #define CSR_OFFSET 0x04
52 #define CLASS_ID_OFFSET 0x08
54 #define VP_PCI_DEVICE_ID 0x030010ee
55 #define VP_PCI_CLASS_ID 0x0b400000
57 static unsigned long pci_slot_ignore = 0;
59 static int __init versatile_pci_slot_ignore(
char *
str)
65 if ((slot < 0) || (slot > 31)) {
66 printk(
"Illegal slot value: %d\n",slot);
68 pci_slot_ignore |= (1 <<
slot);
74 __setup(
"pci_slot_ignore=", versatile_pci_slot_ignore);
80 unsigned int busnr = bus->
number;
96 static int versatile_read_config(
struct pci_bus *bus,
unsigned int devfn,
int where,
99 void __iomem *
addr = __pci_addr(bus, devfn, where & ~3);
103 if (pci_slot_ignore & (1 << slot)) {
119 if (where & 2) v >>= 16;
120 if (where & 1) v >>= 8;
126 if (where & 2) v >>= 16;
140 static int versatile_write_config(
struct pci_bus *bus,
unsigned int devfn,
int where,
143 void __iomem *addr = __pci_addr(bus, devfn, where);
146 if (pci_slot_ignore & (1 << slot)) {
167 static struct pci_ops pci_versatile_ops = {
168 .read = versatile_read_config,
169 .write = versatile_write_config,
173 .name =
"PCI I/O space",
180 .name =
"PCI non-prefetchable",
187 .name =
"PCI prefetchable",
200 "memory region (%d)\n", ret);
206 "memory region (%d)\n", ret);
212 "memory region (%d)\n", ret);
213 goto release_non_mem;
239 void __iomem *local_pci_cfg_base;
243 printk(
"Not plugged into PCI backplane!\n");
253 ret = pci_versatile_setup_resources(sys);
255 printk(
"pci_versatile_setup: resources... oops?\n");
259 printk(
"pci_versatile_setup: resources... nr == 0??\n");
275 printk(
"Cannot find PCI core!\n");
280 printk(
"PCI core found (slot %d)\n",myslot);
299 pci_slot_ignore |= (1 << myslot);
309 pcibios_min_mem = 0x50000000;
335 irq = 27 + ((slot - 24 + pin - 1) & 3);
341 .map_irq = versatile_map_irq,
343 .ops = &pci_versatile_ops,
348 static int __init versatile_pci_init(
void)