Armada80x0DbBoardDescLib.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**
  2. *
  3. * Copyright (C) 2018, Marvell International Ltd. and its affiliates.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause-Patent
  6. *
  7. **/
  8. #include <Uefi.h>
  9. #include <Library/ArmadaBoardDescLib.h>
  10. #include <Library/BaseMemoryLib.h>
  11. #include <Library/DebugLib.h>
  12. #include <Library/IoLib.h>
  13. #include <Library/MemoryAllocationLib.h>
  14. #include <Library/MvGpioLib.h>
  15. #include <Library/UefiBootServicesTableLib.h>
  16. //
  17. // General purpose routine for per-board initalization
  18. //
  19. EFI_STATUS
  20. ArmadaBoardInit (
  21. VOID
  22. )
  23. {
  24. return EFI_SUCCESS;
  25. }
  26. //
  27. // GPIO Expanders
  28. //
  29. STATIC MV_GPIO_EXPANDER mGpioExpanders[] = {
  30. {
  31. PCA9555_ID,
  32. 0x21,
  33. 0x0,
  34. },
  35. {
  36. PCA9555_ID,
  37. 0x25,
  38. 0x0,
  39. },
  40. };
  41. EFI_STATUS
  42. EFIAPI
  43. ArmadaBoardGpioExpanderGet (
  44. IN OUT MV_GPIO_EXPANDER **GpioExpanders,
  45. IN OUT UINTN *GpioExpanderCount
  46. )
  47. {
  48. *GpioExpanderCount = ARRAY_SIZE (mGpioExpanders);
  49. *GpioExpanders = mGpioExpanders;
  50. return EFI_SUCCESS;
  51. }
  52. //
  53. // PCIE
  54. //
  55. STATIC
  56. MV_PCIE_CONTROLLER mPcieController[] = {
  57. { /* PCIE0 @0xF2600000 */
  58. .PcieDbiAddress = 0xF2600000,
  59. .ConfigSpaceAddress = 0xE0000000,
  60. .HaveResetGpio = FALSE,
  61. .PcieResetGpio = { 0 },
  62. .PcieBusMin = 0,
  63. .PcieBusMax = 0xFE,
  64. .PcieIoTranslation = 0xEFF00000,
  65. .PcieIoWinBase = 0x0,
  66. .PcieIoWinSize = 0x10000,
  67. .PcieMmio32Translation = 0,
  68. .PcieMmio32WinBase = 0xC0000000,
  69. .PcieMmio32WinSize = 0x20000000,
  70. .PcieMmio64Translation = 0,
  71. .PcieMmio64WinBase = 0x800000000,
  72. .PcieMmio64WinSize = 0x100000000,
  73. }
  74. };
  75. /**
  76. Return the number and description of PCIE controllers used on the platform.
  77. @param[in out] **PcieControllers Array containing PCIE controllers'
  78. description.
  79. @param[in out] *PcieControllerCount Amount of used PCIE controllers.
  80. @retval EFI_SUCCESS The data were obtained successfully.
  81. @retval other Return error status.
  82. **/
  83. EFI_STATUS
  84. EFIAPI
  85. ArmadaBoardPcieControllerGet (
  86. IN OUT MV_PCIE_CONTROLLER CONST **PcieControllers,
  87. IN OUT UINTN *PcieControllerCount
  88. )
  89. {
  90. *PcieControllers = mPcieController;
  91. *PcieControllerCount = ARRAY_SIZE (mPcieController);
  92. return EFI_SUCCESS;
  93. }
  94. //
  95. // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib
  96. //
  97. STATIC
  98. MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = {
  99. { /* eMMC 0xF06E0000 */
  100. 0, /* SOC will be filled by MvBoardDescDxe */
  101. 0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
  102. TRUE, /* Xenon1v8Enabled */
  103. TRUE, /* Xenon8BitBusEnabled */
  104. TRUE, /* XenonSlowModeEnabled */
  105. 0x40, /* XenonTuningStepDivisor */
  106. EmbeddedSlot /* SlotType */
  107. },
  108. { /* SD/MMC 0xF2780000 */
  109. 0, /* SOC will be filled by MvBoardDescDxe */
  110. 0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
  111. TRUE, /* Xenon1v8Enabled */
  112. FALSE, /* Xenon8BitBusEnabled */
  113. FALSE, /* XenonSlowModeEnabled */
  114. 0x19, /* XenonTuningStepDivisor */
  115. EmbeddedSlot /* SlotType */
  116. }
  117. };
  118. EFI_STATUS
  119. EFIAPI
  120. ArmadaBoardDescSdMmcGet (
  121. OUT UINTN *SdMmcDevCount,
  122. OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
  123. )
  124. {
  125. *SdMmcDesc = mSdMmcDescTemplate;
  126. *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate);
  127. return EFI_SUCCESS;
  128. }