From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by mx.groups.io with SMTP id smtpd.web10.2525.1570686153862309110 for ; Wed, 09 Oct 2019 22:42:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=YC46nxCc; spf=none, err=SPF record not found (domain: semihalf.com, ip: 209.85.167.65, mailfrom: mw@semihalf.com) Received: by mail-lf1-f65.google.com with SMTP id w67so3379578lff.4 for ; Wed, 09 Oct 2019 22:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vHEgfgD8kLJIdhD820BOWGB15lF2541QGg01srt2khw=; b=YC46nxCcxlyPq+pugvvNqqDcf+o+DHNy99onVrlqsYeNkd5BwcuprrRYEr5tK2TLy/ x/mmgrvxia1P1v/z/e4FaBbeLEknUnl6JAY17PAKEzMzZ/MkfVO9qU+cKLHI8FkJZDIF fK7lSTqMYi6Jvnq/nY8AASAIkLRBKwwhKnA9dCs0DuseYoGfNhWHqhaTgGwL7Qu1l5py YZOmg0RWn0c31QZKl31/lm/G+KgBU2ecO/Rrt3Xjy4hPsAmGNuA7uF7f/GEwBq3ehXBi hgIRV4naELCgiiHXDloGaHExwT0nD6gzlwXJanftupunReVR5F6zj8XFNZV85kTmAEdf IIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vHEgfgD8kLJIdhD820BOWGB15lF2541QGg01srt2khw=; b=rlZm/79Ci3jeRsbFhRzDDevDUwo3IwYiAftAaWn0rSwTKpPkxbvYEy8HUSAP4325aI /6oIQRnL9Vo7A5KP/UKUZUo6fyXx+Jgz808XN8Hd+uqdnuyYFOevTE6FSYgiPOlMNelv GTVfHSttplJuqNPF3QFf/iYwEtvw5IfGxJ17wwq04/g0UYJdac5zaZpMRverTYfJBPR2 +QubZaHK4UUqI6J3y+ZoGD+9SOQQxiMN6SEnd7WdGVR9KoF78VhQAfXbyohfVPhcB5T9 Zae+k4poe/gUg/Dn+SYuPS7Eux/3sZGmKzUhkH7D3lvU3V4gwZxNkY3z2L0OlzSP/9yi PlzQ== X-Gm-Message-State: APjAAAXCnCT4XDaxzGE09AH4PbrdlGskRiE7HKe7vYdcQITGro4w9w0M 4a+CLOBZ/PM3901GBTysiLcAQmBcA2ywoA== X-Google-Smtp-Source: APXvYqyv/IogFkp2DbGOK4Lq+foG11axxMmhvtzbtGswpWXUNcYotg4uulll+Gk+2sOovRx8v7vWgQ== X-Received: by 2002:ac2:4a75:: with SMTP id q21mr4549306lfp.94.1570686151593; Wed, 09 Oct 2019 22:42:31 -0700 (PDT) Return-Path: Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id p27sm1001481lfo.95.2019.10.09.22.42.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Oct 2019 22:42:30 -0700 (PDT) From: "Marcin Wojtas" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com Subject: [edk2-platforms: PATCH v3 3/9] Marvell/Cn9130Db: Introduce board support Date: Thu, 10 Oct 2019 07:42:13 +0200 Message-Id: <1570686139-25182-4-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1570686139-25182-1-git-send-email-mw@semihalf.com> References: <1570686139-25182-1-git-send-email-mw@semihalf.com> This patch introduces all necessary components required for building EDK2 firmware for CN9130-DB setup A. Because the board is modular and can be extended to support also CN9131 and CN9132 SoC variants, extract common part into .dsc.inc file, which will be included by them. In order to build this variant, '-D CN9130' flag should be added. Signed-off-by: Marcin Wojtas --- Platform/Marvell/Cn913xDb/Cn9130DbA.dsc.inc | 107 +++++++++++++++ Platform/Marvell/Cn913xDb/Cn913xDbA.dsc | 48 +++++++ Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.inf | 29 ++++ Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 37 +++++ Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h | 19 +++ Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c | 126 +++++++++++++++++ Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 144 ++++++++++++++++++++ Platform/Marvell/Cn913xDb/Cn913xDbA.fdf.inc | 18 +++ 8 files changed, 528 insertions(+) create mode 100644 Platform/Marvell/Cn913xDb/Cn9130DbA.dsc.inc create mode 100644 Platform/Marvell/Cn913xDb/Cn913xDbA.dsc create mode 100644 Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.inf create mode 100644 Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.inf create mode 100644 Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h create mode 100644 Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c create mode 100644 Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c create mode 100644 Platform/Marvell/Cn913xDb/Cn913xDbA.fdf.inc diff --git a/Platform/Marvell/Cn913xDb/Cn9130DbA.dsc.inc b/Platform/Marvell/Cn913xDb/Cn9130DbA.dsc.inc new file mode 100644 index 0000000..33fb7cc --- /dev/null +++ b/Platform/Marvell/Cn913xDb/Cn9130DbA.dsc.inc @@ -0,0 +1,107 @@ +## @file +# Component description file for the CN9130 Development Board (variant A) +# +# Copyright (c) 2019 Marvell International Ltd.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ +[PcdsFixedAtBuild.common] + # CP115 count + gMarvellTokenSpaceGuid.PcdMaxCpCount|1 + + # MPP + gMarvellTokenSpaceGuid.PcdMppChipCount|2 + + # APN807 MPP + gMarvellTokenSpaceGuid.PcdChip0MppReverseFlag|FALSE + gMarvellTokenSpaceGuid.PcdChip0MppBaseAddress|0xF06F4000 + gMarvellTokenSpaceGuid.PcdChip0MppPinCount|20 + gMarvellTokenSpaceGuid.PcdChip0MppSel0|{ 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 } + gMarvellTokenSpaceGuid.PcdChip0MppSel1|{ 0x1, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3 } + + # CP115 #0 MPP + gMarvellTokenSpaceGuid.PcdChip1MppReverseFlag|FALSE + gMarvellTokenSpaceGuid.PcdChip1MppBaseAddress|0xF2440000 + gMarvellTokenSpaceGuid.PcdChip1MppPinCount|64 + gMarvellTokenSpaceGuid.PcdChip1MppSel0|{ 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3 } + gMarvellTokenSpaceGuid.PcdChip1MppSel1|{ 0x3, 0x3, 0x0, 0x3, 0x3, 0x3, 0x3, 0x1, 0x1, 0x1 } + gMarvellTokenSpaceGuid.PcdChip1MppSel2|{ 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x9 } + gMarvellTokenSpaceGuid.PcdChip1MppSel3|{ 0x9, 0x3, 0x7, 0x6, 0x7, 0x2, 0x2, 0x2, 0x2, 0x1 } + gMarvellTokenSpaceGuid.PcdChip1MppSel4|{ 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 } + gMarvellTokenSpaceGuid.PcdChip1MppSel5|{ 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xE, 0xE, 0xE, 0xE } + gMarvellTokenSpaceGuid.PcdChip1MppSel6|{ 0xE, 0xE, 0xE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } + + # I2C + gMarvellTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x21 } + gMarvellTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0 } + gMarvellTokenSpaceGuid.PcdI2cControllersEnabled|{ 0x0, 0x1 } + gMarvellTokenSpaceGuid.PcdI2cClockFrequency|250000000 + gMarvellTokenSpaceGuid.PcdI2cBaudRate|100000 + + # SPI + gMarvellTokenSpaceGuid.PcdSpiRegBase|0xF2700680 + gMarvellTokenSpaceGuid.PcdSpiMaxFrequency|10000000 + gMarvellTokenSpaceGuid.PcdSpiClockFrequency|200000000 + + gMarvellTokenSpaceGuid.PcdSpiFlashMode|3 + gMarvellTokenSpaceGuid.PcdSpiFlashCs|0 + + # ComPhy + gMarvellTokenSpaceGuid.PcdComPhyDevices|{ 0x1 } + # ComPhy0 + # 0: PCIE0 5 Gbps + # 1: PCIE0 5 Gbps + # 2: PCIE0 5 Gbps + # 3: PCIE0 5 Gbps + # 4: SFI 10.31 Gbps + # 5: SATA1 5 Gbps + gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes|{ $(CP_PCIE0), $(CP_PCIE0), $(CP_PCIE0), $(CP_PCIE0), $(CP_SFI), $(CP_SATA1)} + gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds|{ $(CP_5G), $(CP_5G), $(CP_5G), $(CP_5G), $(CP_10_3125G), $(CP_5G) } + + # UtmiPhy + gMarvellTokenSpaceGuid.PcdUtmiControllersEnabled|{ 0x1, 0x1 } + gMarvellTokenSpaceGuid.PcdUtmiPortType|{ $(UTMI_USB_HOST0), $(UTMI_USB_HOST1) } + + # MDIO + gMarvellTokenSpaceGuid.PcdMdioControllersEnabled|{ 0x1, 0x0 } + + # PHY + gMarvellTokenSpaceGuid.PcdPhy2MdioController|{ 0x0, 0x0 } + gMarvellTokenSpaceGuid.PcdPhyDeviceIds|{ 0x0, 0x0 } + gMarvellTokenSpaceGuid.PcdPhySmiAddresses|{ 0x0, 0x1 } + gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg|FALSE + + # NET + gMarvellTokenSpaceGuid.PcdPp2GopIndexes|{ 0x0, 0x2, 0x3 } + gMarvellTokenSpaceGuid.PcdPp2InterfaceAlwaysUp|{ 0x0, 0x0, 0x0 } + gMarvellTokenSpaceGuid.PcdPp2InterfaceSpeed|{ $(PHY_SPEED_10000), $(PHY_SPEED_1000), $(PHY_SPEED_1000) } + gMarvellTokenSpaceGuid.PcdPp2PhyConnectionTypes|{ $(PHY_SFI), $(PHY_RGMII), $(PHY_RGMII) } + gMarvellTokenSpaceGuid.PcdPp2PhyIndexes|{ 0xFF, 0x0, 0x1 } + gMarvellTokenSpaceGuid.PcdPp2Port2Controller|{ 0x0, 0x0, 0x0 } + gMarvellTokenSpaceGuid.PcdPp2PortIds|{ 0x0, 0x1, 0x2 } + gMarvellTokenSpaceGuid.PcdPp2Controllers|{ 0x1 } + + # NonDiscoverableDevices + gMarvellTokenSpaceGuid.PcdPciEXhci|{ 0x1, 0x1 } + gMarvellTokenSpaceGuid.PcdPciEAhci|{ 0x1 } + gMarvellTokenSpaceGuid.PcdPciESdhci|{ 0x1, 0x1 } + + # PCIE + gArmTokenSpaceGuid.PcdPciIoTranslation|0xDFF00000 + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xD0000000 + + # RTC + gMarvellTokenSpaceGuid.PcdRtcBaseAddress|0xF2284000 + + # SoC Configuration Space + gMarvellTokenSpaceGuid.PcdConfigSpaceBaseAddress|0xD0000000 + + # Variable store + gMarvellTokenSpaceGuid.PcdSpiMemoryMapped|FALSE diff --git a/Platform/Marvell/Cn913xDb/Cn913xDbA.dsc b/Platform/Marvell/Cn913xDb/Cn913xDbA.dsc new file mode 100644 index 0000000..fc1190d --- /dev/null +++ b/Platform/Marvell/Cn913xDb/Cn913xDbA.dsc @@ -0,0 +1,48 @@ +## @file +# Component description file for the CN9130 Development Board (variant A) +# +# Copyright (c) 2019 Marvell International Ltd.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] +!if $(CN9130) + PLATFORM_NAME = Cn9130DbA +!endif + PLATFORM_GUID = 087305a1-8ddd-4027-89ca-68a3ef78fcc7 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x0001000B + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)-$(ARCH) + SUPPORTED_ARCHITECTURES = AARCH64|ARM + BUILD_TARGETS = DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER = DEFAULT + FLASH_DEFINITION = Silicon/Marvell/Armada7k8k/Armada7k8k.fdf + BOARD_DXE_FV_COMPONENTS = Platform/Marvell/Cn913xDb/Cn913xDbA.fdf.inc + + # + # Network definition + # + DEFINE NETWORK_IP6_ENABLE = FALSE + DEFINE NETWORK_TLS_ENABLE = FALSE + DEFINE NETWORK_HTTP_BOOT_ENABLE = FALSE + DEFINE NETWORK_ISCSI_ENABLE = FALSE + +!include Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +!include Platform/Marvell/Cn913xDb/Cn9130DbA.dsc.inc + +[Components.common] + Silicon/Marvell/OcteonTx/DeviceTree/T91/$(PLATFORM_NAME).inf + +[Components.AARCH64] + Silicon/Marvell/OcteonTx/AcpiTables/T91/$(PLATFORM_NAME).inf + +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.inf + NonDiscoverableInitLib|Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.inf diff --git a/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.inf b/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.inf new file mode 100644 index 0000000..dfbdc84 --- /dev/null +++ b/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.inf @@ -0,0 +1,29 @@ +## @file +# +# Copyright (C) 2019, Marvell International Ltd. and its affiliates
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = Cn9130DbABoardDescLib + FILE_GUID = d0f95cbe-c150-47e2-ab8c-b3a3807bcc4b + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Cn9130DbABoardDescLib.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.inf b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.inf new file mode 100644 index 0000000..f7cfb36 --- /dev/null +++ b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.inf @@ -0,0 +1,37 @@ +## @file +# +# Copyright (c) 2017, Linaro Ltd. All rights reserved.
+# Copyright (c) 2019, Marvell International Ltd. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = Cn9130DbANonDiscoverableInitLib + FILE_GUID = 93886b61-b4f5-4ff3-ba96-6f2f9e7661b9 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = NonDiscoverableInitLib + +[Sources] + NonDiscoverableInitLib.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib + MvGpioLib + +[Protocols] + gEmbeddedGpioProtocolGuid + +[Depex] + gMarvellPlatformInitCompleteProtocolGuid diff --git a/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h new file mode 100644 index 0000000..e1a5c34 --- /dev/null +++ b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h @@ -0,0 +1,19 @@ +/** +* +* Copyright (c) 2019, Marvell International Ltd. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ +#ifndef NON_DISCOVERABLE_INIT_LIB_H__ +#define NON_DISCOVERABLE_INIT_LIB_H__ + +#define CN9130_DB_IO_EXPANDER0 0 +#define CN9130_DB_VBUS0_PIN 0 +#define CN9130_DB_VBUS0_LIMIT_PIN 4 +#define CN9130_DB_VBUS1_PIN 1 +#define CN9130_DB_VBUS1_LIMIT_PIN 5 +#define CN9130_DB_SDMMC_VCC_PIN 14 +#define CN9130_DB_SDMMC_VCCQ_PIN 15 + +#endif diff --git a/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c b/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c new file mode 100644 index 0000000..2b46d14 --- /dev/null +++ b/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c @@ -0,0 +1,126 @@ +/** +* +* Copyright (C) 2019, Marvell International Ltd. and its affiliates. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +// +// GPIO Expander +// +STATIC MV_GPIO_EXPANDER mGpioExpander = { + PCA9555_ID, + 0x21, + 0x0, +}; + + +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ) +{ + *GpioExpanderCount = 1; + *GpioExpanders = &mGpioExpander; + + return EFI_SUCCESS; +} + +// +// PCIE +// +STATIC +MV_PCIE_CONTROLLER mPcieController[] = { + { /* PCIE0 @0xF2640000 */ + .PcieDbiAddress = 0xF2600000, + .ConfigSpaceAddress = 0xD0000000, + .HaveResetGpio = FALSE, + .PcieResetGpio = { 0 }, + .PcieBusMin = 0, + .PcieBusMax = 0xFE, + .PcieIoTranslation = 0xDFF00000, + .PcieIoWinBase = 0x0, + .PcieIoWinSize = 0x10000, + .PcieMmio32Translation = 0, + .PcieMmio32WinBase = 0xC0000000, + .PcieMmio32WinSize = 0x10000000, + .PcieMmio64Translation = 0, + .PcieMmio64WinBase = MAX_UINT64, + .PcieMmio64WinSize = 0, + } +}; + +/** + Return the number and description of PCIE controllers used on the platform. + + @param[in out] **PcieControllers Array containing PCIE controllers' + description. + @param[in out] *PcieControllerCount Amount of used PCIE controllers. + + @retval EFI_SUCCESS The data were obtained successfully. + @retval other Return error status. + +**/ +EFI_STATUS +EFIAPI +ArmadaBoardPcieControllerGet ( + IN OUT MV_PCIE_CONTROLLER CONST **PcieControllers, + IN OUT UINTN *PcieControllerCount + ) +{ + *PcieControllers = mPcieController; + *PcieControllerCount = ARRAY_SIZE (mPcieController); + + return EFI_SUCCESS; +} + +// +// 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 */ + TRUE, /* Xenon8BitBusEnabled */ + FALSE, /* 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; +} diff --git a/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c new file mode 100644 index 0000000..598c649 --- /dev/null +++ b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c @@ -0,0 +1,144 @@ +/** +* +* Copyright (c) 2017, Linaro Ltd. All rights reserved. +* Copyright (c) 2019, Marvell International Ltd. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "NonDiscoverableInitLib.h" + +STATIC +EFI_STATUS +EFIAPI +ConfigurePins ( + IN CONST MV_GPIO_PIN *VbusPin, + IN UINTN PinCount, + IN MV_GPIO_DRIVER_TYPE DriverType + ) +{ + EMBEDDED_GPIO_MODE Mode; + EMBEDDED_GPIO_PIN Gpio; + EMBEDDED_GPIO *GpioProtocol; + EFI_STATUS Status; + UINTN Index; + + Status = MvGpioGetProtocol (DriverType, &GpioProtocol); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Unable to find GPIO protocol\n", __FUNCTION__)); + return Status; + } + + for (Index = 0; Index < PinCount; Index++) { + Mode = VbusPin->ActiveHigh ? GPIO_MODE_OUTPUT_1 : GPIO_MODE_OUTPUT_0; + Gpio = GPIO (VbusPin->ControllerId, VbusPin->PinNumber); + GpioProtocol->Set (GpioProtocol, Gpio, Mode); + VbusPin++; + } + + return EFI_SUCCESS; +} + +STATIC CONST MV_GPIO_PIN mCp0XhciVbusPins[] = { + { + MV_GPIO_DRIVER_TYPE_PCA95XX, + CN9130_DB_IO_EXPANDER0, + CN9130_DB_VBUS0_PIN, + TRUE, + }, + { + MV_GPIO_DRIVER_TYPE_PCA95XX, + CN9130_DB_IO_EXPANDER0, + CN9130_DB_VBUS0_LIMIT_PIN, + TRUE, + }, + { + MV_GPIO_DRIVER_TYPE_PCA95XX, + CN9130_DB_IO_EXPANDER0, + CN9130_DB_VBUS1_PIN, + TRUE, + }, + { + MV_GPIO_DRIVER_TYPE_PCA95XX, + CN9130_DB_IO_EXPANDER0, + CN9130_DB_VBUS1_LIMIT_PIN, + TRUE, + }, +}; + +STATIC +EFI_STATUS +EFIAPI +Cp0XhciInit ( + IN NON_DISCOVERABLE_DEVICE *This + ) +{ + return ConfigurePins (mCp0XhciVbusPins, + ARRAY_SIZE (mCp0XhciVbusPins), + MV_GPIO_DRIVER_TYPE_PCA95XX); +} + +STATIC CONST MV_GPIO_PIN mCp0SdMmcPins[] = { + { + MV_GPIO_DRIVER_TYPE_PCA95XX, + CN9130_DB_IO_EXPANDER0, + CN9130_DB_SDMMC_VCC_PIN, + TRUE, + }, + { + MV_GPIO_DRIVER_TYPE_PCA95XX, + CN9130_DB_IO_EXPANDER0, + CN9130_DB_SDMMC_VCCQ_PIN, + FALSE, + }, +}; + +STATIC +EFI_STATUS +EFIAPI +Cp0SdMmcInit ( + IN NON_DISCOVERABLE_DEVICE *This + ) +{ + return ConfigurePins (mCp0SdMmcPins, + ARRAY_SIZE (mCp0SdMmcPins), + MV_GPIO_DRIVER_TYPE_PCA95XX); +} + +NON_DISCOVERABLE_DEVICE_INIT +EFIAPI +NonDiscoverableDeviceInitializerGet ( + IN NON_DISCOVERABLE_DEVICE_TYPE Type, + IN UINTN Index + ) +{ + if (Type == NonDiscoverableDeviceTypeXhci) { + switch (Index) { + case 0: + case 1: + return Cp0XhciInit; + } + } + + if (Type == NonDiscoverableDeviceTypeSdhci) { + switch (Index) { + case 1: + return Cp0SdMmcInit; + } + } + + return NULL; +} diff --git a/Platform/Marvell/Cn913xDb/Cn913xDbA.fdf.inc b/Platform/Marvell/Cn913xDb/Cn913xDbA.fdf.inc new file mode 100644 index 0000000..0c321d1 --- /dev/null +++ b/Platform/Marvell/Cn913xDb/Cn913xDbA.fdf.inc @@ -0,0 +1,18 @@ +# +# Copyright (C) 2019 Marvell International Ltd. and its affiliates +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +# Per-board additional content of the DXE phase firmware volume + + INF Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf + INF Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf + + # DTB + INF RuleOverride = DTB Silicon/Marvell/OcteonTx/DeviceTree/T91/$(PLATFORM_NAME).inf + +!if $(ARCH) == AARCH64 + # ACPI support + INF RuleOverride = ACPITABLE Silicon/Marvell/OcteonTx/AcpiTables/T91/$(PLATFORM_NAME).inf +!endif -- 2.7.4