fixup-rbtx4938.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Toshiba rbtx4938 pci routines
  3. * Copyright (C) 2000-2001 Toshiba Corporation
  4. *
  5. * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
  6. * terms of the GNU General Public License version 2. This program is
  7. * licensed "as is" without any warranty of any kind, whether express
  8. * or implied.
  9. *
  10. * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
  11. */
  12. #include <linux/types.h>
  13. #include <asm/txx9/pci.h>
  14. #include <asm/txx9/rbtx4938.h>
  15. int __init rbtx4938_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  16. {
  17. int irq = tx4938_pcic1_map_irq(dev, slot);
  18. if (irq >= 0)
  19. return irq;
  20. irq = pin;
  21. /* IRQ rotation */
  22. irq--; /* 0-3 */
  23. if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {
  24. /* PCI CardSlot (IDSEL=A23) */
  25. /* PCIA => PCIA (IDSEL=A23) */
  26. irq = (irq + 0 + slot) % 4;
  27. } else {
  28. /* PCI Backplane */
  29. if (txx9_pci_option & TXX9_PCI_OPT_PICMG)
  30. irq = (irq + 33 - slot) % 4;
  31. else
  32. irq = (irq + 3 + slot) % 4;
  33. }
  34. irq++; /* 1-4 */
  35. switch (irq) {
  36. case 1:
  37. irq = RBTX4938_IRQ_IOC_PCIA;
  38. break;
  39. case 2:
  40. irq = RBTX4938_IRQ_IOC_PCIB;
  41. break;
  42. case 3:
  43. irq = RBTX4938_IRQ_IOC_PCIC;
  44. break;
  45. case 4:
  46. irq = RBTX4938_IRQ_IOC_PCID;
  47. break;
  48. }
  49. return irq;
  50. }