mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 15:02:32 +00:00
84 lines
2.7 KiB
Diff
84 lines
2.7 KiB
Diff
|
From 14a43b3fd43bf9b230f93d1eba276d40aac969ba Mon Sep 17 00:00:00 2001
|
||
|
From: Phil Elwell <phil@raspberrypi.com>
|
||
|
Date: Wed, 12 Oct 2022 14:07:32 +0100
|
||
|
Subject: [PATCH] mmc: sdhci-of-dwcmshc: rp1 sdio changes
|
||
|
|
||
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
||
|
---
|
||
|
drivers/mmc/host/sdhci-of-dwcmshc.c | 29 ++++++++++++++++++++++++++---
|
||
|
1 file changed, 26 insertions(+), 3 deletions(-)
|
||
|
|
||
|
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
|
||
|
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
|
||
|
@@ -87,6 +87,7 @@ struct rk35xx_priv {
|
||
|
|
||
|
struct dwcmshc_priv {
|
||
|
struct clk *bus_clk;
|
||
|
+ struct clk *sdio_clk;
|
||
|
int vendor_specific_area1; /* P_VENDOR_SPECIFIC_AREA reg */
|
||
|
void *priv; /* pointer to SoC private stuff */
|
||
|
};
|
||
|
@@ -114,6 +115,17 @@ static void dwcmshc_adma_write_desc(stru
|
||
|
sdhci_adma_write_desc(host, desc, addr, len, cmd);
|
||
|
}
|
||
|
|
||
|
+static void dwcmshc_set_clock(struct sdhci_host *host, unsigned int clock)
|
||
|
+{
|
||
|
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||
|
+ struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
|
||
|
+
|
||
|
+ if (priv->sdio_clk)
|
||
|
+ clk_set_rate(priv->sdio_clk, clock);
|
||
|
+
|
||
|
+ sdhci_set_clock(host, clock);
|
||
|
+}
|
||
|
+
|
||
|
static unsigned int dwcmshc_get_max_clock(struct sdhci_host *host)
|
||
|
{
|
||
|
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||
|
@@ -326,7 +338,7 @@ static void rk35xx_sdhci_reset(struct sd
|
||
|
}
|
||
|
|
||
|
static const struct sdhci_ops sdhci_dwcmshc_ops = {
|
||
|
- .set_clock = sdhci_set_clock,
|
||
|
+ .set_clock = dwcmshc_set_clock,
|
||
|
.set_bus_width = sdhci_set_bus_width,
|
||
|
.set_uhs_signaling = dwcmshc_set_uhs_signaling,
|
||
|
.get_max_clock = dwcmshc_get_max_clock,
|
||
|
@@ -346,8 +358,10 @@ static const struct sdhci_ops sdhci_dwcm
|
||
|
|
||
|
static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
|
||
|
.ops = &sdhci_dwcmshc_ops,
|
||
|
- .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
|
||
|
- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
|
||
|
+ .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
|
||
|
+ SDHCI_QUIRK_BROKEN_CARD_DETECTION,
|
||
|
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
|
||
|
+ SDHCI_QUIRK2_BROKEN_HS200,
|
||
|
};
|
||
|
|
||
|
#ifdef CONFIG_ACPI
|
||
|
@@ -499,6 +513,14 @@ static int dwcmshc_probe(struct platform
|
||
|
priv->bus_clk = devm_clk_get(dev, "bus");
|
||
|
if (!IS_ERR(priv->bus_clk))
|
||
|
clk_prepare_enable(priv->bus_clk);
|
||
|
+
|
||
|
+ pltfm_host->timeout_clk = devm_clk_get(dev, "timeout");
|
||
|
+ if (!IS_ERR(pltfm_host->timeout_clk))
|
||
|
+ err = clk_prepare_enable(pltfm_host->timeout_clk);
|
||
|
+ if (err)
|
||
|
+ goto free_pltfm;
|
||
|
+
|
||
|
+ priv->sdio_clk = devm_clk_get_optional(&pdev->dev, "sdio");
|
||
|
}
|
||
|
|
||
|
pltfm_host->timeout_clk = devm_clk_get(&pdev->dev, "timeout");
|
||
|
@@ -516,6 +538,7 @@ static int dwcmshc_probe(struct platform
|
||
|
goto err_clk;
|
||
|
|
||
|
sdhci_get_of_property(pdev);
|
||
|
+ sdhci_enable_v4_mode(host);
|
||
|
|
||
|
priv->vendor_specific_area1 =
|
||
|
sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK;
|