Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *
0003  * BRIEF MODULE DESCRIPTION
0004  *      Board specific pci fixups for the Toshiba rbtx4927
0005  *
0006  * Copyright 2001 MontaVista Software Inc.
0007  * Author: MontaVista Software, Inc.
0008  *              ppopov@mvista.com or source@mvista.com
0009  *
0010  * Copyright (C) 2000-2001 Toshiba Corporation
0011  *
0012  * Copyright (C) 2004 MontaVista Software Inc.
0013  * Author: Manish Lachwani (mlachwani@mvista.com)
0014  *
0015  *  This program is free software; you can redistribute  it and/or modify it
0016  *  under  the terms of  the GNU General  Public License as published by the
0017  *  Free Software Foundation;  either version 2 of the  License, or (at your
0018  *  option) any later version.
0019  *
0020  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
0021  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
0022  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
0023  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
0024  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0025  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
0026  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
0027  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
0028  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0029  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0030  *
0031  *  You should have received a copy of the  GNU General Public License along
0032  *  with this program; if not, write  to the Free Software Foundation, Inc.,
0033  *  675 Mass Ave, Cambridge, MA 02139, USA.
0034  */
0035 #include <linux/types.h>
0036 #include <asm/txx9/pci.h>
0037 #include <asm/txx9/rbtx4927.h>
0038 
0039 int rbtx4927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
0040 {
0041     unsigned char irq = pin;
0042 
0043     /* IRQ rotation */
0044     irq--;          /* 0-3 */
0045     if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {
0046         /* PCI CardSlot (IDSEL=A23) */
0047         /* PCIA => PCIA */
0048         irq = (irq + 0 + slot) % 4;
0049     } else {
0050         /* PCI Backplane */
0051         if (txx9_pci_option & TXX9_PCI_OPT_PICMG)
0052             irq = (irq + 33 - slot) % 4;
0053         else
0054             irq = (irq + 3 + slot) % 4;
0055     }
0056     irq++;  /* 1-4 */
0057 
0058     switch (irq) {
0059     case 1:
0060         irq = RBTX4927_IRQ_IOC_PCIA;
0061         break;
0062     case 2:
0063         irq = RBTX4927_IRQ_IOC_PCIB;
0064         break;
0065     case 3:
0066         irq = RBTX4927_IRQ_IOC_PCIC;
0067         break;
0068     case 4:
0069         irq = RBTX4927_IRQ_IOC_PCID;
0070         break;
0071     }
0072     return irq;
0073 }