ixdp425-pci.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * arch/arm/mach-ixp4xx/ixdp425-pci.c
  4. *
  5. * IXDP425 board-level PCI initialization
  6. *
  7. * Copyright (C) 2002 Intel Corporation.
  8. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  9. *
  10. * Maintainer: Deepak Saxena <dsaxena@plexity.net>
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/pci.h>
  14. #include <linux/init.h>
  15. #include <linux/irq.h>
  16. #include <linux/delay.h>
  17. #include <asm/mach/pci.h>
  18. #include <asm/irq.h>
  19. #include <mach/hardware.h>
  20. #include <asm/mach-types.h>
  21. #include "irqs.h"
  22. #define MAX_DEV 4
  23. #define IRQ_LINES 4
  24. /* PCI controller GPIO to IRQ pin mappings */
  25. #define INTA 11
  26. #define INTB 10
  27. #define INTC 9
  28. #define INTD 8
  29. void __init ixdp425_pci_preinit(void)
  30. {
  31. irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
  32. irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
  33. irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
  34. irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);
  35. ixp4xx_pci_preinit();
  36. }
  37. static int __init ixdp425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  38. {
  39. static int pci_irq_table[IRQ_LINES] = {
  40. IXP4XX_GPIO_IRQ(INTA),
  41. IXP4XX_GPIO_IRQ(INTB),
  42. IXP4XX_GPIO_IRQ(INTC),
  43. IXP4XX_GPIO_IRQ(INTD)
  44. };
  45. if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
  46. return pci_irq_table[(slot + pin - 2) % 4];
  47. return -1;
  48. }
  49. struct hw_pci ixdp425_pci __initdata = {
  50. .nr_controllers = 1,
  51. .ops = &ixp4xx_ops,
  52. .preinit = ixdp425_pci_preinit,
  53. .setup = ixp4xx_setup,
  54. .map_irq = ixdp425_map_irq,
  55. };
  56. int __init ixdp425_pci_init(void)
  57. {
  58. if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
  59. machine_is_ixdp465() || machine_is_kixrp435())
  60. pci_common_init(&ixdp425_pci);
  61. return 0;
  62. }
  63. subsys_initcall(ixdp425_pci_init);