mmc: sdhci-pci-gli: Enable short circuit protection mechanism of GL9755
authorRenius Chen <reniuschengl@gmail.com>
Thu, 25 Feb 2021 11:13:07 +0000 (19:13 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 30 Mar 2021 09:42:00 +0000 (11:42 +0200)
Short circuit protection mechanism of GL9755 is disabled by HW default
setting. Enable short circuit protection to prevent GL9755 from being
damaged by short circuit or over current.

Signed-off-by: Renius Chen <reniuschengl@gmail.com>
Link: https://lore.kernel.org/r/20210225111307.62975-1-reniuschengl@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-pci-gli.c

index 4a0f69b97a78f86bd302430d46c014d25986b166..fd0939355584adff896c6f31ac7488f00934e9e1 100644 (file)
 #define PCI_GLI_9755_PLLSSC        0x68
 #define   PCI_GLI_9755_PLLSSC_PPM    GENMASK(15, 0)
 
+#define PCI_GLI_9755_SerDes  0x70
+#define PCI_GLI_9755_SCP_DIS   BIT(19)
+
 #define GLI_MAX_TUNING_LOOP 40
 
 /* Genesys Logic chipset */
@@ -547,6 +550,11 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot)
        value &= ~PCI_GLI_9755_DMACLK;
        pci_write_config_dword(pdev, PCI_GLI_9755_PECONF, value);
 
+       /* enable short circuit protection */
+       pci_read_config_dword(pdev, PCI_GLI_9755_SerDes, &value);
+       value &= ~PCI_GLI_9755_SCP_DIS;
+       pci_write_config_dword(pdev, PCI_GLI_9755_SerDes, value);
+
        gl9755_wt_off(pdev);
 }