Skip to content

Commit

Permalink
dwcmshc: Add property for broken card detect
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
  • Loading branch information
mariobalanica committed Jul 11, 2024
1 parent d174185 commit b7252d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/sd/dwcmshc/dwcmshc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ MshcSlotInterrupt(
}

if (Rintsts & MSHC_INT_CD) {
*CardChange = TRUE;
*CardChange = !MshcExtension->PlatformInfo->Capabilities.BrokenCd;
Rintsts &= ~MSHC_INT_CD;
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions drivers/sd/dwcmshc/dwcmshc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b7252d6

Please sign in to comment.