18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Toshiba rbtx4938 pci routines 38c2ecf20Sopenharmony_ci * Copyright (C) 2000-2001 Toshiba Corporation 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 68c2ecf20Sopenharmony_ci * terms of the GNU General Public License version 2. This program is 78c2ecf20Sopenharmony_ci * licensed "as is" without any warranty of any kind, whether express 88c2ecf20Sopenharmony_ci * or implied. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci#include <linux/types.h> 138c2ecf20Sopenharmony_ci#include <asm/txx9/pci.h> 148c2ecf20Sopenharmony_ci#include <asm/txx9/rbtx4938.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciint rbtx4938_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci int irq = tx4938_pcic1_map_irq(dev, slot); 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci if (irq >= 0) 218c2ecf20Sopenharmony_ci return irq; 228c2ecf20Sopenharmony_ci irq = pin; 238c2ecf20Sopenharmony_ci /* IRQ rotation */ 248c2ecf20Sopenharmony_ci irq--; /* 0-3 */ 258c2ecf20Sopenharmony_ci if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) { 268c2ecf20Sopenharmony_ci /* PCI CardSlot (IDSEL=A23) */ 278c2ecf20Sopenharmony_ci /* PCIA => PCIA (IDSEL=A23) */ 288c2ecf20Sopenharmony_ci irq = (irq + 0 + slot) % 4; 298c2ecf20Sopenharmony_ci } else { 308c2ecf20Sopenharmony_ci /* PCI Backplane */ 318c2ecf20Sopenharmony_ci if (txx9_pci_option & TXX9_PCI_OPT_PICMG) 328c2ecf20Sopenharmony_ci irq = (irq + 33 - slot) % 4; 338c2ecf20Sopenharmony_ci else 348c2ecf20Sopenharmony_ci irq = (irq + 3 + slot) % 4; 358c2ecf20Sopenharmony_ci } 368c2ecf20Sopenharmony_ci irq++; /* 1-4 */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci switch (irq) { 398c2ecf20Sopenharmony_ci case 1: 408c2ecf20Sopenharmony_ci irq = RBTX4938_IRQ_IOC_PCIA; 418c2ecf20Sopenharmony_ci break; 428c2ecf20Sopenharmony_ci case 2: 438c2ecf20Sopenharmony_ci irq = RBTX4938_IRQ_IOC_PCIB; 448c2ecf20Sopenharmony_ci break; 458c2ecf20Sopenharmony_ci case 3: 468c2ecf20Sopenharmony_ci irq = RBTX4938_IRQ_IOC_PCIC; 478c2ecf20Sopenharmony_ci break; 488c2ecf20Sopenharmony_ci case 4: 498c2ecf20Sopenharmony_ci irq = RBTX4938_IRQ_IOC_PCID; 508c2ecf20Sopenharmony_ci break; 518c2ecf20Sopenharmony_ci } 528c2ecf20Sopenharmony_ci return irq; 538c2ecf20Sopenharmony_ci} 54