Armada80x0DbBoardDescLib.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. // GPIO Expanders
  18. //
  19. STATIC MV_GPIO_EXPANDER mGpioExpanders[] = {
  20. {
  21. PCA9555_ID,
  22. 0x21,
  23. 0x0,
  24. },
  25. {
  26. PCA9555_ID,
  27. 0x25,
  28. 0x0,
  29. },
  30. };
  31. EFI_STATUS
  32. EFIAPI
  33. ArmadaBoardGpioExpanderGet (
  34. IN OUT MV_GPIO_EXPANDER **GpioExpanders,
  35. IN OUT UINTN *GpioExpanderCount
  36. )
  37. {
  38. *GpioExpanderCount = ARRAY_SIZE (mGpioExpanders);
  39. *GpioExpanders = mGpioExpanders;
  40. return EFI_SUCCESS;
  41. }
  42. //
  43. // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib
  44. //
  45. STATIC
  46. MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = {
  47. { /* eMMC 0xF06E0000 */
  48. 0, /* SOC will be filled by MvBoardDescDxe */
  49. 0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
  50. TRUE, /* Xenon1v8Enabled */
  51. TRUE, /* Xenon8BitBusEnabled */
  52. TRUE, /* XenonSlowModeEnabled */
  53. 0x40, /* XenonTuningStepDivisor */
  54. EmbeddedSlot /* SlotType */
  55. },
  56. { /* SD/MMC 0xF2780000 */
  57. 0, /* SOC will be filled by MvBoardDescDxe */
  58. 0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
  59. FALSE, /* Xenon1v8Enabled */
  60. FALSE, /* Xenon8BitBusEnabled */
  61. FALSE, /* XenonSlowModeEnabled */
  62. 0x19, /* XenonTuningStepDivisor */
  63. EmbeddedSlot /* SlotType */
  64. }
  65. };
  66. EFI_STATUS
  67. EFIAPI
  68. ArmadaBoardDescSdMmcGet (
  69. OUT UINTN *SdMmcDevCount,
  70. OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
  71. )
  72. {
  73. *SdMmcDesc = mSdMmcDescTemplate;
  74. *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate);
  75. return EFI_SUCCESS;
  76. }