From 5291dbd5db1928242f4de75bce204dcf7ea7a746 Mon Sep 17 00:00:00 2001
From: Josef Schlehofer <josef.schlehofer@nic.cz>
Date: Thu, 4 Aug 2022 16:38:40 +0200
Subject: [PATCH] patches/openwrt: drop patch to fix kernel not locate root FS
 on microSD

This patch was necessary only on OpenWrt 19.07, because the kernel
config CONFIG_OF_DMA_DEFAULT_COHERENT was disabled, but it should be
enabled by default [1] [2].

I can see that in OpenWrt 21.02 and newer versions the config is already
enabled, thus patch is no longer needed:

root@turris:/# zcat /proc/config.gz | grep CONFIG_OF_DMA_DEFAULT_COHERENT
CONFIG_OF_DMA_DEFAULT_COHERENT=y

[1] https://elixir.bootlin.com/linux/v5.18.2/source/drivers/of/address.c#L1055
[2] https://elixir.bootlin.com/linux/v5.18.2/source/arch/powerpc/Kconfig#L261
---
 ...85xx-revert-kernel-patch-that-breaks.patch | 93 -------------------
 1 file changed, 93 deletions(-)
 delete mode 100644 patches/openwrt/to-upstream/0025-target-linux-mpc85xx-revert-kernel-patch-that-breaks.patch

diff --git a/patches/openwrt/to-upstream/0025-target-linux-mpc85xx-revert-kernel-patch-that-breaks.patch b/patches/openwrt/to-upstream/0025-target-linux-mpc85xx-revert-kernel-patch-that-breaks.patch
deleted file mode 100644
index b29c7b75e..000000000
--- a/patches/openwrt/to-upstream/0025-target-linux-mpc85xx-revert-kernel-patch-that-breaks.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From dbff59c613d7e5c1025339284e1a54bd787bd1bb Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= <karel.koci@nic.cz>
-Date: Tue, 19 Nov 2019 17:48:24 +0100
-Subject: [PATCH] target/linux/mpc85xx: revert kernel patch that breaks MMC
- access
-
-This patch causes boot to not proceed because kernel won't locate FS on
-MMC. MMC it self is correctly detected but it might not be readable by
-kernel with this patch. Instead kernel panics.
-
-Second patch causes timeouts on SD card access.
----
- ...-of-esdhc-set-DMA-snooping-based-on-.patch | 32 +++++++++++++++++++
- ...i-of-esdhc-fix-P2020-errata-handling.patch | 28 ++++++++++++++++
- 2 files changed, 60 insertions(+)
- create mode 100644 target/linux/mpc85xx/patches-5.4/901-Revert-mmc-sdhci-of-esdhc-set-DMA-snooping-based-on-.patch
- create mode 100644 target/linux/mpc85xx/patches-5.4/902-Revert-mmc-sdhci-of-esdhc-fix-P2020-errata-handling.patch
-
-diff --git a/target/linux/mpc85xx/patches-5.4/901-Revert-mmc-sdhci-of-esdhc-set-DMA-snooping-based-on-.patch b/target/linux/mpc85xx/patches-5.4/901-Revert-mmc-sdhci-of-esdhc-set-DMA-snooping-based-on-.patch
-new file mode 100644
-index 0000000..ca41d11
---- /dev/null
-+++ b/target/linux/mpc85xx/patches-5.4/901-Revert-mmc-sdhci-of-esdhc-set-DMA-snooping-based-on-.patch
-@@ -0,0 +1,32 @@
-+From 429cffc87a35214f415f8f0b37d9933b745fa9cb Mon Sep 17 00:00:00 2001
-+From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= <karel.koci@nic.cz>
-+Date: Tue, 19 Nov 2019 16:47:06 +0100
-+Subject: [PATCH 2/2] Revert "mmc: sdhci-of-esdhc: set DMA snooping based on
-+ DMA coherence"
-+
-+This reverts commit 6475db6c42a408c5c0a52dbdb8494310c48ed2d3.
-+---
-+ drivers/mmc/host/sdhci-of-esdhc.c | 7 +------
-+ 1 file changed, 1 insertion(+), 6 deletions(-)
-+
-+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
-+index 176cbc67d08a..bcfa84aa2113 100644
-+--- a/drivers/mmc/host/sdhci-of-esdhc.c
-++++ b/drivers/mmc/host/sdhci-of-esdhc.c
-+@@ -435,12 +435,7 @@ static int esdhc_of_enable_dma(struct sdhci_host *host)
-+ 		dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
-+ 
-+ 	value = sdhci_readl(host, ESDHC_DMA_SYSCTL);
-+-
-+-	if (of_dma_is_coherent(dev->of_node))
-+-		value |= ESDHC_DMA_SNOOP;
-+-	else
-+-		value &= ~ESDHC_DMA_SNOOP;
-+-
-++	value |= ESDHC_DMA_SNOOP;
-+ 	sdhci_writel(host, value, ESDHC_DMA_SYSCTL);
-+ 	return 0;
-+ }
-+-- 
-+2.24.0
-+
-diff --git a/target/linux/mpc85xx/patches-5.4/902-Revert-mmc-sdhci-of-esdhc-fix-P2020-errata-handling.patch b/target/linux/mpc85xx/patches-5.4/902-Revert-mmc-sdhci-of-esdhc-fix-P2020-errata-handling.patch
-new file mode 100644
-index 0000000..6588838
---- /dev/null
-+++ b/target/linux/mpc85xx/patches-5.4/902-Revert-mmc-sdhci-of-esdhc-fix-P2020-errata-handling.patch
-@@ -0,0 +1,28 @@
-+From 3fba5ddea116f401caf88443181a7f640a05655a Mon Sep 17 00:00:00 2001
-+From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= <karel.koci@nic.cz>
-+Date: Tue, 14 Jan 2020 10:50:11 +0100
-+Subject: [PATCH] Revert "mmc: sdhci-of-esdhc: fix P2020 errata handling"
-+
-+This reverts commit 5a07ace7375231e6eb79667a2784c0bf023f87da.
-+---
-+ drivers/mmc/host/sdhci-of-esdhc.c | 4 ++--
-+ 1 file changed, 2 insertions(+), 2 deletions(-)
-+
-+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
-+index 9a1ab39ee35e..bf8d02a996b6 100644
-+--- a/drivers/mmc/host/sdhci-of-esdhc.c
-++++ b/drivers/mmc/host/sdhci-of-esdhc.c
-+@@ -886,8 +886,8 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
-+ 		host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ;
-+ 
-+ 	if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) {
-+-		host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST;
-+-		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
-++		host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST;
-++		host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
-+ 	}
-+ 
-+ 	if (of_device_is_compatible(np, "fsl,p5040-esdhc") ||
-+-- 
-+2.25.0
-+
--- 
-2.25.0
-
-- 
GitLab