fixup-lantiq.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License version 2 as published
  4. * by the Free Software Foundation.
  5. *
  6. * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
  7. */
  8. #include <linux/of_irq.h>
  9. #include <linux/of_pci.h>
  10. int (*ltq_pci_plat_arch_init)(struct pci_dev *dev) = NULL;
  11. int (*ltq_pci_plat_dev_init)(struct pci_dev *dev) = NULL;
  12. int pcibios_plat_dev_init(struct pci_dev *dev)
  13. {
  14. if (ltq_pci_plat_arch_init)
  15. return ltq_pci_plat_arch_init(dev);
  16. if (ltq_pci_plat_dev_init)
  17. return ltq_pci_plat_dev_init(dev);
  18. return 0;
  19. }
  20. int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  21. {
  22. struct of_irq dev_irq;
  23. int irq;
  24. if (of_irq_map_pci(dev, &dev_irq)) {
  25. dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n",
  26. slot, pin);
  27. return 0;
  28. }
  29. irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier,
  30. dev_irq.size);
  31. dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq);
  32. return irq;
  33. }