From e69ef9ee0df14de029db8b62dc1fc1caf4ab0b5b Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 9 Jun 2026 07:01:21 +0300 Subject: [PATCH] sdmmc: identify SD Express cards --- bdk/storage/sdmmc.c | 6 +++++- bdk/storage/sdmmc.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bdk/storage/sdmmc.c b/bdk/storage/sdmmc.c index 0aea82d4..590ff704 100644 --- a/bdk/storage/sdmmc.c +++ b/bdk/storage/sdmmc.c @@ -971,7 +971,7 @@ void _sd_storage_debug_print_ssr(const u8 *raw_ssr) static int _sd_storage_send_if_cond(sdmmc_storage_t *storage, bool *is_sd_v1) { sdmmc_cmd_t cmdbuf; - u16 icr = SD_ICR_VHS_27_36 | SD_ICR_PATTERN; + u16 icr = SD_ICR_PCIE | SD_ICR_VHS_27_36 | SD_ICR_PATTERN; sdmmc_init_cmd(&cmdbuf, SD_SEND_IF_COND, icr, SDMMC_RSP_TYPE_7, 0); if (!sdmmc_execute_cmd(storage->sdmmc, &cmdbuf, NULL, NULL)) @@ -997,7 +997,11 @@ static int _sd_storage_send_if_cond(sdmmc_storage_t *storage, bool *is_sd_v1) // Check if VHS was accepted and pattern was properly returned. if ((ricr & 0xFFF) == (icr & 0xFFF)) + { + storage->has_pcie = ricr & SD_ICR_PCIE; + return 1; + } return 0; } diff --git a/bdk/storage/sdmmc.h b/bdk/storage/sdmmc.h index e2e28c3f..930f26a0 100644 --- a/bdk/storage/sdmmc.h +++ b/bdk/storage/sdmmc.h @@ -201,6 +201,7 @@ typedef struct _sdmmc_storage_t int initialized; int is_low_voltage; int has_sector_access; + int has_pcie; u32 rca; u32 sec_cnt; u32 partition;