pci_sh4.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * SH4 PCI Controller (PCIC) for U-Boot.
  4. * (C) Dustin McIntire (dustin@sensoria.com)
  5. * (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  6. * (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
  7. *
  8. * u-boot/arch/sh/cpu/sh4/pci-sh4.c
  9. */
  10. #include <common.h>
  11. #include <asm/processor.h>
  12. #include <asm/io.h>
  13. #include <asm/pci.h>
  14. #include <pci.h>
  15. int pci_sh4_init(struct pci_controller *hose)
  16. {
  17. hose->first_busno = 0;
  18. hose->region_count = 0;
  19. hose->last_busno = 0xff;
  20. /* PCI memory space */
  21. pci_set_region(hose->regions + 0,
  22. CONFIG_PCI_MEM_BUS,
  23. CONFIG_PCI_MEM_PHYS,
  24. CONFIG_PCI_MEM_SIZE,
  25. PCI_REGION_MEM);
  26. hose->region_count++;
  27. /* PCI IO space */
  28. pci_set_region(hose->regions + 1,
  29. CONFIG_PCI_IO_BUS,
  30. CONFIG_PCI_IO_PHYS,
  31. CONFIG_PCI_IO_SIZE,
  32. PCI_REGION_IO);
  33. hose->region_count++;
  34. #if defined(CONFIG_PCI_SYS_BUS)
  35. /* PCI System Memory space */
  36. pci_set_region(hose->regions + 2,
  37. CONFIG_PCI_SYS_BUS,
  38. CONFIG_PCI_SYS_PHYS,
  39. CONFIG_PCI_SYS_SIZE,
  40. PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
  41. hose->region_count++;
  42. #endif
  43. udelay(1000);
  44. pci_set_ops(hose,
  45. pci_hose_read_config_byte_via_dword,
  46. pci_hose_read_config_word_via_dword,
  47. pci_sh4_read_config_dword,
  48. pci_hose_write_config_byte_via_dword,
  49. pci_hose_write_config_word_via_dword,
  50. pci_sh4_write_config_dword);
  51. pci_register_hose(hose);
  52. udelay(1000);
  53. #ifdef CONFIG_PCI_SCAN_SHOW
  54. printf("PCI: Bus Dev VenId DevId Class Int\n");
  55. #endif
  56. hose->last_busno = pci_hose_scan(hose);
  57. return 0;
  58. }
  59. int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
  60. {
  61. return 0;
  62. }
  63. #ifdef CONFIG_PCI_SCAN_SHOW
  64. int pci_print_dev(struct pci_controller *hose, pci_dev_t dev)
  65. {
  66. return 1;
  67. }
  68. #endif /* CONFIG_PCI_SCAN_SHOW */