/*1*2* BRIEF MODULE DESCRIPTION3* Board specific pci fixups for the Toshiba rbtx49274*5* Copyright 2001 MontaVista Software Inc.6* Author: MontaVista Software, Inc.7* [email protected] or [email protected]8*9* Copyright (C) 2000-2001 Toshiba Corporation10*11* Copyright (C) 2004 MontaVista Software Inc.12* Author: Manish Lachwani ([email protected])13*14* This program is free software; you can redistribute it and/or modify it15* under the terms of the GNU General Public License as published by the16* Free Software Foundation; either version 2 of the License, or (at your17* option) any later version.18*19* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED20* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF21* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN22* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,23* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT24* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF25* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON26* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT27* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF28* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.29*30* You should have received a copy of the GNU General Public License along31* with this program; if not, write to the Free Software Foundation, Inc.,32* 675 Mass Ave, Cambridge, MA 02139, USA.33*/34#include <linux/types.h>35#include <asm/txx9/pci.h>36#include <asm/txx9/rbtx4927.h>3738int __init rbtx4927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)39{40unsigned char irq = pin;4142/* IRQ rotation */43irq--; /* 0-3 */44if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {45/* PCI CardSlot (IDSEL=A23) */46/* PCIA => PCIA */47irq = (irq + 0 + slot) % 4;48} else {49/* PCI Backplane */50if (txx9_pci_option & TXX9_PCI_OPT_PICMG)51irq = (irq + 33 - slot) % 4;52else53irq = (irq + 3 + slot) % 4;54}55irq++; /* 1-4 */5657switch (irq) {58case 1:59irq = RBTX4927_IRQ_IOC_PCIA;60break;61case 2:62irq = RBTX4927_IRQ_IOC_PCIB;63break;64case 3:65irq = RBTX4927_IRQ_IOC_PCIC;66break;67case 4:68irq = RBTX4927_IRQ_IOC_PCID;69break;70}71return irq;72}737475