From 416b2fa11b031aa894bfccbc57e9be75388fdea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20B=C4=83l=C4=83nic=C4=83?= Date: Wed, 10 Jul 2024 20:14:34 +0300 Subject: [PATCH] FydetabDuo: Disable SD card detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's a trick to boot from SD on this tablet: the card tray has to be opened slightly, just enough so that the card detect pin is released while the card itself still makes contact with the data pins. Given that both states can mean "connected", UEFI should no longer rely on this signal to detect card presence. Signed-off-by: Mario Bălănică --- .../Platform/FydeInnovations/FydetabDuo/FydetabDuo.dsc | 2 +- .../Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.c | 9 +++------ .../Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.inf | 2 +- edk2-rockchip/Silicon/Rockchip/RockchipPkg.dec | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/edk2-rockchip/Platform/FydeInnovations/FydetabDuo/FydetabDuo.dsc b/edk2-rockchip/Platform/FydeInnovations/FydetabDuo/FydetabDuo.dsc index caafb5a0..df88dc59 100644 --- a/edk2-rockchip/Platform/FydeInnovations/FydetabDuo/FydetabDuo.dsc +++ b/edk2-rockchip/Platform/FydeInnovations/FydetabDuo/FydetabDuo.dsc @@ -98,7 +98,7 @@ gRK3588TokenSpaceGuid.PcdI2S0Supported|TRUE # SD card detect signal is inverted - gRockchipTokenSpaceGuid.PcdRkSdmmcCardDetectInverted|TRUE + gRockchipTokenSpaceGuid.PcdRkSdmmcCardDetectBroken|TRUE ################################################################################ # diff --git a/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.c b/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.c index 337962cf..a890fc32 100644 --- a/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.c +++ b/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.c @@ -123,15 +123,12 @@ RkSdmmcCardDetect ( PresenceState = RkSdmmcGetCardPresenceState (); - if (PresenceState == RkSdmmcCardPresenceUnsupported) { + if ((PresenceState == RkSdmmcCardPresenceUnsupported) || + FixedPcdGetBool (PcdRkSdmmcCardDetectBroken)) { return TRUE; // let the driver do software detection } - if (FixedPcdGetBool (PcdRkSdmmcCardDetectInverted)) { - return PresenceState != RkSdmmcCardPresent; - } else { - return PresenceState == RkSdmmcCardPresent; - } + return PresenceState == RkSdmmcCardPresent; } STATIC PLATFORM_DW_MMC_PROTOCOL mDwMmcDeviceProtocol = { diff --git a/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.inf b/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.inf index 26dcedba..61433031 100644 --- a/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.inf +++ b/edk2-rockchip/Silicon/Rockchip/Drivers/RkSdmmcDxe/RkSdmmcDxe.inf @@ -43,7 +43,7 @@ [Pcd] gRockchipTokenSpaceGuid.PcdRkSdmmcBaseAddress - gRockchipTokenSpaceGuid.PcdRkSdmmcCardDetectInverted + gRockchipTokenSpaceGuid.PcdRkSdmmcCardDetectBroken [Depex] TRUE diff --git a/edk2-rockchip/Silicon/Rockchip/RockchipPkg.dec b/edk2-rockchip/Silicon/Rockchip/RockchipPkg.dec index d48e1a12..440d6ae1 100644 --- a/edk2-rockchip/Silicon/Rockchip/RockchipPkg.dec +++ b/edk2-rockchip/Silicon/Rockchip/RockchipPkg.dec @@ -62,7 +62,7 @@ gRockchipTokenSpaceGuid.PcdRtc8563Bus|0|UINT8|0x0200000E gRockchipTokenSpaceGuid.PcdRkSdmmcBaseAddress|0x0|UINT32|0x40000030 - gRockchipTokenSpaceGuid.PcdRkSdmmcCardDetectInverted|FALSE|BOOLEAN|0x40000031 + gRockchipTokenSpaceGuid.PcdRkSdmmcCardDetectBroken|FALSE|BOOLEAN|0x40000031 gRockchipTokenSpaceGuid.PcdDwcSdhciBaseAddress|0x0|UINT32|0x40000035 gRockchipTokenSpaceGuid.PcdDwcSdhciForceHighSpeed|FALSE|BOOLEAN|0x40000036