11 #include <linux/types.h>
12 #include <linux/module.h>
14 #include <linux/kernel.h>
18 #include <linux/pci.h>
30 #define PCI_MEM_PA 0xf0000000
31 #define PCI_MEM_BA 0xf0000000
32 #define PCI_MEM_SIZE 0x08000000
33 #define PCI_MEM_MASK (PCI_MEM_SIZE - 1)
35 #define PCI_IO_PA 0xf8000000
36 #define PCI_IO_BA 0x00000000
37 #define PCI_IO_SIZE 0x00010000
38 #define PCI_IO_MASK (PCI_IO_SIZE - 1)
41 static unsigned long iospace;
48 static unsigned char mcf_host_slot2sid[32] = {
49 0, 0, 0, 0, 0, 0, 0, 0,
50 0, 0, 0, 0, 0, 0, 0, 0,
51 0, 1, 2, 0, 3, 4, 0, 0,
52 0, 0, 0, 0, 0, 0, 0, 0,
55 static unsigned char mcf_host_irq[] = {
60 static inline void syncio(
void)
70 static unsigned long mcf_mk_pcicar(
int bus,
unsigned int devfn,
int where)
75 static int mcf_pci_readconfig(
struct pci_bus *bus,
unsigned int devfn,
83 if (mcf_host_slot2sid[
PCI_SLOT(devfn)] == 0)
88 addr = mcf_mk_pcicar(bus->
number, devfn, where);
90 addr = iospace + (where & 0x3);
109 static int mcf_pci_writeconfig(
struct pci_bus *bus,
unsigned int devfn,
110 int where,
int size,
u32 value)
115 if (mcf_host_slot2sid[
PCI_SLOT(devfn)] == 0)
120 addr = mcf_mk_pcicar(bus->
number, devfn, where);
122 addr = iospace + (where & 0x3);
141 static struct pci_ops mcf_pci_ops = {
142 .read = mcf_pci_readconfig,
143 .write = mcf_pci_writeconfig,
232 static struct resource mcf_pci_mem = {
233 .name =
"PCI Memory space",
239 static struct resource mcf_pci_io = {
240 .name =
"PCI IO space",
253 sid = mcf_host_slot2sid[
slot];
255 return mcf_host_irq[
sid];
259 static int __init mcf_pci_init(
void)
261 pr_info(
"ColdFire: PCI bus initialization...\n");
307 pr_info(
"Coldfire: PCI IO/config window mapped to 0x%x\n",
317 rootbus->
resource[1] = &mcf_pci_mem;