Skip to content

Commit 189f1d9

Browse files
marcanUlf Hansson
authored andcommitted
mmc: sdhci-pci-gli: GL9755: Support for CD/WP inversion on OF platforms
This is required on some Apple ARM64 laptops using this controller. As is typical on DT platforms, pull these quirks from the device tree using the standard mmc bindings. See Documentation/devicetree/bindings/mmc/mmc-controller.yaml Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Hector Martin <marcan@marcan.st> Link: https://lore.kernel.org/r/20211215161045.38843-2-marcan@marcan.st Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 1ccaa1b commit 189f1d9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎drivers/mmc/host/sdhci-pci-gli.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/pci.h>
1313
#include <linux/mmc/mmc.h>
1414
#include <linux/delay.h>
15+
#include <linux/of.h>
1516
#include "sdhci.h"
1617
#include "sdhci-pci.h"
1718
#include "cqhci.h"
@@ -116,6 +117,8 @@
116117
#define PCI_GLI_9755_PECONF 0x44
117118
#define PCI_GLI_9755_LFCLK GENMASK(14, 12)
118119
#define PCI_GLI_9755_DMACLK BIT(29)
120+
#define PCI_GLI_9755_INVERT_CD BIT(30)
121+
#define PCI_GLI_9755_INVERT_WP BIT(31)
119122

120123
#define PCI_GLI_9755_CFG2 0x48
121124
#define PCI_GLI_9755_CFG2_L1DLY GENMASK(28, 24)
@@ -570,6 +573,14 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot)
570573
gl9755_wt_on(pdev);
571574

572575
pci_read_config_dword(pdev, PCI_GLI_9755_PECONF, &value);
576+
/*
577+
* Apple ARM64 platforms using these chips may have
578+
* inverted CD/WP detection.
579+
*/
580+
if (of_property_read_bool(pdev->dev.of_node, "cd-inverted"))
581+
value |= PCI_GLI_9755_INVERT_CD;
582+
if (of_property_read_bool(pdev->dev.of_node, "wp-inverted"))
583+
value |= PCI_GLI_9755_INVERT_WP;
573584
value &= ~PCI_GLI_9755_LFCLK;
574585
value &= ~PCI_GLI_9755_DMACLK;
575586
pci_write_config_dword(pdev, PCI_GLI_9755_PECONF, value);

0 commit comments

Comments
 (0)