Path: blob/master/arch/arm/mach-ixp4xx/nslu2-pci.c
10817 views
/*1* arch/arm/mach-ixp4xx/nslu2-pci.c2*3* NSLU2 board-level PCI initialization4*5* based on ixdp425-pci.c:6* Copyright (C) 2002 Intel Corporation.7* Copyright (C) 2003-2004 MontaVista Software, Inc.8*9* Maintainer: http://www.nslu2-linux.org/10*11* This program is free software; you can redistribute it and/or modify12* it under the terms of the GNU General Public License version 2 as13* published by the Free Software Foundation.14*15*/1617#include <linux/pci.h>18#include <linux/init.h>19#include <linux/irq.h>20#include <asm/mach/pci.h>21#include <asm/mach-types.h>2223#define MAX_DEV 324#define IRQ_LINES 32526/* PCI controller GPIO to IRQ pin mappings */27#define INTA 1128#define INTB 1029#define INTC 930#define INTD 83132void __init nslu2_pci_preinit(void)33{34irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);35irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);36irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);37ixp4xx_pci_preinit();38}3940static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)41{42static int pci_irq_table[IRQ_LINES] = {43IXP4XX_GPIO_IRQ(INTA),44IXP4XX_GPIO_IRQ(INTB),45IXP4XX_GPIO_IRQ(INTC),46};4748if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)49return pci_irq_table[(slot + pin - 2) % IRQ_LINES];5051return -1;52}5354struct hw_pci __initdata nslu2_pci = {55.nr_controllers = 1,56.preinit = nslu2_pci_preinit,57.swizzle = pci_std_swizzle,58.setup = ixp4xx_setup,59.scan = ixp4xx_scan_bus,60.map_irq = nslu2_map_irq,61};6263int __init nslu2_pci_init(void) /* monkey see, monkey do */64{65if (machine_is_nslu2())66pci_common_init(&nslu2_pci);6768return 0;69}7071subsys_initcall(nslu2_pci_init);727374