Path: blob/master/arch/arm/mach-ixp4xx/nas100d-pci.c
10817 views
/*1* arch/arm/mach-ixp4xx/nas100d-pci.c2*3* NAS 100d 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 831#define INTE 73233void __init nas100d_pci_preinit(void)34{35irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);36irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);37irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);38irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);39irq_set_irq_type(IXP4XX_GPIO_IRQ(INTE), IRQ_TYPE_LEVEL_LOW);40ixp4xx_pci_preinit();41}4243static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin)44{45static int pci_irq_table[MAX_DEV][IRQ_LINES] = {46{ IXP4XX_GPIO_IRQ(INTA), -1, -1 },47{ IXP4XX_GPIO_IRQ(INTB), -1, -1 },48{ IXP4XX_GPIO_IRQ(INTC), IXP4XX_GPIO_IRQ(INTD),49IXP4XX_GPIO_IRQ(INTE) },50};5152if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)53return pci_irq_table[slot - 1][pin - 1];5455return -1;56}5758struct hw_pci __initdata nas100d_pci = {59.nr_controllers = 1,60.preinit = nas100d_pci_preinit,61.swizzle = pci_std_swizzle,62.setup = ixp4xx_setup,63.scan = ixp4xx_scan_bus,64.map_irq = nas100d_map_irq,65};6667int __init nas100d_pci_init(void)68{69if (machine_is_nas100d())70pci_common_init(&nas100d_pci);7172return 0;73}7475subsys_initcall(nas100d_pci_init);767778