diff mbox series

[FSL,P5020,P5040,PPC] Onboard SD card doesn't work anymore after the 'mmc-v5.4-2' updates

Message ID a9ab8946-c599-5f83-7527-2387a9e82e8a@xenosoft.de
State New
Headers show
Series [FSL,P5020,P5040,PPC] Onboard SD card doesn't work anymore after the 'mmc-v5.4-2' updates | expand

Commit Message

Christian Zigotzky Jan. 16, 2020, 11:05 a.m. UTC
Hi All,

We still need the attached patch for our onboard SD card interface 
[1,2]. Could you please add this patch to the tree?

Thanks,
Christian

[1] https://www.spinics.net/lists/linux-mmc/msg56211.html
[2] 
http://forum.hyperion-entertainment.com/viewtopic.php?f=58&t=4349&start=20#p49012
diff mbox series

Patch

diff -rupN a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
--- a/arch/powerpc/kernel/setup-common.c	2019-12-03 18:05:52.436070217 +0100
+++ b/arch/powerpc/kernel/setup-common.c	2019-12-03 18:03:20.316629696 +0100
@@ -780,6 +780,22 @@  static int __init check_cache_coherency(
 late_initcall(check_cache_coherency);
 #endif /* CONFIG_CHECK_CACHE_COHERENCY */
 
+#ifndef CONFIG_NOT_COHERENT_CACHE
+/*
+ * For historical reasons powerpc kernels are built with hard wired knowledge of
+ * whether or not DMA accesses are cache coherent. Additionally device trees on
+ * powerpc do not typically support the dma-coherent property.
+ *
+ * So when we know that DMA is coherent, override arch_of_dma_is_coherent() to
+ * tell the drivers/of code that all devices are coherent regardless of whether
+ * they have a dma-coherent property.
+ */
+bool arch_of_dma_is_coherent(struct device_node *np)
+{
+	return true;
+}
+#endif
+
 #ifdef CONFIG_DEBUG_FS
 struct dentry *powerpc_debugfs_root;
 EXPORT_SYMBOL(powerpc_debugfs_root);
diff -rupN a/drivers/of/address.c b/drivers/of/address.c
--- a/drivers/of/address.c	2019-12-03 18:05:57.332052212 +0100
+++ b/drivers/of/address.c	2019-12-03 18:03:20.320629681 +0100
@@ -990,6 +990,14 @@  out:
 	return ret;
 }
 
+/*
+ * arch_of_dma_is_coherent - Arch hook to determine if device is coherent for DMA
+ */
+bool __weak arch_of_dma_is_coherent(struct device_node *np)
+{
+	return false;
+}
+
 /**
  * of_dma_is_coherent - Check if device is coherent
  * @np:	device node
@@ -999,8 +1007,12 @@  out:
  */
 bool of_dma_is_coherent(struct device_node *np)
 {
-	struct device_node *node = of_node_get(np);
+	struct device_node *node;
+
+	if (arch_of_dma_is_coherent(np))
+		return true;
 
+	np = of_node_get(np);
 	while (node) {
 		if (of_property_read_bool(node, "dma-coherent")) {
 			of_node_put(node);