From nobody Wed Dec 25 15:01:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1509704237807467.3635007138058; Fri, 3 Nov 2017 03:17:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 52660203555EB; Fri, 3 Nov 2017 03:13:19 -0700 (PDT) Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 2271F203555E2 for ; Fri, 3 Nov 2017 03:13:18 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id k62so2042732wrc.9 for ; Fri, 03 Nov 2017 03:17:13 -0700 (PDT) Received: from localhost.localdomain ([105.129.222.2]) by smtp.gmail.com with ESMTPSA id w18sm5331408wra.30.2017.11.03.03.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Nov 2017 03:17:10 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WFcUzyOY9NOi0CTB2d7ITyqD+bjRTYq0r97pVQOoFrQ=; b=BMEysTRcukvFZaYMv/3al+hNe6Nxs5DCRCzo32Ntso3jkP/eCggPNOJx5xRUOvLRaD g5FqOIHgsi2vy6wwt/QIAcbfqwwmkXtrcky0/TbRAMbTdK6CksPO1HAaD26N2i+3Sf7w 2Tou7D5DHqkICzxLA/2Bzc1DBN34iJtXclIfE= 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=WFcUzyOY9NOi0CTB2d7ITyqD+bjRTYq0r97pVQOoFrQ=; b=ehIDVxJaL+vw9hCOS98ssDTa1kF0cqa0o+CceRqzLnhm8iwFcmEevJisBrvuboZZug C7K3eq0P8j9jq7/W9xRJkcTjoxui0GQnDoT79MtI6DdS2Oyjky70jIM+osYb+8CYdo/U CkQExVAgOzUdUYqu1fxd/Y7mAF6PU4nQKYZn5hJT5Wk/xGpCJnBoVnS09c/QvX63B6eX 8FsiEmyXE/h8ad7OFn7nAEcp+XfPe2/G6HHFVPcXN2/oMajQNZimtC+5DJ6Gda3xv0D2 5pe0neWqN0OLp2YlVedj65zc5F3J046I/3bxUD8jKEvKUpOHt0vn9Ybwqls87nq+cZxB AI7g== X-Gm-Message-State: AMCzsaU3jhj2TSbkBINqr0SvAvh03IziztPIjGBd3Hc8k5qeL6ToIxKE lBlLRIBs92dPg5ndOKGez0Xr1odp/bY= X-Google-Smtp-Source: ABhQp+TxIVY6z1Dk4E8JmQLSV3Y7o7s6DsWs8ksQID1GL17vb7Mj1zYFp8dYkWbga+CcRbPFPWPjFg== X-Received: by 10.223.136.51 with SMTP id d48mr5245496wrd.150.1509704231181; Fri, 03 Nov 2017 03:17:11 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, daniel.thompson@linaro.org Date: Fri, 3 Nov 2017 10:16:54 +0000 Message-Id: <20171103101654.30973-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171103101654.30973-1-ard.biesheuvel@linaro.org> References: <20171103101654.30973-1-ard.biesheuvel@linaro.org> Subject: [edk2] [RFC PATCH edk2-platforms 3/3] Platform/DeveloperBox: wire up RTC support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add the drivers, library resolutions and PCD settings to enable RTC support on DeveloperBox. Also, update PlatformDxe to register the non-discoverable device handles for both I2C controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Platform/Socionext/DeveloperBox/DeveloperBox.dsc = | 8 ++- Platform/Socionext/DeveloperBox/DeveloperBox.fdf = | 5 ++ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c = | 76 +++++++++++++++++--- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf = | 6 +- Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h = | 8 +++ Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMem= oryInitPeiLib.c | 4 ++ 6 files changed, 96 insertions(+), 11 deletions(-) diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc b/Platform/So= cionext/DeveloperBox/DeveloperBox.dsc index b558b1f805b4..91898faa6ecc 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc @@ -446,8 +446,7 @@ [Components.common] MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf { - ## TODO - RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/Templa= teRealTimeClockLib.inf + RealTimeClockLib|Silicon/NXP/Library/Pcf8563RealTimeClockLib/Pcf8563= RealTimeClockLib.inf } MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf @@ -627,6 +626,11 @@ [Components.common] =20 Platform/Socionext/DeveloperBox/OsInstallerMenuDxe/OsInstallerMenuDxe.inf =20 + # + # I2C + # + Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.inf + !if $(DO_X86EMU) =3D=3D TRUE # # x86 emulator diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf b/Platform/So= cionext/DeveloperBox/DeveloperBox.fdf index 19dbcf17c1e1..368bf801e036 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf @@ -236,6 +236,11 @@ [FV.FvMain] =20 INF Platform/Socionext/DeveloperBox/OsInstallerMenuDxe/OsInstallerMenuDx= e.inf =20 + # + # I2C + # + INF Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.= inf + !if $(DO_X86EMU) =3D=3D TRUE # # x86 emulator diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c = b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c index 1d300b15e25b..b39cbc5f5291 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c @@ -62,27 +62,61 @@ STATIC EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR mNetsecDesc[] = =3D { } }; =20 +STATIC EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR mI2c0Desc[] =3D { + { + ACPI_ADDRESS_SPACE_DESCRIPTOR, // Desc + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3, // Len + ACPI_ADDRESS_SPACE_TYPE_MEM, // ResType + 0, // GenFlag + 0, // SpecificFlag + 32, // AddrSpaceGranular= ity + SYNQUACER_I2C0_BASE, // AddrRangeMin + SYNQUACER_I2C0_BASE + SYNQUACER_I2C0_SIZE - 1, // AddrRangeMax + 0, // AddrTranslationOf= fset + SYNQUACER_I2C0_SIZE, // AddrLen + }, { + ACPI_END_TAG_DESCRIPTOR // Desc + } +}; + +STATIC EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR mI2c1Desc[] =3D { + { + ACPI_ADDRESS_SPACE_DESCRIPTOR, // Desc + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3, // Len + ACPI_ADDRESS_SPACE_TYPE_MEM, // ResType + 0, // GenFlag + 0, // SpecificFlag + 32, // AddrSpaceGranular= ity + SYNQUACER_I2C1_BASE, // AddrRangeMin + SYNQUACER_I2C1_BASE + SYNQUACER_I2C1_SIZE - 1, // AddrRangeMax + 0, // AddrTranslationOf= fset + SYNQUACER_I2C1_SIZE, // AddrLen + }, { + ACPI_END_TAG_DESCRIPTOR // Desc + } +}; + STATIC EFI_STATUS -RegisterNetsec ( - VOID +RegisterDevice ( + IN EFI_GUID *TypeGuid, + IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc, + OUT EFI_HANDLE *Handle ) { NON_DISCOVERABLE_DEVICE *Device; EFI_STATUS Status; - EFI_HANDLE Handle; =20 Device =3D (NON_DISCOVERABLE_DEVICE *)AllocateZeroPool (sizeof (*Device)= ); if (Device =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 - Device->Type =3D &gNetsecNonDiscoverableDeviceGuid; + Device->Type =3D TypeGuid; Device->DmaType =3D NonDiscoverableDeviceDmaTypeNonCoherent; - Device->Resources =3D mNetsecDesc; + Device->Resources =3D Desc; =20 - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces (&Handle, + Status =3D gBS->InstallMultipleProtocolInterfaces (Handle, &gEdkiiNonDiscoverableDeviceProtocolGuid, Device, NULL); if (EFI_ERROR (Status)) { @@ -106,6 +140,7 @@ PlatformDxeEntryPoint ( EFI_STATUS Status; VOID *Dtb; UINTN DtbSize; + EFI_HANDLE Handle; =20 Dtb =3D NULL; Status =3D DtPlatformLoadDtb (&Dtb, &DtbSize); @@ -118,5 +153,30 @@ PlatformDxeEntryPoint ( Status)); } =20 - return RegisterNetsec (); + Handle =3D NULL; + Status =3D RegisterDevice (&gNetsecNonDiscoverableDeviceGuid, mNetsecDes= c, + &Handle); + ASSERT_EFI_ERROR (Status); + + Handle =3D NULL; + Status =3D RegisterDevice (&gSynQuacerNonDiscoverableRuntimeI2cMasterGui= d, + mI2c0Desc, &Handle); + ASSERT_EFI_ERROR (Status); + + // + // Install the PCF8563 I2C Master protocol on this handle so the RTC dri= ver + // can identify it as the I2C master it can invoke directly, rather than + // through the I2C driver stack (which cannot be used at runtime) + // + Status =3D gBS->InstallProtocolInterface (&Handle, + &gPcf8563RealTimeClockLibI2cMasterProtolGuid, + EFI_NATIVE_INTERFACE, NULL); + ASSERT_EFI_ERROR (Status); + + Handle =3D NULL; + Status =3D RegisterDevice (&gSynQuacerNonDiscoverableI2cMasterGuid, mI2c= 1Desc, + &Handle); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; } diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.in= f b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf index 25e6248f1c61..478e0c7d33e9 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -29,6 +29,7 @@ [Packages] EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + Silicon/NXP/Library/Pcf8563RealTimeClockLib/Pcf8563RealTimeClockLib.dec Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.dec Silicon/Socionext/SynQuacer/SynQuacer.dec =20 @@ -43,9 +44,12 @@ [LibraryClasses] [Guids] gFdtTableGuid gNetsecNonDiscoverableDeviceGuid + gSynQuacerNonDiscoverableI2cMasterGuid + gSynQuacerNonDiscoverableRuntimeI2cMasterGuid =20 [Protocols] - gEdkiiNonDiscoverableDeviceProtocolGuid ## PRODUCES + gEdkiiNonDiscoverableDeviceProtocolGuid ## PRODUCES + gPcf8563RealTimeClockLibI2cMasterProtolGuid ## PRODUCES =20 [FixedPcd] gSynQuacerTokenSpaceGuid.PcdNetsecEepromBase diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h b/Sil= icon/Socionext/SynQuacer/Include/Platform/MemoryMap.h index 1ccd3122cdda..49795f97602c 100644 --- a/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h +++ b/Silicon/Socionext/SynQuacer/Include/Platform/MemoryMap.h @@ -42,6 +42,14 @@ #define SYNQUACER_GPIO_BASE 0x51000000 #define SYNQUACER_GPIO_SIZE SIZE_4KB =20 +// I2C0 block +#define SYNQUACER_I2C0_BASE 0x51200000 +#define SYNQUACER_I2C0_SIZE SIZE_4KB + +// I2C1 block +#define SYNQUACER_I2C1_BASE 0x51210000 +#define SYNQUACER_I2C1_SIZE SIZE_4KB + // eMMC(SDH30) #define SYNQUACER_EMMC_BASE 0x52300000 #define SYNQUACER_EMMC_BASE_SZ SIZE_4KB diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/= SynQuacerMemoryInitPeiLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacer= MemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c index be9e28d2ff49..c8c940f27917 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuac= erMemoryInitPeiLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuac= erMemoryInitPeiLib.c @@ -82,6 +82,10 @@ STATIC CONST ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemory= Table[] =3D { ARM_DEVICE_REGION (FixedPcdGet32 (PcdNetsecEepromBase), SYNQUACER_EEPROM_BASE_SZ), =20 + // SynQuacer I2C + ARM_DEVICE_REGION (SYNQUACER_I2C0_BASE, SYNQUACER_I2C0_SIZE), + ARM_DEVICE_REGION (SYNQUACER_I2C1_BASE, SYNQUACER_I2C1_SIZE), + // SynQuacer NETSEC ARM_DEVICE_REGION (SYNQUACER_NETSEC_BASE, SYNQUACER_NETSEC_BASE_SZ), =20 --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel