dsmg600-pci.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * DSM-G600 board-level PCI initialization
  3. *
  4. * Copyright (C) 2006 Tower Technologies
  5. * Author: Alessandro Zummo <a.zummo@towertech.it>
  6. *
  7. * based on ixdp425-pci.c:
  8. * Copyright (C) 2002 Intel Corporation.
  9. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  10. *
  11. * Maintainer: http://www.nslu2-linux.org/
  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 dsmg600_pci_preinit(void)
  24. {
  25. set_irq_type(IRQ_DSMG600_PCI_INTA, IRQ_TYPE_LEVEL_LOW);
  26. set_irq_type(IRQ_DSMG600_PCI_INTB, IRQ_TYPE_LEVEL_LOW);
  27. set_irq_type(IRQ_DSMG600_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
  28. set_irq_type(IRQ_DSMG600_PCI_INTD, IRQ_TYPE_LEVEL_LOW);
  29. set_irq_type(IRQ_DSMG600_PCI_INTE, IRQ_TYPE_LEVEL_LOW);
  30. set_irq_type(IRQ_DSMG600_PCI_INTF, IRQ_TYPE_LEVEL_LOW);
  31. ixp4xx_pci_preinit();
  32. }
  33. static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  34. {
  35. static int pci_irq_table[DSMG600_PCI_MAX_DEV][DSMG600_PCI_IRQ_LINES] =
  36. {
  37. { IRQ_DSMG600_PCI_INTE, -1, -1 },
  38. { IRQ_DSMG600_PCI_INTA, -1, -1 },
  39. { IRQ_DSMG600_PCI_INTB, IRQ_DSMG600_PCI_INTC, IRQ_DSMG600_PCI_INTD },
  40. { IRQ_DSMG600_PCI_INTF, -1, -1 },
  41. };
  42. int irq = -1;
  43. if (slot >= 1 && slot <= DSMG600_PCI_MAX_DEV &&
  44. pin >= 1 && pin <= DSMG600_PCI_IRQ_LINES)
  45. irq = pci_irq_table[slot-1][pin-1];
  46. return irq;
  47. }
  48. struct hw_pci __initdata dsmg600_pci = {
  49. .nr_controllers = 1,
  50. .preinit = dsmg600_pci_preinit,
  51. .swizzle = pci_std_swizzle,
  52. .setup = ixp4xx_setup,
  53. .scan = ixp4xx_scan_bus,
  54. .map_irq = dsmg600_map_irq,
  55. };
  56. int __init dsmg600_pci_init(void)
  57. {
  58. if (machine_is_dsmg600())
  59. pci_common_init(&dsmg600_pci);
  60. return 0;
  61. }
  62. subsys_initcall(dsmg600_pci_init);