wg302v2-pci.c 1.3 KB

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