aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2016-12-25 20:11:34 +0100
committerJohn Crispin <john@phrozen.org>2017-08-05 08:46:36 +0200
commit74d00a8c3849c1340efd713eb94b786e304c201f (patch)
treede481743de61c34da96ab5f9dba3af3edcfb8260 /target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch
parentde350550ef648d9728351b986b0516fa29465c45 (diff)
downloadupstream-74d00a8c3849c1340efd713eb94b786e304c201f.tar.gz
upstream-74d00a8c3849c1340efd713eb94b786e304c201f.tar.bz2
upstream-74d00a8c3849c1340efd713eb94b786e304c201f.zip
kernel: split patches folder up into backport, pending and hack folders
* properly format/comment all patches * merge debloat patches * merge Kconfig patches * merge swconfig patches * merge hotplug patches * drop 200-fix_localversion.patch - upstream * drop 222-arm_zimage_none.patch - unused * drop 252-mv_cesa_depends.patch - no longer required * drop 410-mtd-move-forward-declaration-of-struct-mtd_info.patch - unused * drop 661-fq_codel_keep_dropped_stats.patch - outdated * drop 702-phy_add_aneg_done_function.patch - upstream * drop 840-rtc7301.patch - unused * drop 841-rtc_pt7c4338.patch - upstream * drop 921-use_preinit_as_init.patch - unused * drop spio-gpio-old and gpio-mmc - unused Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch')
-rw-r--r--target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch b/target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch
new file mode 100644
index 0000000000..c2f2d21d03
--- /dev/null
+++ b/target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch
@@ -0,0 +1,59 @@
+From 64ad46379fcf14f437553f654d1adcd3d0e0d7f9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Mon, 15 Aug 2016 14:21:28 +0200
+Subject: [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for BCM53573
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and uses
+this old ChipCommon-based flash access. Early tests resulted in flash
+corruptions that were tracked down to using cached MMIO for flash read
+access. Switch to ioremap_nocache conditionally to support BCM53573 and
+don't break performance on old MIPS devices.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+ drivers/mtd/devices/bcm47xxsflash.c | 24 +++++++++++++++++++-----
+ 1 file changed, 19 insertions(+), 5 deletions(-)
+
+--- a/drivers/mtd/devices/bcm47xxsflash.c
++++ b/drivers/mtd/devices/bcm47xxsflash.c
+@@ -296,16 +296,30 @@ static int bcm47xxsflash_bcma_probe(stru
+ dev_err(dev, "can't request region for resource %pR\n", res);
+ return -EBUSY;
+ }
+- b47s->window = ioremap_cache(res->start, resource_size(res));
+- if (!b47s->window) {
+- dev_err(dev, "ioremap failed for resource %pR\n", res);
+- return -ENOMEM;
+- }
+
+ b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash);
+ b47s->cc_read = bcm47xxsflash_bcma_cc_read;
+ b47s->cc_write = bcm47xxsflash_bcma_cc_write;
+
++ /*
++ * On old MIPS devices cache was magically invalidated when needed,
++ * allowing us to use cached access and gain some performance. Trying
++ * the same on ARM based BCM53573 results in flash corruptions, we need
++ * to use uncached access for it.
++ *
++ * It may be arch specific, but right now there is only 1 ARM SoC using
++ * this driver, so let's follow Broadcom's reference code and check
++ * ChipCommon revision.
++ */
++ if (b47s->bcma_cc->core->id.rev == 54)
++ b47s->window = ioremap_nocache(res->start, resource_size(res));
++ else
++ b47s->window = ioremap_cache(res->start, resource_size(res));
++ if (!b47s->window) {
++ dev_err(dev, "ioremap failed for resource %pR\n", res);
++ return -ENOMEM;
++ }
++
+ switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ case BCMA_CC_FLASHT_STSER:
+ b47s->type = BCM47XXSFLASH_TYPE_ST;