/*1*2* BRIEF MODULE DESCRIPTION3* Board specific pci fixups.4*5* Copyright 2001 MontaVista Software Inc.6* Author: MontaVista Software, Inc.7* [email protected] or [email protected]8*9* This program is free software; you can redistribute it and/or modify it10* under the terms of the GNU General Public License as published by the11* Free Software Foundation; either version 2 of the License, or (at your12* option) any later version.13*14* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED15* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF16* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN17* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,18* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT19* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF20* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON21* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF23* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.24*25* You should have received a copy of the GNU General Public License along26* with this program; if not, write to the Free Software Foundation, Inc.,27* 675 Mass Ave, Cambridge, MA 02139, USA.28*/29#include <linux/types.h>30#include <asm/txx9/pci.h>31#include <asm/txx9/jmr3927.h>3233int __init jmr3927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)34{35unsigned char irq = pin;3637/* IRQ rotation (PICMG) */38irq--; /* 0-3 */39if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(23)) {40/* PCI CardSlot (IDSEL=A23, DevNu=12) */41/* PCIA => PCIC (IDSEL=A23) */42/* NOTE: JMR3927 JP1 must be set to OPEN */43irq = (irq + 2) % 4;44} else if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(22)) {45/* PCI CardSlot (IDSEL=A22, DevNu=11) */46/* PCIA => PCIA (IDSEL=A22) */47/* NOTE: JMR3927 JP1 must be set to OPEN */48irq = (irq + 0) % 4;49} else {50/* PCI Backplane */51if (txx9_pci_option & TXX9_PCI_OPT_PICMG)52irq = (irq + 33 - slot) % 4;53else54irq = (irq + 3 + slot) % 4;55}56irq++; /* 1-4 */5758switch (irq) {59case 1:60irq = JMR3927_IRQ_IOC_PCIA;61break;62case 2:63irq = JMR3927_IRQ_IOC_PCIB;64break;65case 3:66irq = JMR3927_IRQ_IOC_PCIC;67break;68case 4:69irq = JMR3927_IRQ_IOC_PCID;70break;71}7273/* Check OnBoard Ethernet (IDSEL=A24, DevNu=13) */74if (dev->bus->parent == NULL &&75slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(24))76irq = JMR3927_IRQ_ETHER0;77return irq;78}798081