All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-xenon: Fix 2G limitation on AC5 SoC
@ 2022-07-26 17:07 Vadym Kochan
  2022-07-26 17:37 ` Florian Fainelli
  0 siblings, 1 reply; 24+ messages in thread
From: Vadym Kochan @ 2022-07-26 17:07 UTC (permalink / raw)
  To: Hu Ziji, Adrian Hunter, Ulf Hansson, linux-mmc, linux-kernel
  Cc: Elad Nachman, Vadym Kochan

From: Elad Nachman <enachman@marvell.com>

There is a limitation on AC5 SoC that mmc controller
can't have DMA access over 2G memory.

Signed-off-by: Elad Nachman <enachman@marvell.com>
Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu>
---
 drivers/mmc/host/sdhci-xenon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
index 08e838400b52..666d06b58564 100644
--- a/drivers/mmc/host/sdhci-xenon.c
+++ b/drivers/mmc/host/sdhci-xenon.c
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
+#include <linux/mm.h>
 
 #include "sdhci-pltfm.h"
 #include "sdhci-xenon.h"
@@ -422,6 +423,8 @@ static int xenon_probe_params(struct platform_device *pdev)
 	struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
 	u32 sdhc_id, nr_sdhc;
 	u32 tuning_count;
+	struct device_node *np = pdev->dev.of_node;
+	struct sysinfo si;
 
 	/* Disable HS200 on Armada AP806 */
 	if (priv->hw_version == XENON_AP806)
@@ -450,6 +453,15 @@ static int xenon_probe_params(struct platform_device *pdev)
 	}
 	priv->tuning_count = tuning_count;
 
+	si_meminfo(&si);
+
+	if (of_device_is_compatible(np, "marvell,ac5-sdhci") &&
+	    ((si.totalram * si.mem_unit) > 0x80000000 /*2G*/)) {
+		host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
+		host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
+		dev_info(mmc_dev(mmc), "Disabling DMA because of 2GB DMA access limit.\n");
+	}
+
 	return xenon_phy_parse_params(dev, host);
 }
 
@@ -682,6 +694,7 @@ static const struct of_device_id sdhci_xenon_dt_ids[] = {
 	{ .compatible = "marvell,armada-ap807-sdhci", .data = (void *)XENON_AP807},
 	{ .compatible = "marvell,armada-cp110-sdhci", .data =  (void *)XENON_CP110},
 	{ .compatible = "marvell,armada-3700-sdhci", .data =  (void *)XENON_A3700},
+	{ .compatible = "marvell,ac5-sdhci", .data = (void *)XENON_AP806},
 	{}
 };
 MODULE_DEVICE_TABLE(of, sdhci_xenon_dt_ids);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-11-09  9:29 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 17:07 [PATCH] mmc: sdhci-xenon: Fix 2G limitation on AC5 SoC Vadym Kochan
2022-07-26 17:37 ` Florian Fainelli
2022-07-27 16:45   ` Vadym Kochan
2022-08-01  9:30     ` Vadym Kochan
2022-08-08  9:19       ` Adrian Hunter
2022-08-08  9:52         ` Vadym Kochan
2022-08-08 10:29           ` Vadym Kochan
2022-08-08 11:40           ` Adrian Hunter
2022-08-08 12:26             ` Vadym Kochan
2022-08-08 12:58               ` Adrian Hunter
2022-08-08 14:06                 ` Robin Murphy
2022-08-16 20:51                   ` Vadym Kochan
2022-08-17 13:43                     ` Robin Murphy
2022-08-17 16:07                       ` Vadym Kochan
2022-08-17 17:23                         ` Robin Murphy
2022-08-18 12:07                           ` Vadym Kochan
2022-08-21  6:17                             ` Christoph Hellwig
2022-08-22 10:06                               ` Robin Murphy
2022-09-06  9:22                                 ` Vadym Kochan
2022-10-13  6:40                                 ` Vadym Kochan
2022-11-08 19:05                                   ` Vadym Kochan
2022-11-09  7:50                                     ` Adrian Hunter
2022-11-09  8:40                                       ` Vadym Kochan
2022-11-09  9:29                                         ` Adrian Hunter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.