pci.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <pci.h>
  8. #include <asm/pci.h>
  9. #include <asm/arch/device.h>
  10. DECLARE_GLOBAL_DATA_PTR;
  11. void board_pci_setup_hose(struct pci_controller *hose)
  12. {
  13. hose->first_busno = 0;
  14. hose->last_busno = 0;
  15. /* PCI memory space */
  16. pci_set_region(hose->regions + 0,
  17. CONFIG_PCI_MEM_BUS,
  18. CONFIG_PCI_MEM_PHYS,
  19. CONFIG_PCI_MEM_SIZE,
  20. PCI_REGION_MEM);
  21. /* PCI IO space */
  22. pci_set_region(hose->regions + 1,
  23. CONFIG_PCI_IO_BUS,
  24. CONFIG_PCI_IO_PHYS,
  25. CONFIG_PCI_IO_SIZE,
  26. PCI_REGION_IO);
  27. pci_set_region(hose->regions + 2,
  28. CONFIG_PCI_PREF_BUS,
  29. CONFIG_PCI_PREF_PHYS,
  30. CONFIG_PCI_PREF_SIZE,
  31. PCI_REGION_PREFETCH);
  32. pci_set_region(hose->regions + 3,
  33. 0,
  34. 0,
  35. gd->ram_size,
  36. PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
  37. hose->region_count = 4;
  38. }
  39. int board_pci_post_scan(struct pci_controller *hose)
  40. {
  41. return 0;
  42. }
  43. int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
  44. {
  45. /*
  46. * TODO:
  47. *
  48. * For some unknown reason, the PCI enumeration process hangs
  49. * when it scans to the PCIe root port 0 (D23:F0) & 1 (D23:F1).
  50. *
  51. * For now we just skip these two devices, and this needs to
  52. * be revisited later.
  53. */
  54. if (dev == QUARK_HOST_BRIDGE ||
  55. dev == QUARK_PCIE0 || dev == QUARK_PCIE1) {
  56. return 1;
  57. }
  58. return 0;
  59. }