From b7252d6d34d0a9a35e9d7af2d3a0c4e13a8cf93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20B=C4=83l=C4=83nic=C4=83?= Date: Thu, 11 Jul 2024 03:15:35 +0300 Subject: [PATCH] dwcmshc: Add property for broken card detect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mario Bălănică --- drivers/sd/dwcmshc/dwcmshc.cpp | 11 ++++++++++- drivers/sd/dwcmshc/dwcmshc.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/sd/dwcmshc/dwcmshc.cpp b/drivers/sd/dwcmshc/dwcmshc.cpp index e480669..400965c 100644 --- a/drivers/sd/dwcmshc/dwcmshc.cpp +++ b/drivers/sd/dwcmshc/dwcmshc.cpp @@ -864,7 +864,7 @@ MshcSlotInterrupt( } if (Rintsts & MSHC_INT_CD) { - *CardChange = TRUE; + *CardChange = !MshcExtension->PlatformInfo->Capabilities.BrokenCd; Rintsts &= ~MSHC_INT_CD; } @@ -1084,6 +1084,10 @@ MshcSlotToggleEvents( // Intsts |= MSHC_INT_HTO; + if (MshcExtension->PlatformInfo->Capabilities.BrokenCd) { + Intsts &= ~MSHC_INT_CD; + } + if (Enable) { MshcEnableInterrupts(MshcExtension, Intsts, Idsts); } else { @@ -3127,6 +3131,10 @@ MshcIsCardInserted( { ULONG Cdetect; + if (MshcExtension->PlatformInfo->Capabilities.BrokenCd) { + return TRUE; + } + Cdetect = MshcReadRegister(MshcExtension, MSHC_CDETECT); return (Cdetect & MSHC_CDETECT_CARD_DETECT_N(MshcExtension->SlotId)) == 0; @@ -3189,6 +3197,7 @@ MshcQueryAcpiPlatformCapabilities( AcpiDevicePropertiesQueryIntegerValue(Properties, "sd-uhs-sdr104", &Capabilities->SupportSdr104); AcpiDevicePropertiesQueryIntegerValue(Properties, "mmc-hs200-1_8v", &Capabilities->SupportHs200); AcpiDevicePropertiesQueryIntegerValue(Properties, "no-1-8-v", &Capabilities->No18vRegulator); + AcpiDevicePropertiesQueryIntegerValue(Properties, "broken-cd", &Capabilities->BrokenCd); Status = STATUS_SUCCESS; diff --git a/drivers/sd/dwcmshc/dwcmshc.h b/drivers/sd/dwcmshc/dwcmshc.h index d8af1be..e6080f2 100644 --- a/drivers/sd/dwcmshc/dwcmshc.h +++ b/drivers/sd/dwcmshc/dwcmshc.h @@ -492,6 +492,7 @@ typedef struct _MSHC_PLATFORM_CAPABILITIES { ULONG SupportSdr104; ULONG SupportHs200; ULONG No18vRegulator; + ULONG BrokenCd; } MSHC_PLATFORM_CAPABILITIES, *PMSHC_PLATFORM_CAPABILITIES; typedef enum _MSHC_PLATFORM_TYPE {