pci-lasat.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. extern struct pci_ops nile4_pci_ops;
  14. extern struct pci_ops gt64120_pci_ops;
  15. static struct resource lasat_pci_mem_resource = {
  16. .name = "LASAT PCI MEM",
  17. .start = 0x18000000,
  18. .end = 0x19ffffff,
  19. .flags = IORESOURCE_MEM,
  20. };
  21. static struct resource lasat_pci_io_resource = {
  22. .name = "LASAT PCI IO",
  23. .start = 0x1a000000,
  24. .end = 0x1bffffff,
  25. .flags = IORESOURCE_IO,
  26. };
  27. static struct pci_controller lasat_pci_controller = {
  28. .mem_resource = &lasat_pci_mem_resource,
  29. .io_resource = &lasat_pci_io_resource,
  30. };
  31. static int __init lasat_pci_setup(void)
  32. {
  33. printk("PCI: starting\n");
  34. switch (mips_machtype) {
  35. case MACH_LASAT_100:
  36. lasat_pci_controller.pci_ops = &gt64120_pci_ops;
  37. break;
  38. case MACH_LASAT_200:
  39. lasat_pci_controller.pci_ops = &nile4_pci_ops;
  40. break;
  41. default:
  42. panic("pcibios_init: mips_machtype incorrect");
  43. }
  44. register_pci_controller(&lasat_pci_controller);
  45. return 0;
  46. }
  47. arch_initcall(lasat_pci_setup);
  48. #define LASATINT_ETH1 0
  49. #define LASATINT_ETH0 1
  50. #define LASATINT_HDC 2
  51. #define LASATINT_COMP 3
  52. #define LASATINT_HDLC 4
  53. #define LASATINT_PCIA 5
  54. #define LASATINT_PCIB 6
  55. #define LASATINT_PCIC 7
  56. #define LASATINT_PCID 8
  57. int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  58. {
  59. switch (slot) {
  60. case 1:
  61. case 2:
  62. case 3:
  63. return LASATINT_PCIA + (((slot-1) + (pin-1)) % 4);
  64. case 4:
  65. return LASATINT_ETH1; /* Ethernet 1 (LAN 2) */
  66. case 5:
  67. return LASATINT_ETH0; /* Ethernet 0 (LAN 1) */
  68. case 6:
  69. return LASATINT_HDC; /* IDE controller */
  70. default:
  71. return 0xff; /* Illegal */
  72. }
  73. return -1;
  74. }
  75. /* Do platform specific device initialization at pci_enable_device() time */
  76. int pcibios_plat_dev_init(struct pci_dev *dev)
  77. {
  78. return 0;
  79. }