EmbeddedPkg/MmcDxe: Enable 4-bit mode even if SD_HIGH_SPEED is not supported

If SD doesn't support SD_HIGH_SPEED, function should still continue to
setup SD to go into 4 bits more if it is supported. Currently, the code
inadvertently exits early, but with a EFI_SUCCESS return code, and so
execution proceeds without ever attempting to enable 4-bit mode.

Since not having SD_HIGH_SPEED support is not an error, downgrade the
message that reports this to DEBUG_INFO.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Loh Tien Hock <tien.hock.loh@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Loh, Tien Hock 2019-02-22 15:58:03 +08:00 committed by Ard Biesheuvel
parent b0189eac00
commit c49f298d28
1 changed files with 18 additions and 19 deletions

View File

@ -473,28 +473,27 @@ InitializeSdMmcDevice (
}
if (!(Buffer[3] & SD_HIGH_SPEED_SUPPORTED)) {
DEBUG ((DEBUG_ERROR, "%a : High Speed not supported by Card %r\n", __FUNCTION__, Status));
return Status;
}
Speed = SD_HIGH_SPEED;
/* SD Switch, Mode:1, Group:0, Value:1 */
CmdArg = CreateSwitchCmdArgument(1, 0, 1);
Status = MmcHost->SendCommand (MmcHost, MMC_CMD6, CmdArg);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __FUNCTION__, Status));
return Status;
DEBUG ((DEBUG_INFO, "%a : High Speed not supported by Card\n", __FUNCTION__));
} else {
Status = MmcHost->ReadBlockData (MmcHost, 0, SWITCH_CMD_DATA_LENGTH, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): ReadBlockData Error and Status = %r\n", __FUNCTION__, Status));
return Status;
}
Speed = SD_HIGH_SPEED;
if ((Buffer[4] & SWITCH_CMD_SUCCESS_MASK) != 0x01000000) {
DEBUG((DEBUG_ERROR, "Problem switching SD card into high-speed mode\n"));
/* SD Switch, Mode:1, Group:0, Value:1 */
CmdArg = CreateSwitchCmdArgument(1, 0, 1);
Status = MmcHost->SendCommand (MmcHost, MMC_CMD6, CmdArg);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __FUNCTION__, Status));
return Status;
} else {
Status = MmcHost->ReadBlockData (MmcHost, 0, SWITCH_CMD_DATA_LENGTH, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): ReadBlockData Error and Status = %r\n", __FUNCTION__, Status));
return Status;
}
if ((Buffer[4] & SWITCH_CMD_SUCCESS_MASK) != 0x01000000) {
DEBUG((DEBUG_ERROR, "Problem switching SD card into high-speed mode\n"));
return Status;
}
}
}
}