ops-titan.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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/config.h>
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/init.h>
  18. #include <linux/pci.h>
  19. #include <asm/io.h>
  20. #include <asm/titan.h>
  21. #include "pci-sh4.h"
  22. int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
  23. {
  24. int irq = -1;
  25. switch (slot) {
  26. case 0: irq = TITAN_IRQ_WAN; break; /* eth0 (WAN) */
  27. case 1: irq = TITAN_IRQ_LAN; break; /* eth1 (LAN) */
  28. case 2: irq = TITAN_IRQ_MPCIA; break; /* mPCI A */
  29. case 3: irq = TITAN_IRQ_MPCIB; break; /* mPCI B */
  30. case 4: irq = TITAN_IRQ_USB; break; /* USB */
  31. default:
  32. printk(KERN_INFO "PCI: Bad IRQ mapping "
  33. "request for slot %d\n", slot);
  34. return -1;
  35. }
  36. printk("PCI: Mapping TITAN IRQ for slot %d, pin %c to irq %d\n",
  37. slot, pin - 1 + 'A', irq);
  38. return irq;
  39. }
  40. static struct resource sh7751_io_resource = {
  41. .name = "SH7751_IO",
  42. .start = SH7751_PCI_IO_BASE,
  43. .end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
  44. .flags = IORESOURCE_IO
  45. };
  46. static struct resource sh7751_mem_resource = {
  47. .name = "SH7751_mem",
  48. .start = SH7751_PCI_MEMORY_BASE,
  49. .end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
  50. .flags = IORESOURCE_MEM
  51. };
  52. struct pci_channel board_pci_channels[] = {
  53. { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
  54. { NULL, NULL, NULL, 0, 0 },
  55. };
  56. EXPORT_SYMBOL(board_pci_channels);
  57. static struct sh4_pci_address_map sh7751_pci_map = {
  58. .window0 = {
  59. .base = SH7751_CS2_BASE_ADDR,
  60. .size = SH7751_MEM_REGION_SIZE*2, /* cs2 and cs3 */
  61. },
  62. .window1 = {
  63. .base = SH7751_CS2_BASE_ADDR,
  64. .size = SH7751_MEM_REGION_SIZE*2,
  65. },
  66. .flags = SH4_PCIC_NO_RESET,
  67. };
  68. int __init pcibios_init_platform(void)
  69. {
  70. return sh7751_pcic_init(&sh7751_pci_map);
  71. }