pci-lasat.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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/init.h>
  9. #include <linux/kernel.h>
  10. #include <linux/pci.h>
  11. #include <linux/types.h>
  12. #include <asm/lasat/lasat.h>
  13. #include <irq.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. if (IS_LASAT_200())
  36. lasat_pci_controller.pci_ops = &nile4_pci_ops;
  37. else
  38. lasat_pci_controller.pci_ops = &gt64xxx_pci0_ops;
  39. register_pci_controller(&lasat_pci_controller);
  40. return 0;
  41. }
  42. arch_initcall(lasat_pci_setup);
  43. #define LASAT_IRQ_ETH1 (LASAT_IRQ_BASE + 0)
  44. #define LASAT_IRQ_ETH0 (LASAT_IRQ_BASE + 1)
  45. #define LASAT_IRQ_HDC (LASAT_IRQ_BASE + 2)
  46. #define LASAT_IRQ_COMP (LASAT_IRQ_BASE + 3)
  47. #define LASAT_IRQ_HDLC (LASAT_IRQ_BASE + 4)
  48. #define LASAT_IRQ_PCIA (LASAT_IRQ_BASE + 5)
  49. #define LASAT_IRQ_PCIB (LASAT_IRQ_BASE + 6)
  50. #define LASAT_IRQ_PCIC (LASAT_IRQ_BASE + 7)
  51. #define LASAT_IRQ_PCID (LASAT_IRQ_BASE + 8)
  52. int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  53. {
  54. switch (slot) {
  55. case 1:
  56. case 2:
  57. case 3:
  58. return LASAT_IRQ_PCIA + (((slot-1) + (pin-1)) % 4);
  59. case 4:
  60. return LASAT_IRQ_ETH1; /* Ethernet 1 (LAN 2) */
  61. case 5:
  62. return LASAT_IRQ_ETH0; /* Ethernet 0 (LAN 1) */
  63. case 6:
  64. return LASAT_IRQ_HDC; /* IDE controller */
  65. default:
  66. return 0xff; /* Illegal */
  67. }
  68. return -1;
  69. }
  70. /* Do platform specific device initialization at pci_enable_device() time */
  71. int pcibios_plat_dev_init(struct pci_dev *dev)
  72. {
  73. return 0;
  74. }