22 #include <linux/kernel.h>
24 #include <linux/pci.h>
31 #include <mach/hardware.h>
35 static int nanoengine_get_pci_address(
struct pci_bus *
bus,
39 unsigned int busnr = bus->
number;
42 ((bus->
number << 16) | (devfn << 8) | (where & ~3));
44 ret = (busnr > 255 ||
devfn > 255 || where > 255) ?
50 static int nanoengine_read_config(
struct pci_bus *
bus,
unsigned int devfn,
int where,
61 if (bus->
number != 0 || (devfn >> 3) != 0) {
63 nanoengine_get_pci_address(bus, devfn, where, &address);
69 ret = nanoengine_get_pci_address(bus, devfn, where, &address);
74 spin_unlock_irqrestore(&nano_lock, flags);
76 v >>= ((where & 3) * 8);
77 v &= (
unsigned long)(-1) >> ((4 -
size) * 8);
84 static int nanoengine_write_config(
struct pci_bus *bus,
unsigned int devfn,
int where,
93 shift = (where & 3) * 8;
97 ret = nanoengine_get_pci_address(bus, devfn, where, &address);
103 v &= ~(0xFF << shift);
107 v &= ~(0xFFFF << shift);
116 spin_unlock_irqrestore(&nano_lock, flags);
121 static struct pci_ops pci_nano_ops = {
122 .read = nanoengine_read_config,
123 .write = nanoengine_write_config,
132 static struct resource pci_io_ports =
135 static struct resource pci_non_prefetchable_memory = {
136 .name =
"PCI non-prefetchable",
213 static struct resource pci_prefetchable_memory = {
214 .name =
"PCI prefetchable",
239 &pci_non_prefetchable_memory, sys->
mem_offset);
256 ret = pci_nanoengine_setup_resources(sys);
269 .map_irq = pci_nanoengine_map_irq,
271 .ops = &pci_nano_ops,
275 static int __init nanoengine_pci_init(
void)
277 if (machine_is_nanoengine())