From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.10964.1638463954602965108 for ; Thu, 02 Dec 2021 08:52:35 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0C5F0152F; Thu, 2 Dec 2021 08:52:35 -0800 (PST) Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B2B223F73B; Thu, 2 Dec 2021 08:52:34 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, mariobalanica02@gmail.com, Jeremy Linton Subject: [PATCH 7/9] Platform/RaspberryPi: Add SPI/GPIO to memory map Date: Thu, 2 Dec 2021 10:52:04 -0600 Message-Id: <20211202165206.79615-8-jeremy.linton@arm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211202165206.79615-1-jeremy.linton@arm.com> References: <20211202165206.79615-1-jeremy.linton@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit A large reason for using the SPI flash on this platform is that it can be updated without OS interference at rutime. In order for that to happen we need both the SPI, as well as the GPIO which is used to change the pinmux from the PWM device to SPI added to the UEFI memory map as being used by the runtime service. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 3d058cb40d..ccdeddf3c0 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -503,6 +503,22 @@ ApplyVariables ( DEBUG ((DEBUG_INFO, "Current CPU speed is %u MHz\n", Rate / FREQ_1_MHZ)); } + if (mModelFamily == 4) { + Status = gDS->AddMemorySpace (EfiGcdMemoryTypeMemoryMappedIo, BCM2836_SPI0_BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); + ASSERT_EFI_ERROR (Status); + Status = gDS->SetMemorySpaceAttributes (BCM2836_SPI0_BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC|EFI_MEMORY_RUNTIME); + + Status = gDS->AddMemorySpace (EfiGcdMemoryTypeMemoryMappedIo, GPIO_BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); + ASSERT_EFI_ERROR (Status); + Status = gDS->SetMemorySpaceAttributes (GPIO_BASE_ADDRESS, + SIZE_4KB, EFI_MEMORY_UC|EFI_MEMORY_RUNTIME); + + ASSERT_EFI_ERROR (Status); + } + if (mModelFamily >= 4 && PcdGet32 (PcdRamMoreThan3GB) != 0 && PcdGet32 (PcdRamLimitTo3GB) == 0) { UINT64 SystemMemorySize; -- 2.13.7