pci.c 1020 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Atheros AR71XX/AR724X specific PCI setup code
  3. *
  4. * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation.
  9. */
  10. #include <linux/pci.h>
  11. #include <asm/mach-ath79/pci-ath724x.h>
  12. static struct ath724x_pci_data *pci_data;
  13. static int pci_data_size;
  14. void ath724x_pci_add_data(struct ath724x_pci_data *data, int size)
  15. {
  16. pci_data = data;
  17. pci_data_size = size;
  18. }
  19. int __init pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin)
  20. {
  21. unsigned int devfn = dev->devfn;
  22. int irq = -1;
  23. if (devfn > pci_data_size - 1)
  24. return irq;
  25. irq = pci_data[devfn].irq;
  26. return irq;
  27. }
  28. int pcibios_plat_dev_init(struct pci_dev *dev)
  29. {
  30. unsigned int devfn = dev->devfn;
  31. if (devfn > pci_data_size - 1)
  32. return PCIBIOS_DEVICE_NOT_FOUND;
  33. dev->dev.platform_data = pci_data[devfn].pdata;
  34. return PCIBIOS_SUCCESSFUL;
  35. }