Path: blob/master/arch/arm/mach-ixp4xx/avila-pci.c
10817 views
/*1* arch/arm/mach-ixp4xx/avila-pci.c2*3* Gateworks Avila board-level PCI initialization4*5* Author: Michael-Luke Jones <[email protected]>6*7* Based on ixdp-pci.c8* Copyright (C) 2002 Intel Corporation.9* Copyright (C) 2003-2004 MontaVista Software, Inc.10*11* Maintainer: Deepak Saxena <[email protected]>12*13* This program is free software; you can redistribute it and/or modify14* it under the terms of the GNU General Public License version 2 as15* published by the Free Software Foundation.16*17*/1819#include <linux/kernel.h>20#include <linux/pci.h>21#include <linux/init.h>22#include <linux/irq.h>23#include <linux/delay.h>24#include <asm/mach/pci.h>25#include <asm/irq.h>26#include <mach/hardware.h>27#include <asm/mach-types.h>2829#define AVILA_MAX_DEV 430#define LOFT_MAX_DEV 631#define IRQ_LINES 43233/* PCI controller GPIO to IRQ pin mappings */34#define INTA 1135#define INTB 1036#define INTC 937#define INTD 83839void __init avila_pci_preinit(void)40{41irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);42irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);43irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);44irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);45ixp4xx_pci_preinit();46}4748static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin)49{50static int pci_irq_table[IRQ_LINES] = {51IXP4XX_GPIO_IRQ(INTA),52IXP4XX_GPIO_IRQ(INTB),53IXP4XX_GPIO_IRQ(INTC),54IXP4XX_GPIO_IRQ(INTD)55};5657if (slot >= 1 &&58slot <= (machine_is_loft() ? LOFT_MAX_DEV : AVILA_MAX_DEV) &&59pin >= 1 && pin <= IRQ_LINES)60return pci_irq_table[(slot + pin - 2) % 4];6162return -1;63}6465struct hw_pci avila_pci __initdata = {66.nr_controllers = 1,67.preinit = avila_pci_preinit,68.swizzle = pci_std_swizzle,69.setup = ixp4xx_setup,70.scan = ixp4xx_scan_bus,71.map_irq = avila_map_irq,72};7374int __init avila_pci_init(void)75{76if (machine_is_avila() || machine_is_loft())77pci_common_init(&avila_pci);78return 0;79}8081subsys_initcall(avila_pci_init);828384