pci_sh4.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 <linux/delay.h>
  12. #include <asm/processor.h>
  13. #include <asm/io.h>
  14. #include <asm/pci.h>
  15. #include <pci.h>
  16. int pci_sh4_init(struct pci_controller *hose)
  17. {
  18. hose->first_busno = 0;
  19. hose->region_count = 0;
  20. hose->last_busno = 0xff;
  21. /* PCI memory space */
  22. pci_set_region(hose->regions + 0,
  23. CONFIG_PCI_MEM_BUS,
  24. CONFIG_PCI_MEM_PHYS,
  25. CONFIG_PCI_MEM_SIZE,
  26. PCI_REGION_MEM);
  27. hose->region_count++;
  28. /* PCI IO space */
  29. pci_set_region(hose->regions + 1,
  30. CONFIG_PCI_IO_BUS,
  31. CONFIG_PCI_IO_PHYS,
  32. CONFIG_PCI_IO_SIZE,
  33. PCI_REGION_IO);
  34. hose->region_count++;
  35. #if defined(CONFIG_PCI_SYS_BUS)
  36. /* PCI System Memory space */
  37. pci_set_region(hose->regions + 2,
  38. CONFIG_PCI_SYS_BUS,
  39. CONFIG_PCI_SYS_PHYS,
  40. CONFIG_PCI_SYS_SIZE,
  41. PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
  42. hose->region_count++;
  43. #endif
  44. udelay(1000);
  45. pci_set_ops(hose,
  46. pci_hose_read_config_byte_via_dword,
  47. pci_hose_read_config_word_via_dword,
  48. pci_sh4_read_config_dword,
  49. pci_hose_write_config_byte_via_dword,
  50. pci_hose_write_config_word_via_dword,
  51. pci_sh4_write_config_dword);
  52. pci_register_hose(hose);
  53. udelay(1000);
  54. #ifdef CONFIG_PCI_SCAN_SHOW
  55. printf("PCI: Bus Dev VenId DevId Class Int\n");
  56. #endif
  57. hose->last_busno = pci_hose_scan(hose);
  58. return 0;
  59. }
  60. int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
  61. {
  62. return 0;
  63. }
  64. #ifdef CONFIG_PCI_SCAN_SHOW
  65. int pci_print_dev(struct pci_controller *hose, pci_dev_t dev)
  66. {
  67. return 1;
  68. }
  69. #endif /* CONFIG_PCI_SCAN_SHOW */