From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4864:20::242; helo=mail-lj1-x242.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9DA482194D3AE for ; Wed, 9 Jan 2019 17:44:58 -0800 (PST) Received: by mail-lj1-x242.google.com with SMTP id t18-v6so8240576ljd.4 for ; Wed, 09 Jan 2019 17:44:58 -0800 (PST) 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=zupPS1CLZomlh6Mm8V6rBCHATScZTn04ULzuWBxoEG0=; b=L408goxhVwEbaSTi4Nmk28KSfbDL6pFfsyAYFJToqkuhP2KulUCiIYxUkHhcSseFsy CA9bv29zq3YEeN8S31uz/GaWtXGLtVJ1chWdqAGmb1Wl2DE9vf5WBRSfn6cBxPdc8ixo xtcSWV8/vDxJTOhY7yeASVlohnmZamTBww6R1B09mPBBG23D1y/0crLQ5KwHk3EJv3QA Sf3/BXDcdkShOyiWgNMYVn7gtT7eLW7tt/eHlk+TVR8o22pBj3RLP9CUybQhY+pGNEv7 rg7kJFxXSxQq/Te6bHzqVjde526mBPiGiuko4doOqXaaXU1H/96/Xfcs4wLTOQS4GJEi 5ypw== 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=zupPS1CLZomlh6Mm8V6rBCHATScZTn04ULzuWBxoEG0=; b=j1TqDn92i/jATYGT1frqDp8/Zx3cnwaCKjFqj2aC8dtFZRwP0yQgJbcNtQmKwJ+9kE VeewJ3EqPVAEpWk85Kok7zwzMxPn9dhOt4//5zqgGeLqYNZuROVB8OICC99BTGzqa/A5 cQjdiOkukQ+HTBq0z1BcqMepjMu1O2I/Lv0sHH/OKrco8EyDrZZWV8r1L2D/rkGm/bKD xhFeSPVYklNiWcwH+o55u76d8kONFMeh3wSuG51MlM2lTC7D0kIg3xTp2xTPQHKctkQs s5pRDi/fGP28PyEAhwAIbgxVY4g+IS1oP4L0lBUvKYiCGQirkAhp/6IHX0xfjW2g1AZr xZiA== X-Gm-Message-State: AJcUukfc/CjGpZW65mgGIIpQS7wqmyUDsIuMqyk/5Lr43PJpzNEPOKRE DzGMrh/ppsTifzpQ/sP6lLNT4NtGrEA= X-Google-Smtp-Source: ALg8bN6tMc8HNos3EcodPh86H9esGEX89anM63z9DOkR6XhlHay/fn8zkOpA5OkkMeYihA57XE0Iag== X-Received: by 2002:a2e:9849:: with SMTP id e9-v6mr4691216ljj.9.1547084696356; Wed, 09 Jan 2019 17:44:56 -0800 (PST) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id l21-v6sm15034142ljj.48.2019.01.09.17.44.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Jan 2019 17:44:55 -0800 (PST) From: Marcin Wojtas To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com Date: Thu, 10 Jan 2019 02:44:28 +0100 Message-Id: <1547084679-29597-2-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547084679-29597-1-git-send-email-mw@semihalf.com> References: <1547084679-29597-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH v2 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 X-List-Received-Date: Thu, 10 Jan 2019 01:44:59 -0000 This patch introduces new library callback (ArmadaSoCGpioGet ()), which dynamically allocates and fills EmbeddedGpio's GPIO_CONTROLLER structure with the SoC description of GPIO controllers. Because the library header is indirectly used in many modules, update all dependencies after including EmbeddedGpio.h. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf | 1 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf | 1 + Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf | 1 + Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf | 1 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf | 1 + Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf | 1 + Silicon/Marvell/Library/IcuLib/IcuLib.inf | 1 + Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 10 +++++ Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 12 ++++++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 39 ++++++++++++++++++++ 12 files changed, 70 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf b/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf index 5503463..e707fe9 100644 --- a/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf +++ b/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf @@ -25,6 +25,7 @@ PlatInitDxe.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf index 2b73b73..48a320c 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf @@ -24,6 +24,7 @@ Armada7k8kSoCDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf index 0b93948..0b641fe 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf @@ -42,6 +42,7 @@ MvBoardDescDxe.h [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf index 0eef350..e5bd370 100755 --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf @@ -41,6 +41,7 @@ MvI2cDxe.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec ArmPlatformPkg/ArmPlatformPkg.dec diff --git a/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf b/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf index 739576f..8a877da 100644 --- a/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf +++ b/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf @@ -45,6 +45,7 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf index 00c738a..09c5842 100644 --- a/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf +++ b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf @@ -35,6 +35,7 @@ XenonSdMmcOverride.h [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf b/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf index 36f498b..c360edd 100644 --- a/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf @@ -41,6 +41,7 @@ [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Library/IcuLib/IcuLib.inf b/Silicon/Marvell/Library/IcuLib/IcuLib.inf index 0010141..ea662be 100644 --- a/Silicon/Marvell/Library/IcuLib/IcuLib.inf +++ b/Silicon/Marvell/Library/IcuLib/IcuLib.inf @@ -24,6 +24,7 @@ IcuLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf b/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf index e2381f4..805a057 100644 --- a/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf +++ b/Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf @@ -41,6 +41,7 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h index c14b985..bfc8639 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h @@ -22,6 +22,7 @@ // Common macros // #define MV_SOC_CP_BASE(Cp) (0xF2000000 + ((Cp) * 0x2000000)) +#define MV_SOC_AP806_COUNT 1 // // Platform description of AHCI controllers @@ -38,6 +39,15 @@ #define MV_SOC_COMPHY_MUX_BITS 4 // +// Platform description of GPIO controllers +// +#define MV_SOC_AP806_GPIO_BASE 0xF06F5040 +#define MV_SOC_AP806_GPIO_PIN_COUNT 20 +#define MV_SOC_GPIO_PER_CP_COUNT 2 +#define MV_SOC_CP_GPIO_BASE(Gpio) (0x440100 + ((Gpio) * 0x40)) +#define MV_SOC_CP_GPIO_PIN_COUNT(Gpio) ((Gpio) == 0 ? 32 : 31) + +// // Platform description of I2C controllers // #define MV_SOC_I2C_PER_CP_COUNT 2 diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h index cdfb51b..26b075a 100644 --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h @@ -17,6 +17,8 @@ #include #include +#include + // // ComPhy SoC description // @@ -46,6 +48,16 @@ ArmadaSoCDescCpBaseGet ( ); // +// GPIO devices description template definition +// +EFI_STATUS +EFIAPI +ArmadaSoCGpioGet ( + IN OUT GPIO_CONTROLLER **SoCGpioDescription, + IN OUT UINTN *Count + ); + +// // I2C // typedef struct { diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c index 6902fda..5b72c20 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c @@ -74,6 +74,45 @@ ArmadaSoCDescCpBaseGet ( EFI_STATUS EFIAPI +ArmadaSoCGpioGet ( + IN OUT GPIO_CONTROLLER **SoCGpioDescription, + IN OUT UINTN *Count + ) +{ + GPIO_CONTROLLER *GpioInstance; + UINTN CpCount, CpIndex, Index; + + CpCount = FixedPcdGet8 (PcdMaxCpCount); + + *Count = CpCount * MV_SOC_GPIO_PER_CP_COUNT + MV_SOC_AP806_COUNT; + GpioInstance = AllocateZeroPool (*Count * sizeof (GPIO_CONTROLLER)); + if (GpioInstance == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); + return EFI_OUT_OF_RESOURCES; + } + + *SoCGpioDescription = GpioInstance; + + /* AP806 GPIO controller */ + GpioInstance->RegisterBase = MV_SOC_AP806_GPIO_BASE; + GpioInstance->InternalGpioCount = MV_SOC_AP806_GPIO_PIN_COUNT; + GpioInstance++; + + /* CP110 GPIO controllers */ + for (CpIndex = 0; CpIndex < CpCount; CpIndex++) { + for (Index = 0; Index < MV_SOC_GPIO_PER_CP_COUNT; Index++) { + GpioInstance->RegisterBase = MV_SOC_CP_BASE (CpIndex) + + MV_SOC_CP_GPIO_BASE (Index); + GpioInstance->InternalGpioCount = MV_SOC_CP_GPIO_PIN_COUNT (Index); + GpioInstance++; + } + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI ArmadaSoCDescI2cGet ( IN OUT MV_SOC_I2C_DESC **I2cDesc, IN OUT UINTN *DescCount -- 2.7.4