[edk2-devel] [PATCH v5 6/7] Platform/RaspberryPi: Power up SD, and tweak GPIOs

Jeremy Linton posted 7 patches 5 months, 1 week ago

[edk2-devel] [PATCH v5 6/7] Platform/RaspberryPi: Power up SD, and tweak GPIOs

Posted by Jeremy Linton 5 months, 1 week ago
It seems we should be powering up the SD cards, and possibly
the clocks as well to assure they are setup properly before
we attempt to access the controller.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 28f57438c5..aa9ba7d76f 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -552,6 +552,13 @@ ApplyVariables (
       GpioPinFuncSet (37, GPIO_FSEL_ALT3);
       GpioPinFuncSet (38, GPIO_FSEL_ALT3);
       GpioPinFuncSet (39, GPIO_FSEL_ALT3);
+
+      Status = mFwProtocol->SetPowerState (RPI_MBOX_POWER_STATE_SDHCI,
+                                           TRUE, TRUE); //SD on with wait
+      Status = mFwProtocol->SetGpioConfig (RPI_EXP_GPIO_SD_VOLT, 
+                                           RPI_EXP_GPIO_DIR_OUT, TRUE); //3.3v
+      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC2, TRUE);
+      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC, TRUE);
     }
   } else {
     DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n", mModelFamily));
-- 
2.13.7



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70019): https://edk2.groups.io/g/devel/message/70019
Mute This Topic: https://groups.io/mt/79518686/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-