tolerate no SPI device

This commit is contained in:
Matthew Kennedy 2022-12-21 15:46:59 -08:00 committed by rusefillc
parent c6da63eb66
commit 1f83047ddd
1 changed files with 1 additions and 3 deletions

View File

@ -332,15 +332,13 @@ static BaseBlockDevice* initializeMmcBlockDevice() {
return nullptr;
}
if (!engineConfiguration->isSdCardEnabled) {
if (!engineConfiguration->isSdCardEnabled || mmcSpiDevice == SPI_NONE) {
return nullptr;
}
// Configures and activates the MMC peripheral.
mmcSpiDevice = engineConfiguration->sdCardSpiDevice;
efiAssert(OBD_PCM_Processor_Fault, mmcSpiDevice != SPI_NONE, "SD card enabled, but no SPI device configured!", nullptr);
// todo: reuse initSpiCs method?
mmc_hs_spicfg.ssport = mmc_ls_spicfg.ssport = getHwPort("mmc", engineConfiguration->sdCardCsPin);
mmc_hs_spicfg.sspad = mmc_ls_spicfg.sspad = getHwPin("mmc", engineConfiguration->sdCardCsPin);