fixup-pmcmsp.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * PMC-Sierra MSP board specific pci fixups.
  3. *
  4. * Copyright 2001 MontaVista Software Inc.
  5. * Copyright 2005-2007 PMC-Sierra, Inc
  6. *
  7. * Author: MontaVista Software, Inc.
  8. * ppopov@mvista.com or source@mvista.com
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  18. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  21. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 675 Mass Ave, Cambridge, MA 02139, USA.
  29. */
  30. #ifdef CONFIG_PCI
  31. #include <linux/types.h>
  32. #include <linux/pci.h>
  33. #include <linux/kernel.h>
  34. #include <linux/init.h>
  35. #include <asm/byteorder.h>
  36. #include <msp_pci.h>
  37. #include <msp_cic_int.h>
  38. /* PCI interrupt pins */
  39. #define IRQ4 MSP_INT_EXT4
  40. #define IRQ5 MSP_INT_EXT5
  41. #define IRQ6 MSP_INT_EXT6
  42. #if defined(CONFIG_PMC_MSP7120_GW)
  43. /* Garibaldi Board IRQ wiring to PCI slots */
  44. static char irq_tab[][5] __initdata = {
  45. /* INTA INTB INTC INTD */
  46. {0, 0, 0, 0, 0 }, /* (AD[0]): Unused */
  47. {0, 0, 0, 0, 0 }, /* (AD[1]): Unused */
  48. {0, 0, 0, 0, 0 }, /* (AD[2]): Unused */
  49. {0, 0, 0, 0, 0 }, /* (AD[3]): Unused */
  50. {0, 0, 0, 0, 0 }, /* (AD[4]): Unused */
  51. {0, 0, 0, 0, 0 }, /* (AD[5]): Unused */
  52. {0, 0, 0, 0, 0 }, /* (AD[6]): Unused */
  53. {0, 0, 0, 0, 0 }, /* (AD[7]): Unused */
  54. {0, 0, 0, 0, 0 }, /* (AD[8]): Unused */
  55. {0, 0, 0, 0, 0 }, /* (AD[9]): Unused */
  56. {0, 0, 0, 0, 0 }, /* 0 (AD[10]): Unused */
  57. {0, 0, 0, 0, 0 }, /* 1 (AD[11]): Unused */
  58. {0, 0, 0, 0, 0 }, /* 2 (AD[12]): Unused */
  59. {0, 0, 0, 0, 0 }, /* 3 (AD[13]): Unused */
  60. {0, 0, 0, 0, 0 }, /* 4 (AD[14]): Unused */
  61. {0, 0, 0, 0, 0 }, /* 5 (AD[15]): Unused */
  62. {0, 0, 0, 0, 0 }, /* 6 (AD[16]): Unused */
  63. {0, 0, 0, 0, 0 }, /* 7 (AD[17]): Unused */
  64. {0, 0, 0, 0, 0 }, /* 8 (AD[18]): Unused */
  65. {0, 0, 0, 0, 0 }, /* 9 (AD[19]): Unused */
  66. {0, 0, 0, 0, 0 }, /* 10 (AD[20]): Unused */
  67. {0, 0, 0, 0, 0 }, /* 11 (AD[21]): Unused */
  68. {0, 0, 0, 0, 0 }, /* 12 (AD[22]): Unused */
  69. {0, 0, 0, 0, 0 }, /* 13 (AD[23]): Unused */
  70. {0, 0, 0, 0, 0 }, /* 14 (AD[24]): Unused */
  71. {0, 0, 0, 0, 0 }, /* 15 (AD[25]): Unused */
  72. {0, 0, 0, 0, 0 }, /* 16 (AD[26]): Unused */
  73. {0, 0, 0, 0, 0 }, /* 17 (AD[27]): Unused */
  74. {0, IRQ4, IRQ4, 0, 0 }, /* 18 (AD[28]): slot 0 */
  75. {0, 0, 0, 0, 0 }, /* 19 (AD[29]): Unused */
  76. {0, IRQ5, IRQ5, 0, 0 }, /* 20 (AD[30]): slot 1 */
  77. {0, IRQ6, IRQ6, 0, 0 } /* 21 (AD[31]): slot 2 */
  78. };
  79. #elif defined(CONFIG_PMC_MSP7120_EVAL)
  80. /* MSP7120 Eval Board IRQ wiring to PCI slots */
  81. static char irq_tab[][5] __initdata = {
  82. /* INTA INTB INTC INTD */
  83. {0, 0, 0, 0, 0 }, /* (AD[0]): Unused */
  84. {0, 0, 0, 0, 0 }, /* (AD[1]): Unused */
  85. {0, 0, 0, 0, 0 }, /* (AD[2]): Unused */
  86. {0, 0, 0, 0, 0 }, /* (AD[3]): Unused */
  87. {0, 0, 0, 0, 0 }, /* (AD[4]): Unused */
  88. {0, 0, 0, 0, 0 }, /* (AD[5]): Unused */
  89. {0, 0, 0, 0, 0 }, /* (AD[6]): Unused */
  90. {0, 0, 0, 0, 0 }, /* (AD[7]): Unused */
  91. {0, 0, 0, 0, 0 }, /* (AD[8]): Unused */
  92. {0, 0, 0, 0, 0 }, /* (AD[9]): Unused */
  93. {0, 0, 0, 0, 0 }, /* 0 (AD[10]): Unused */
  94. {0, 0, 0, 0, 0 }, /* 1 (AD[11]): Unused */
  95. {0, 0, 0, 0, 0 }, /* 2 (AD[12]): Unused */
  96. {0, 0, 0, 0, 0 }, /* 3 (AD[13]): Unused */
  97. {0, 0, 0, 0, 0 }, /* 4 (AD[14]): Unused */
  98. {0, 0, 0, 0, 0 }, /* 5 (AD[15]): Unused */
  99. {0, IRQ6, IRQ6, 0, 0 }, /* 6 (AD[16]): slot 3 (mini) */
  100. {0, IRQ5, IRQ5, 0, 0 }, /* 7 (AD[17]): slot 2 (mini) */
  101. {0, IRQ4, IRQ4, IRQ4, IRQ4}, /* 8 (AD[18]): slot 0 (PCI) */
  102. {0, IRQ5, IRQ5, IRQ5, IRQ5}, /* 9 (AD[19]): slot 1 (PCI) */
  103. {0, 0, 0, 0, 0 }, /* 10 (AD[20]): Unused */
  104. {0, 0, 0, 0, 0 }, /* 11 (AD[21]): Unused */
  105. {0, 0, 0, 0, 0 }, /* 12 (AD[22]): Unused */
  106. {0, 0, 0, 0, 0 }, /* 13 (AD[23]): Unused */
  107. {0, 0, 0, 0, 0 }, /* 14 (AD[24]): Unused */
  108. {0, 0, 0, 0, 0 }, /* 15 (AD[25]): Unused */
  109. {0, 0, 0, 0, 0 }, /* 16 (AD[26]): Unused */
  110. {0, 0, 0, 0, 0 }, /* 17 (AD[27]): Unused */
  111. {0, 0, 0, 0, 0 }, /* 18 (AD[28]): Unused */
  112. {0, 0, 0, 0, 0 }, /* 19 (AD[29]): Unused */
  113. {0, 0, 0, 0, 0 }, /* 20 (AD[30]): Unused */
  114. {0, 0, 0, 0, 0 } /* 21 (AD[31]): Unused */
  115. };
  116. #else
  117. /* Unknown board -- don't assign any IRQs */
  118. static char irq_tab[][5] __initdata = {
  119. /* INTA INTB INTC INTD */
  120. {0, 0, 0, 0, 0 }, /* (AD[0]): Unused */
  121. {0, 0, 0, 0, 0 }, /* (AD[1]): Unused */
  122. {0, 0, 0, 0, 0 }, /* (AD[2]): Unused */
  123. {0, 0, 0, 0, 0 }, /* (AD[3]): Unused */
  124. {0, 0, 0, 0, 0 }, /* (AD[4]): Unused */
  125. {0, 0, 0, 0, 0 }, /* (AD[5]): Unused */
  126. {0, 0, 0, 0, 0 }, /* (AD[6]): Unused */
  127. {0, 0, 0, 0, 0 }, /* (AD[7]): Unused */
  128. {0, 0, 0, 0, 0 }, /* (AD[8]): Unused */
  129. {0, 0, 0, 0, 0 }, /* (AD[9]): Unused */
  130. {0, 0, 0, 0, 0 }, /* 0 (AD[10]): Unused */
  131. {0, 0, 0, 0, 0 }, /* 1 (AD[11]): Unused */
  132. {0, 0, 0, 0, 0 }, /* 2 (AD[12]): Unused */
  133. {0, 0, 0, 0, 0 }, /* 3 (AD[13]): Unused */
  134. {0, 0, 0, 0, 0 }, /* 4 (AD[14]): Unused */
  135. {0, 0, 0, 0, 0 }, /* 5 (AD[15]): Unused */
  136. {0, 0, 0, 0, 0 }, /* 6 (AD[16]): Unused */
  137. {0, 0, 0, 0, 0 }, /* 7 (AD[17]): Unused */
  138. {0, 0, 0, 0, 0 }, /* 8 (AD[18]): Unused */
  139. {0, 0, 0, 0, 0 }, /* 9 (AD[19]): Unused */
  140. {0, 0, 0, 0, 0 }, /* 10 (AD[20]): Unused */
  141. {0, 0, 0, 0, 0 }, /* 11 (AD[21]): Unused */
  142. {0, 0, 0, 0, 0 }, /* 12 (AD[22]): Unused */
  143. {0, 0, 0, 0, 0 }, /* 13 (AD[23]): Unused */
  144. {0, 0, 0, 0, 0 }, /* 14 (AD[24]): Unused */
  145. {0, 0, 0, 0, 0 }, /* 15 (AD[25]): Unused */
  146. {0, 0, 0, 0, 0 }, /* 16 (AD[26]): Unused */
  147. {0, 0, 0, 0, 0 }, /* 17 (AD[27]): Unused */
  148. {0, 0, 0, 0, 0 }, /* 18 (AD[28]): Unused */
  149. {0, 0, 0, 0, 0 }, /* 19 (AD[29]): Unused */
  150. {0, 0, 0, 0, 0 }, /* 20 (AD[30]): Unused */
  151. {0, 0, 0, 0, 0 } /* 21 (AD[31]): Unused */
  152. };
  153. #endif
  154. /*****************************************************************************
  155. *
  156. * FUNCTION: pcibios_plat_dev_init
  157. * _________________________________________________________________________
  158. *
  159. * DESCRIPTION: Perform platform specific device initialization at
  160. * pci_enable_device() time.
  161. * None are needed for the MSP7120 PCI Controller.
  162. *
  163. * INPUTS: dev - structure describing the PCI device
  164. *
  165. * OUTPUTS: none
  166. *
  167. * RETURNS: PCIBIOS_SUCCESSFUL
  168. *
  169. ****************************************************************************/
  170. int pcibios_plat_dev_init(struct pci_dev *dev)
  171. {
  172. return PCIBIOS_SUCCESSFUL;
  173. }
  174. /*****************************************************************************
  175. *
  176. * FUNCTION: pcibios_map_irq
  177. * _________________________________________________________________________
  178. *
  179. * DESCRIPTION: Perform board supplied PCI IRQ mapping routine.
  180. *
  181. * INPUTS: dev - unused
  182. * slot - PCI slot. Identified by which bit of the AD[] bus
  183. * drives the IDSEL line. AD[10] is 0, AD[31] is
  184. * slot 21.
  185. * pin - numbered using the scheme of the PCI_INTERRUPT_PIN
  186. * field of the config header.
  187. *
  188. * OUTPUTS: none
  189. *
  190. * RETURNS: IRQ number
  191. *
  192. ****************************************************************************/
  193. int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  194. {
  195. #if !defined(CONFIG_PMC_MSP7120_GW) && !defined(CONFIG_PMC_MSP7120_EVAL)
  196. printk(KERN_WARNING "PCI: unknown board, no PCI IRQs assigned.\n");
  197. #endif
  198. printk(KERN_WARNING "PCI: irq_tab returned %d for slot=%d pin=%d\n",
  199. irq_tab[slot][pin], slot, pin);
  200. return irq_tab[slot][pin];
  201. }
  202. #endif /* CONFIG_PCI */