vulcan-pci.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * arch/arch/mach-ixp4xx/vulcan-pci.c
  3. *
  4. * Vulcan board-level PCI initialization
  5. *
  6. * Copyright (C) 2010 Marc Zyngier <maz@misterjones.org>
  7. *
  8. * based on ixdp425-pci.c:
  9. * Copyright (C) 2002 Intel Corporation.
  10. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. *
  16. */
  17. #include <linux/pci.h>
  18. #include <linux/init.h>
  19. #include <linux/irq.h>
  20. #include <asm/mach/pci.h>
  21. #include <asm/mach-types.h>
  22. /* PCI controller GPIO to IRQ pin mappings */
  23. #define INTA 2
  24. #define INTB 3
  25. void __init vulcan_pci_preinit(void)
  26. {
  27. #ifndef CONFIG_IXP4XX_INDIRECT_PCI
  28. /*
  29. * Cardbus bridge wants way more than the SoC can actually offer,
  30. * and leaves the whole PCI bus in a mess. Artificially limit it
  31. * to 8MB per region. Of course indirect mode doesn't have this
  32. * limitation...
  33. */
  34. pci_cardbus_mem_size = SZ_8M;
  35. pr_info("Vulcan PCI: limiting CardBus memory size to %dMB\n",
  36. (int)(pci_cardbus_mem_size >> 20));
  37. #endif
  38. irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
  39. irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
  40. ixp4xx_pci_preinit();
  41. }
  42. static int __init vulcan_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  43. {
  44. if (slot == 1)
  45. return IXP4XX_GPIO_IRQ(INTA);
  46. if (slot == 2)
  47. return IXP4XX_GPIO_IRQ(INTB);
  48. return -1;
  49. }
  50. struct hw_pci vulcan_pci __initdata = {
  51. .nr_controllers = 1,
  52. .preinit = vulcan_pci_preinit,
  53. .swizzle = pci_std_swizzle,
  54. .setup = ixp4xx_setup,
  55. .scan = ixp4xx_scan_bus,
  56. .map_irq = vulcan_map_irq,
  57. };
  58. int __init vulcan_pci_init(void)
  59. {
  60. if (machine_is_arcom_vulcan())
  61. pci_common_init(&vulcan_pci);
  62. return 0;
  63. }
  64. subsys_initcall(vulcan_pci_init);