fsg-pci.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * arch/arch/mach-ixp4xx/fsg-pci.c
  3. *
  4. * FSG board-level PCI initialization
  5. *
  6. * Author: Rod Whitby <rod@whitby.id.au>
  7. * Maintainer: http://www.nslu2-linux.org/
  8. *
  9. * based on ixdp425-pci.c:
  10. * Copyright (C) 2002 Intel Corporation.
  11. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. *
  17. */
  18. #include <linux/pci.h>
  19. #include <linux/init.h>
  20. #include <linux/irq.h>
  21. #include <asm/mach/pci.h>
  22. #include <asm/mach-types.h>
  23. void __init fsg_pci_preinit(void)
  24. {
  25. set_irq_type(IRQ_FSG_PCI_INTA, IRQ_TYPE_LEVEL_LOW);
  26. set_irq_type(IRQ_FSG_PCI_INTB, IRQ_TYPE_LEVEL_LOW);
  27. set_irq_type(IRQ_FSG_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
  28. ixp4xx_pci_preinit();
  29. }
  30. static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  31. {
  32. static int pci_irq_table[FSG_PCI_IRQ_LINES] = {
  33. IRQ_FSG_PCI_INTC,
  34. IRQ_FSG_PCI_INTB,
  35. IRQ_FSG_PCI_INTA,
  36. };
  37. int irq = -1;
  38. slot = slot - 11;
  39. if (slot >= 1 && slot <= FSG_PCI_MAX_DEV &&
  40. pin >= 1 && pin <= FSG_PCI_IRQ_LINES)
  41. irq = pci_irq_table[(slot - 1)];
  42. printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
  43. __func__, slot, pin, irq);
  44. return irq;
  45. }
  46. struct hw_pci fsg_pci __initdata = {
  47. .nr_controllers = 1,
  48. .preinit = fsg_pci_preinit,
  49. .swizzle = pci_std_swizzle,
  50. .setup = ixp4xx_setup,
  51. .scan = ixp4xx_scan_bus,
  52. .map_irq = fsg_map_irq,
  53. };
  54. int __init fsg_pci_init(void)
  55. {
  56. if (machine_is_fsg())
  57. pci_common_init(&fsg_pci);
  58. return 0;
  59. }
  60. subsys_initcall(fsg_pci_init);