ops-titan.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * arch/sh/drivers/pci/ops-titan.c
  3. *
  4. * Ported to new API by Paul Mundt <lethal@linux-sh.org>
  5. *
  6. * Modified from ops-snapgear.c written by David McCullough
  7. * Highly leveraged from pci-bigsur.c, written by Dustin McIntire.
  8. *
  9. * May be copied or modified under the terms of the GNU General Public
  10. * License. See linux/COPYING for more information.
  11. *
  12. * PCI initialization for the Titan boards
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/types.h>
  16. #include <linux/init.h>
  17. #include <linux/pci.h>
  18. #include <asm/io.h>
  19. #include <asm/titan.h>
  20. #include "pci-sh4.h"
  21. int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
  22. {
  23. int irq = -1;
  24. switch (slot) {
  25. case 0: irq = TITAN_IRQ_WAN; break; /* eth0 (WAN) */
  26. case 1: irq = TITAN_IRQ_LAN; break; /* eth1 (LAN) */
  27. case 2: irq = TITAN_IRQ_MPCIA; break; /* mPCI A */
  28. case 3: irq = TITAN_IRQ_MPCIB; break; /* mPCI B */
  29. case 4: irq = TITAN_IRQ_USB; break; /* USB */
  30. default:
  31. printk(KERN_INFO "PCI: Bad IRQ mapping "
  32. "request for slot %d\n", slot);
  33. return -1;
  34. }
  35. printk("PCI: Mapping TITAN IRQ for slot %d, pin %c to irq %d\n",
  36. slot, pin - 1 + 'A', irq);
  37. return irq;
  38. }
  39. static struct resource sh7751_io_resource = {
  40. .name = "SH7751_IO",
  41. .start = SH7751_PCI_IO_BASE,
  42. .end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
  43. .flags = IORESOURCE_IO
  44. };
  45. static struct resource sh7751_mem_resource = {
  46. .name = "SH7751_mem",
  47. .start = SH7751_PCI_MEMORY_BASE,
  48. .end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
  49. .flags = IORESOURCE_MEM
  50. };
  51. struct pci_channel board_pci_channels[] = {
  52. { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
  53. { NULL, NULL, NULL, 0, 0 },
  54. };
  55. EXPORT_SYMBOL(board_pci_channels);
  56. static struct sh4_pci_address_map sh7751_pci_map = {
  57. .window0 = {
  58. .base = SH7751_CS2_BASE_ADDR,
  59. .size = SH7751_MEM_REGION_SIZE*2, /* cs2 and cs3 */
  60. },
  61. .window1 = {
  62. .base = SH7751_CS2_BASE_ADDR,
  63. .size = SH7751_MEM_REGION_SIZE*2,
  64. },
  65. .flags = SH4_PCIC_NO_RESET,
  66. };
  67. int __init pcibios_init_platform(void)
  68. {
  69. return sh7751_pcic_init(&sh7751_pci_map);
  70. }