pal4_pci.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * PCI support for SBS Palomar IV
  3. *
  4. * Author: Dan Cox
  5. *
  6. * 2002 (c) MontaVista, Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/pci.h>
  14. #include <asm/byteorder.h>
  15. #include <asm/machdep.h>
  16. #include <asm/io.h>
  17. #include <asm/pci-bridge.h>
  18. #include <asm/uaccess.h>
  19. #include <syslib/cpc700.h>
  20. #include "pal4.h"
  21. /* not much to this.... */
  22. static inline int __init
  23. pal4_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
  24. {
  25. if (idsel == 9)
  26. return PAL4_ETH;
  27. else
  28. return PAL4_INTA + (idsel - 3);
  29. }
  30. void __init
  31. pal4_find_bridges(void)
  32. {
  33. struct pci_controller *hose;
  34. hose = pcibios_alloc_controller();
  35. if (!hose)
  36. return;
  37. hose->first_busno = 0;
  38. hose->last_busno = 0xff;
  39. hose->pci_mem_offset = 0;
  40. /* Could snatch these from the CPC700.... */
  41. pci_init_resource(&hose->io_resource,
  42. 0x0,
  43. 0x03ffffff,
  44. IORESOURCE_IO,
  45. "PCI host bridge");
  46. pci_init_resource(&hose->mem_resources[0],
  47. 0x90000000,
  48. 0x9fffffff,
  49. IORESOURCE_MEM,
  50. "PCI host bridge");
  51. hose->io_space.start = 0x00800000;
  52. hose->io_space.end = 0x03ffffff;
  53. hose->mem_space.start = 0x90000000;
  54. hose->mem_space.end = 0x9fffffff;
  55. hose->io_base_virt = (void *) 0xf8000000;
  56. setup_indirect_pci(hose, CPC700_PCI_CONFIG_ADDR,
  57. CPC700_PCI_CONFIG_DATA);
  58. hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
  59. ppc_md.pci_swizzle = common_swizzle;
  60. ppc_md.pci_map_irq = pal4_map_irq;
  61. }