pci-lasat.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2000, 2001, 04 Keith M Wesolowski
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/pci.h>
  11. #include <linux/types.h>
  12. #include <asm/bootinfo.h>
  13. #include <asm/lasat/lasatint.h>
  14. extern struct pci_ops nile4_pci_ops;
  15. extern struct pci_ops gt64xxx_pci0_ops;
  16. static struct resource lasat_pci_mem_resource = {
  17. .name = "LASAT PCI MEM",
  18. .start = 0x18000000,
  19. .end = 0x19ffffff,
  20. .flags = IORESOURCE_MEM,
  21. };
  22. static struct resource lasat_pci_io_resource = {
  23. .name = "LASAT PCI IO",
  24. .start = 0x1a000000,
  25. .end = 0x1bffffff,
  26. .flags = IORESOURCE_IO,
  27. };
  28. static struct pci_controller lasat_pci_controller = {
  29. .mem_resource = &lasat_pci_mem_resource,
  30. .io_resource = &lasat_pci_io_resource,
  31. };
  32. static int __init lasat_pci_setup(void)
  33. {
  34. printk(KERN_DEBUG "PCI: starting\n");
  35. switch (mips_machtype) {
  36. case MACH_LASAT_100:
  37. lasat_pci_controller.pci_ops = &gt64xxx_pci0_ops;
  38. break;
  39. case MACH_LASAT_200:
  40. lasat_pci_controller.pci_ops = &nile4_pci_ops;
  41. break;
  42. default:
  43. panic("pcibios_init: mips_machtype incorrect");
  44. }
  45. register_pci_controller(&lasat_pci_controller);
  46. return 0;
  47. }
  48. arch_initcall(lasat_pci_setup);
  49. #define LASATINT_ETH1 (LASATINT_BASE + 0)
  50. #define LASATINT_ETH0 (LASATINT_BASE + 1)
  51. #define LASATINT_HDC (LASATINT_BASE + 2)
  52. #define LASATINT_COMP (LASATINT_BASE + 3)
  53. #define LASATINT_HDLC (LASATINT_BASE + 4)
  54. #define LASATINT_PCIA (LASATINT_BASE + 5)
  55. #define LASATINT_PCIB (LASATINT_BASE + 6)
  56. #define LASATINT_PCIC (LASATINT_BASE + 7)
  57. #define LASATINT_PCID (LASATINT_BASE + 8)
  58. int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  59. {
  60. switch (slot) {
  61. case 1:
  62. case 2:
  63. case 3:
  64. return LASATINT_PCIA + (((slot-1) + (pin-1)) % 4);
  65. case 4:
  66. return LASATINT_ETH1; /* Ethernet 1 (LAN 2) */
  67. case 5:
  68. return LASATINT_ETH0; /* Ethernet 0 (LAN 1) */
  69. case 6:
  70. return LASATINT_HDC; /* IDE controller */
  71. default:
  72. return 0xff; /* Illegal */
  73. }
  74. return -1;
  75. }
  76. /* Do platform specific device initialization at pci_enable_device() time */
  77. int pcibios_plat_dev_init(struct pci_dev *dev)
  78. {
  79. return 0;
  80. }