wg302v2-pci.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * arch/arch/mach-ixp4xx/wg302v2-pci.c
  3. *
  4. * PCI setup routines for the Netgear WG302 v2 and WAG302 v2
  5. *
  6. * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
  7. *
  8. * based on coyote-pci.c:
  9. * Copyright (C) 2002 Jungo Software Technologies.
  10. * Copyright (C) 2003 MontaVista Software, Inc.
  11. *
  12. * Maintainer: Imre Kaloz <kaloz@openwrt.org>
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. *
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/pci.h>
  21. #include <linux/init.h>
  22. #include <linux/irq.h>
  23. #include <asm/mach-types.h>
  24. #include <mach/hardware.h>
  25. #include <asm/mach/pci.h>
  26. void __init wg302v2_pci_preinit(void)
  27. {
  28. irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
  29. irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
  30. ixp4xx_pci_preinit();
  31. }
  32. static int __init wg302v2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  33. {
  34. if (slot == 1)
  35. return IRQ_IXP4XX_GPIO8;
  36. else if (slot == 2)
  37. return IRQ_IXP4XX_GPIO9;
  38. else return -1;
  39. }
  40. struct hw_pci wg302v2_pci __initdata = {
  41. .nr_controllers = 1,
  42. .ops = &ixp4xx_ops,
  43. .preinit = wg302v2_pci_preinit,
  44. .setup = ixp4xx_setup,
  45. .map_irq = wg302v2_map_irq,
  46. };
  47. int __init wg302v2_pci_init(void)
  48. {
  49. if (machine_is_wg302v2())
  50. pci_common_init(&wg302v2_pci);
  51. return 0;
  52. }
  53. subsys_initcall(wg302v2_pci_init);