From 01afd2de561ded9f839e8eece029e2743a5bcee9 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Fri, 9 Jun 2023 10:37:47 +0300 Subject: [PATCH] bdk: sdmmc: properly report comp pad status The reporting of the resistor being shorted or open was swapped. Fix that so it's immediately known what's the issue. --- bdk/storage/sdmmc_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bdk/storage/sdmmc_driver.c b/bdk/storage/sdmmc_driver.c index 8f5b658..0797bff 100644 --- a/bdk/storage/sdmmc_driver.c +++ b/bdk/storage/sdmmc_driver.c @@ -214,12 +214,12 @@ static void _sdmmc_autocal_execute(sdmmc_t *sdmmc, u32 power) #ifdef ERROR_EXTRA_PRINTING // Check if Comp pad is open or short to ground. // SDMMC1: CZ pads - T210/T210B01: 7-bit/5-bit. SDMMC2/4: LV_CZ pads - 5-bit. - u8 code_mask = (sdmmc->t210b01 || sdmmc->id != SDMMC_1) ? 0x1F : 0x7F; - u8 autocal_pu_status = sdmmc->regs->autocalsts & code_mask; + // Use 0x1F mask for all. + u8 autocal_pu_status = sdmmc->regs->autocalsts & 0x1F; if (!autocal_pu_status) - EPRINTFARGS("SDMMC%d: Comp Pad short to gnd!", sdmmc->id + 1); - else if (autocal_pu_status == code_mask) EPRINTFARGS("SDMMC%d: Comp Pad open!", sdmmc->id + 1); + else if (autocal_pu_status == 0x1F) + EPRINTFARGS("SDMMC%d: Comp Pad short to gnd!", sdmmc->id + 1); #endif // In case auto calibration fails, we load suggested standard values.