Browse Source

Marvell/Armada70x0Db: Introduce board description library

This patch implements ArmadaBoarDescLib library for
Armada7040 Development Board and add to it ArmadaBoardDescSdMmcGet
function with description of connected Xenon host controllers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tomasz Michalec 5 years ago
parent
commit
857655264c

+ 3 - 0
Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc

@@ -54,6 +54,9 @@
 [Components.AARCH64]
   Silicon/Marvell/Armada7k8k/AcpiTables/Armada70x0Db.inf
 
+[LibraryClasses.common]
+  ArmadaBoardDescLib|Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf
+
 ################################################################################
 #
 # Pcd Section - list of all EDK II PCD Entries defined by this Platform

+ 60 - 0
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c

@@ -0,0 +1,60 @@
+/**
+*
+*  Copyright (C) 2018, Marvell International Ltd. and its affiliates.
+*
+*  This program and the accompanying materials are licensed and made available
+*  under the terms and conditions of the BSD License which accompanies this
+*  distribution. The full text of the license may be found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include <Uefi.h>
+
+#include <Library/ArmadaBoardDescLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+//
+// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib
+//
+STATIC
+MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = {
+  { /* eMMC 0xF06E0000 */
+    0,     /* SOC will be filled by MvBoardDescDxe */
+    0,     /* SdMmcDevCount will be filled by MvBoardDescDxe */
+    FALSE, /* Xenon1v8Enabled */
+    FALSE, /* Xenon8BitBusEnabled */
+    TRUE,  /* XenonSlowModeEnabled */
+    0x40,  /* XenonTuningStepDivisor */
+    EmbeddedSlot /* SlotType */
+  },
+  { /* SD/MMC 0xF2780000 */
+    0,     /* SOC will be filled by MvBoardDescDxe */
+    0,     /* SdMmcDevCount will be filled by MvBoardDescDxe */
+    FALSE, /* Xenon1v8Enabled */
+    FALSE, /* Xenon8BitBusEnabled */
+    FALSE, /* XenonSlowModeEnabled */
+    0x19,  /* XenonTuningStepDivisor */
+    EmbeddedSlot /* SlotType */
+  }
+};
+
+EFI_STATUS
+EFIAPI
+ArmadaBoardDescSdMmcGet (
+  OUT UINTN               *SdMmcDevCount,
+  OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
+  )
+{
+  *SdMmcDesc = mSdMmcDescTemplate;
+  *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate);
+
+  return EFI_SUCCESS;
+}

+ 34 - 0
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf

@@ -0,0 +1,34 @@
+## @file
+#
+#  Copyright (C) 2018, Marvell International Ltd. and its affiliates<BR>
+#
+#  This program and the accompanying materials are licensed and made available
+#  under the terms and conditions of the BSD License which accompanies this
+#  distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
+#  IMPLIED.
+#
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001A
+  BASE_NAME                      = Armada70x0DbBoardDescLib
+  FILE_GUID                      = 3164c8d9-19d4-4ad6-8196-cea094b1ddf1
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = ArmadaBoardDescLib
+
+[Sources]
+  Armada70x0DbBoardDescLib.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Marvell/Marvell.dec
+
+[LibraryClasses]
+  DebugLib
+  IoLib