mmc_bus: set card type before sending first command that needs it
Change-Id: I9ba2b5dca69da31b6de1e3baa79e53c611b85913 Reviewed-on: https://review.haiku-os.org/c/haiku/+/10932 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]> Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
5a1cec163d
commit
0753e9eb5e
@@ -225,6 +225,7 @@ MMCBus::_WorkerThread(void* cookie)
|
||||
// Do not check for SDHC support in this case
|
||||
hcs = 0;
|
||||
uint32_t mmcOcr;
|
||||
|
||||
TRACE("Trying MMC CMD1 initialization...\n");
|
||||
do {
|
||||
status = bus->ExecuteCommand(0, MMC_SEND_OP_COND, 0xFF8000, &mmcOcr);
|
||||
@@ -289,6 +290,10 @@ MMCBus::_WorkerThread(void* cookie)
|
||||
}
|
||||
TRACE("Voltage range: %x\n", ocr & 0xFFFFFF);
|
||||
|
||||
// Set the card type so the next commands have the correct reply types
|
||||
// (MMC and SD commands with the same identifier sometime expect different responses)
|
||||
bus->SetCardType((card_type)cardType);
|
||||
|
||||
// TODO send CMD11 to switch to low voltage mode if card supports it?
|
||||
|
||||
// We use CMD2 (ALL_SEND_CID) and CMD3 (SEND_RELATIVE_ADDR) to assign
|
||||
@@ -359,8 +364,6 @@ MMCBus::_WorkerThread(void* cookie)
|
||||
}
|
||||
|
||||
if (cardFound) {
|
||||
bus->SetCardType((card_type)cardType);
|
||||
|
||||
device_attr attrs[] = {
|
||||
{ B_DEVICE_BUS, B_STRING_TYPE, {.string = "mmc" }},
|
||||
{ B_DEVICE_PRETTY_NAME, B_STRING_TYPE, {.string = "mmc device" }},
|
||||
|
||||
@@ -237,6 +237,7 @@ mmc_disk_init_driver(device_node* node, void** cookie)
|
||||
|
||||
// SD and MMC cards use byte offsets for IO commands, later ones (SDHC,
|
||||
// SDXC, ...) use sectors.
|
||||
// TODO eMMC uses sectors as well if defined in the OCR register bits 30:29
|
||||
if (deviceType == CARD_TYPE_SD || deviceType == CARD_TYPE_MMC)
|
||||
info->flags = 0;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user