/*
- * $Id$
- *
* ADM5120 PCI Host Controller driver
*
- * Copyright (C) 2007 OpenWrt.org
- * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
+ * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
*
* This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel
* done by Jeroen Vreeken
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/io.h>
+#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include <linux/pci_regs.h>
-#include <asm/delay.h>
#include <asm/bootinfo.h>
-#include <adm5120_defs.h>
-#include <adm5120_info.h>
-#include <adm5120_defs.h>
-#include <adm5120_platform.h>
+#include <asm/mach-adm5120/adm5120_defs.h>
+#include <asm/mach-adm5120/adm5120_info.h>
+#include <asm/mach-adm5120/adm5120_defs.h>
+#include <asm/mach-adm5120/adm5120_platform.h>
#undef DEBUG
static unsigned int adm5120_pci_nr_irqs __initdata;
static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata;
-static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(pci_lock);
/* -------------------------------------------------------------------------*/
static inline u32 mkaddr(struct pci_bus *bus, unsigned int devfn, int where)
{
- return (((bus->number & 0xFF) << 16) | ((devfn & 0xFF) << 8) | \
- (where & 0xFC));
+ return ((bus->number & 0xFF) << 16) | ((devfn & 0xFF) << 8) | \
+ (where & 0xFC);
}
/* -------------------------------------------------------------------------*/
goto out;
}
- if (slot < 1 || slot > 3) {
+ if (slot < 1 || slot > 4) {
printk(KERN_ALERT "PCI: slot number %u is not supported\n",
slot);
goto out;
static int __init adm5120_pci_setup(void)
{
- int pci_bios;
-
- pci_bios = adm5120_has_pci();
-
- printk(KERN_INFO "adm5120: system has %sPCI BIOS\n",
- pci_bios ? "" : "no ");
- if (pci_bios == 0)
+ if (adm5120_package_pqfp()) {
+ printk(KERN_INFO "PCI: not available on ADM5120P\n");
return -1;
+ }
/* Avoid ISA compat ranges. */
PCIBIOS_MIN_IO = 0x00000000;