bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-0860-sdhci-Add-SD-Express-hook.patch
1 From 9564939f1a92e5f9807461539de28c50e5bee440 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Tue, 6 Jul 2021 09:45:36 +0100
4 Subject: [PATCH] sdhci: Add SD Express hook
5
6 sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR speeds at 1.8v.
7 ---
8 drivers/mmc/host/sdhci-of-dwcmshc.c | 5 ++++-
9 drivers/mmc/host/sdhci.c | 19 +++++++++++++++++++
10 drivers/mmc/host/sdhci.h | 6 ++++++
11 3 files changed, 29 insertions(+), 1 deletion(-)
12
13 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
14 +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
15 @@ -363,7 +363,10 @@ static const struct sdhci_pltfm_data sdh
16 .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
17 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
18 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
19 - SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
20 + SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN |
21 + SDHCI_QUIRK2_NO_SDR50 |
22 + SDHCI_QUIRK2_NO_SDR104 |
23 + SDHCI_QUIRK2_NO_SDR25,
24 };
25
26 static int dwcmshc_rk35xx_init(struct sdhci_host *host, struct dwcmshc_priv *dwc_priv)
27 --- a/drivers/mmc/host/sdhci.c
28 +++ b/drivers/mmc/host/sdhci.c
29 @@ -3071,6 +3071,15 @@ static void sdhci_card_event(struct mmc_
30 spin_unlock_irqrestore(&host->lock, flags);
31 }
32
33 +static int sdhci_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios)
34 +{
35 + struct sdhci_host *host = mmc_priv(mmc);
36 +
37 + if (!host->ops->init_sd_express)
38 + return -EOPNOTSUPP;
39 + return host->ops->init_sd_express(host, ios);
40 +}
41 +
42 static const struct mmc_host_ops sdhci_ops = {
43 .request = sdhci_request,
44 .post_req = sdhci_post_req,
45 @@ -3086,6 +3095,7 @@ static const struct mmc_host_ops sdhci_o
46 .execute_tuning = sdhci_execute_tuning,
47 .card_event = sdhci_card_event,
48 .card_busy = sdhci_card_busy,
49 + .init_sd_express = sdhci_init_sd_express,
50 };
51
52 /*****************************************************************************\
53 @@ -4605,6 +4615,15 @@ int sdhci_setup_host(struct sdhci_host *
54 !(host->quirks2 & SDHCI_QUIRK2_BROKEN_DDR50))
55 mmc->caps |= MMC_CAP_UHS_DDR50;
56
57 + if (host->quirks2 & SDHCI_QUIRK2_NO_SDR25)
58 + mmc->caps &= ~MMC_CAP_UHS_SDR25;
59 +
60 + if (host->quirks2 & SDHCI_QUIRK2_NO_SDR50)
61 + mmc->caps &= ~MMC_CAP_UHS_SDR50;
62 +
63 + if (host->quirks2 & SDHCI_QUIRK2_NO_SDR104)
64 + mmc->caps &= ~MMC_CAP_UHS_SDR104;
65 +
66 /* Does the host need tuning for SDR50? */
67 if (host->caps1 & SDHCI_USE_SDR50_TUNING)
68 host->flags |= SDHCI_SDR50_NEEDS_TUNING;
69 --- a/drivers/mmc/host/sdhci.h
70 +++ b/drivers/mmc/host/sdhci.h
71 @@ -481,6 +481,11 @@ struct sdhci_host {
72 /* Issue CMD and DATA reset together */
73 #define SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER (1<<19)
74
75 +/* Quirks to ignore a speed if a that speed is unreliable */
76 +#define SDHCI_QUIRK2_NO_SDR25 (1<<19)
77 +#define SDHCI_QUIRK2_NO_SDR50 (1<<20)
78 +#define SDHCI_QUIRK2_NO_SDR104 (1<<21)
79 +
80 int irq; /* Device IRQ */
81 void __iomem *ioaddr; /* Mapped address */
82 phys_addr_t mapbase; /* physical address base */
83 @@ -663,6 +668,7 @@ struct sdhci_ops {
84 void (*request_done)(struct sdhci_host *host,
85 struct mmc_request *mrq);
86 void (*dump_vendor_regs)(struct sdhci_host *host);
87 + int (*init_sd_express)(struct sdhci_host *host, struct mmc_ios *ios);
88 };
89
90 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS