From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by mx.groups.io with SMTP id smtpd.web10.2526.1570686154852512176 for ; Wed, 09 Oct 2019 22:42:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=OUBdQg66; spf=none, err=SPF record not found (domain: semihalf.com, ip: 209.85.167.66, mailfrom: mw@semihalf.com) Received: by mail-lf1-f66.google.com with SMTP id u3so3366868lfl.10 for ; Wed, 09 Oct 2019 22:42:34 -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=j8dFmMX7wwtvkZ0GjGDtViNEXfUTe44XCm3shV7+UyY=; b=OUBdQg66KtYNpg0dHBuAsuExCAN/1c6Oyt8TRduRCZq3u+tbcgkcwvEwar7J4PyVu7 W4TwNAGiXfRS6+72Vu1FT6Ub++7eGP97nE2RV9BFACM8VffArNLZ539T0+KwXByYDtad qAl79ZAvmoW9uE4JqAgtXFKJhA5tl9tyNJqhpjONUDF875sm/+i82RXzYN8AK/YbwPO3 hCxmK4sSWAZEvaBv4//SsbZyE8SRpsTroRL3JPXSJ46HwDt9WsmcJ+dzlo1OWhheULXs qZtG3kAYo77prPs6BG98o2pSrW8pF/qt7oAxUwYFxo4sDnopVrEXBkuL2t3gNKZCuKQW PFtA== 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=j8dFmMX7wwtvkZ0GjGDtViNEXfUTe44XCm3shV7+UyY=; b=gf59J641CUBx9w1qR5uiRcgBbJBiLmgpKPlcfLtUNVDdikGF/6HwnacKd8VtxEQMoE r8gSoe6enow/tun3joK5D0MiwBr4MP4WvtsO0IrFVwhbyRWtQJF552SMy3ld4laBE6hA ng2/SUMkwi94CyEGbWfMMIfHwPUOWMdcK9ud4Dx9NL/oqm5/p6uETybA1/F79oHhu647 gdnJE90hg092PR47XRp/v8Oq4FOT2e0Rk3oa6O6oJuMUL7VePW2I2dzWukYZ9PEFVzs7 PaOh4BU+kUkCedo+bQTgwyN545AjEh92csyewxI2DWALv34NBSGRVuWMvw1dfZMQvwOi t4iQ== X-Gm-Message-State: APjAAAW9CySrgCrDCMjqJXWuWFeHOcv0J8rsEZWACnLu/AhlnokFMzbh a7upz8VSLCTThL/zma1kBrNJQdcWF83w+Q== X-Google-Smtp-Source: APXvYqztrd+zMjFBGydmK+VQgnrSQW5poLZzOKYicyoTt1j62wwTk3IMVV5KOZCA7mjVYtaVM0wCkA== X-Received: by 2002:a19:4a13:: with SMTP id x19mr4849271lfa.184.1570686152825; Wed, 09 Oct 2019 22:42:32 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Oct 2019 22:42:32 -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 4/9] Marvell/Library: ArmadaSoCDescLib/MppLib: Extend Xenon information Date: Thu, 10 Oct 2019 07:42:14 +0200 Message-Id: <1570686139-25182-5-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> Hitherto SoC description and MppLib libraries code assumed that there could be only two Xenon SdMmc controller instances in the SoC. Remove those limitations, so that to support CN913x SoCs, which may have up to 4 of such interfaces. Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 5 +-- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 34 +++++++++++++------- Silicon/Marvell/Library/MppLib/MppLib.c | 4 +-- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h index 0296d43..265b4f4 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h @@ -90,8 +90,9 @@ // // Platform description of SDMMC controllers // -#define MV_SOC_MAX_SDMMC_COUNT 2 -#define MV_SOC_SDMMC_BASE(Index) ((Index) == 0 ? 0xF06E0000 : 0xF2780000) +#define MV_SOC_SDMMC_PER_CP_COUNT 1 +#define MV_SOC_AP80X_SDMMC_BASE 0xF06E0000 +#define MV_SOC_CP_SDMMC_BASE(Cp) (MV_SOC_CP_BASE (Cp) + 0x780000) // // Platform description of UTMI PHY's diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c index 5947601..3ffd57e 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c @@ -349,26 +349,36 @@ EFI_STATUS EFIAPI ArmadaSoCDescSdMmcGet ( IN OUT MV_SOC_SDMMC_DESC **SdMmcDesc, - IN OUT UINTN *DescCount + IN OUT UINTN *Count ) { - MV_SOC_SDMMC_DESC *Desc; - UINTN Index; + MV_SOC_SDMMC_DESC *SdMmc; + UINTN CpCount, CpIndex; - Desc = AllocateZeroPool (MV_SOC_MAX_SDMMC_COUNT * sizeof (MV_SOC_SDMMC_DESC)); - if (Desc == NULL) { + CpCount = FixedPcdGet8 (PcdMaxCpCount); + + *Count = CpCount * MV_SOC_SDMMC_PER_CP_COUNT + MV_SOC_AP806_COUNT; + SdMmc = AllocateZeroPool (*Count * sizeof (MV_SOC_SDMMC_DESC)); + if (SdMmc == NULL) { DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } - for (Index = 0; Index < MV_SOC_MAX_SDMMC_COUNT; Index++) { - Desc[Index].SdMmcBaseAddress = MV_SOC_SDMMC_BASE (Index); - Desc[Index].SdMmcMemSize = SIZE_1KB; - Desc[Index].SdMmcDmaType = NonDiscoverableDeviceDmaTypeCoherent; - } + *SdMmcDesc = SdMmc; + + /* AP80x controller */ + SdMmc->SdMmcBaseAddress = MV_SOC_AP80X_SDMMC_BASE; + SdMmc->SdMmcMemSize = SIZE_1KB; + SdMmc->SdMmcDmaType = NonDiscoverableDeviceDmaTypeCoherent; + SdMmc++; - *SdMmcDesc = Desc; - *DescCount = MV_SOC_MAX_SDMMC_COUNT; + /* CP11x controllers */ + for (CpIndex = 0; CpIndex < CpCount; CpIndex++) { + SdMmc->SdMmcBaseAddress = MV_SOC_CP_SDMMC_BASE (CpIndex); + SdMmc->SdMmcMemSize = SIZE_1KB; + SdMmc->SdMmcDmaType = NonDiscoverableDeviceDmaTypeCoherent; + SdMmc++; + } return EFI_SUCCESS; } diff --git a/Silicon/Marvell/Library/MppLib/MppLib.c b/Silicon/Marvell/Library/MppLib/MppLib.c index 40d9077..f20668d 100644 --- a/Silicon/Marvell/Library/MppLib/MppLib.c +++ b/Silicon/Marvell/Library/MppLib/MppLib.c @@ -139,11 +139,9 @@ SetSdMmcPhyMpp ( case 0: Offset = SD_MMC_PHY_AP_MPP_OFFSET; break; - case 1: + default: Offset = SD_MMC_PHY_CP0_MPP_OFFSET; break; - default: - return; } /* -- 2.7.4