From: Leif Lindholm <leif.lindholm@linaro.org>
To: Marcin Wojtas <mw@semihalf.com>
Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org,
nadavh@marvell.com, jsd@semihalf.com, jaz@semihalf.com,
kostap@marvell.com
Subject: Re: [platforms: PATCH v2 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information
Date: Mon, 14 Jan 2019 23:45:18 +0000 [thread overview]
Message-ID: <20190114234518.ftnywsbyywyr76wq@bivouac.eciton.net> (raw)
In-Reply-To: <1547084679-29597-2-git-send-email-mw@semihalf.com>
On Thu, Jan 10, 2019 at 02:44:28AM +0100, Marcin Wojtas wrote:
> 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 <mw@semihalf.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> 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 <Library/MvComPhyLib.h>
> #include <Library/NonDiscoverableDeviceRegistrationLib.h>
>
> +#include <Protocol/EmbeddedGpio.h>
> +
> //
> // 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
>
next prev parent reply other threads:[~2019-01-14 23:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 1:44 [platforms: PATCH v2 00/12] Armada 7k8k GPIO support Marcin Wojtas
2019-01-10 1:44 ` [platforms: PATCH v2 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information Marcin Wojtas
2019-01-14 23:45 ` Leif Lindholm [this message]
2019-01-10 1:44 ` [platforms: PATCH v2 02/12] Marvell/Library: ArmadaBoardDescLib: " Marcin Wojtas
2019-01-14 23:46 ` Leif Lindholm
2019-01-10 1:44 ` [platforms: PATCH v2 03/12] SolidRun/Armada80x0McBin: Extend board description library with GPIO Marcin Wojtas
2019-01-14 23:46 ` Leif Lindholm
2019-01-10 1:44 ` [platforms: PATCH v2 04/12] Marvell/Armada70x0Db: " Marcin Wojtas
2019-01-14 22:41 ` Leif Lindholm
2019-01-15 5:48 ` Marcin Wojtas
2019-01-10 1:44 ` [platforms: PATCH v2 05/12] Marvell/Armada80x0Db: " Marcin Wojtas
2019-01-14 22:44 ` Leif Lindholm
2019-01-10 1:44 ` [platforms: PATCH v2 06/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support Marcin Wojtas
2019-01-14 22:58 ` Leif Lindholm
2019-01-15 6:05 ` Marcin Wojtas
2019-01-15 9:56 ` Leif Lindholm
2019-01-15 10:05 ` Marcin Wojtas
2019-01-15 10:12 ` Leif Lindholm
2019-01-15 10:14 ` Marcin Wojtas
2019-01-15 10:26 ` Leif Lindholm
2019-01-10 1:44 ` [platforms: PATCH v2 07/12] Marvell/Protocol: Introduce GPIO helper header Marcin Wojtas
2019-01-14 23:12 ` Leif Lindholm
2019-01-15 6:12 ` Marcin Wojtas
2019-01-10 1:44 ` [platforms: PATCH v2 08/12] Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver Marcin Wojtas
2019-01-14 23:32 ` Leif Lindholm
2019-01-15 6:19 ` Marcin Wojtas
2019-01-15 10:04 ` Leif Lindholm
2019-01-15 10:06 ` Marcin Wojtas
2019-01-10 1:44 ` [platforms: PATCH v2 09/12] Marvell/Drivers: I2c: Use common header for macros Marcin Wojtas
2019-01-10 1:44 ` [platforms: PATCH v2 10/12] Marvell/Drivers: MvPca95xxDxe: Introduce GPIO expander driver Marcin Wojtas
2019-01-14 23:40 ` Leif Lindholm
2019-01-10 1:44 ` [platforms: PATCH v2 11/12] Marvell/Armada7k8k: Enable GPIO drivers compilation Marcin Wojtas
2019-01-10 1:44 ` [platforms: PATCH v2 12/12] Marvell/Armada7k8k: Introduce NonDiscoverable device init routines Marcin Wojtas
2019-01-14 23:44 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190114234518.ftnywsbyywyr76wq@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox