devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Cernekee <cernekee@gmail.com>
To: ralf@linux-mips.org
Cc: f.fainelli@gmail.com, jfraser@broadcom.com, dtor@chromium.org,
	tglx@linutronix.de, jason@lakedaemon.net, jogo@openwrt.org,
	arnd@arndb.de, computersforpeace@gmail.com,
	linux-mips@linux-mips.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH V4 13/16] MIPS: BMIPS: Flush the readahead cache after DMA
Date: Thu, 27 Nov 2014 20:32:19 -0800	[thread overview]
Message-ID: <1417149142-3756-14-git-send-email-cernekee@gmail.com> (raw)
In-Reply-To: <1417149142-3756-1-git-send-email-cernekee@gmail.com>

BMIPS 3300/435x/438x CPUs have a readahead cache that is separate from
the L1/L2.  During a DMA operation, accesses adjacent to a DMA buffer
may cause parts of the DMA buffer to be prefetched into the RAC.  To
avoid possible coherency problems, flush the RAC upon DMA completion.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
 arch/mips/mm/dma-default.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index af5f046e627e..ee6d12cb7588 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -18,6 +18,7 @@
 #include <linux/highmem.h>
 #include <linux/dma-contiguous.h>
 
+#include <asm/bmips.h>
 #include <asm/cache.h>
 #include <asm/cpu-type.h>
 #include <asm/io.h>
@@ -69,6 +70,18 @@ static inline struct page *dma_addr_to_page(struct device *dev,
  */
 static inline int cpu_needs_post_dma_flush(struct device *dev)
 {
+	if (boot_cpu_type() == CPU_BMIPS3300 ||
+	    boot_cpu_type() == CPU_BMIPS4350 ||
+	    boot_cpu_type() == CPU_BMIPS4380) {
+		void __iomem *cbr = BMIPS_GET_CBR();
+
+		/* Flush stale data out of the readahead cache */
+		__raw_writel(0x100, cbr + BMIPS_RAC_CONFIG);
+		__raw_readl(cbr + BMIPS_RAC_CONFIG);
+
+		return 0;
+	}
+
 	return !plat_device_is_coherent(dev) &&
 	       (boot_cpu_type() == CPU_R10000 ||
 		boot_cpu_type() == CPU_R12000 ||
-- 
2.1.0

  parent reply	other threads:[~2014-11-28  4:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  4:32 [PATCH V4 00/16] Generic BMIPS kernel Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 01/16] irqchip: Update docs regarding irq_domain_add_tree() Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 02/16] irqchip: brcmstb-l2: don't clear wakeable interrupts at init time Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 03/16] irqchip: brcmstb-l2: fix error handling of irq_of_parse_and_map Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 04/16] irqchip: bcm7120-l2: " Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 05/16] irqchip: bcm7120-l2: Refactor driver for arbitrary IRQEN/IRQSTAT offsets Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 06/16] irqchip: bcm7120-l2: Split STB-specific logic into its own function Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 07/16] irqchip: bcm7120-l2: Add support for BCM3380-style controllers Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 08/16] irqchip: Add new driver for BCM7038-style level 1 interrupt controllers Kevin Cernekee
2014-12-01 16:09   ` Jonas Gorski
     [not found]     ` <CAOiHx=nb4Ub_bseHUrz+HrnJxDEKMijQ=r+ASZ-p5MtTi81Big-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-01 17:39       ` Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 09/16] MIPS: Let __dt_register_buses accept a single bus type Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 10/16] MIPS: Fall back to the generic restart notifier Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 11/16] MIPS: Reorder MIPS_L1_CACHE_SHIFT priorities Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 12/16] MIPS: Create a common <asm/mach-generic/war.h> Kevin Cernekee
2014-11-28  4:32 ` Kevin Cernekee [this message]
2014-11-28  4:32 ` [PATCH V4 14/16] MIPS: BMIPS: Document the firmware->kernel DTB interface Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 15/16] MIPS: Add Generic BMIPS target Kevin Cernekee
2014-11-28  4:32 ` [PATCH V4 16/16] MIPS: BMIPS: Add DTS files for several platforms Kevin Cernekee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1417149142-3756-14-git-send-email-cernekee@gmail.com \
    --to=cernekee@gmail.com \
    --cc=arnd@arndb.de \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dtor@chromium.org \
    --cc=f.fainelli@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=jfraser@broadcom.com \
    --cc=jogo@openwrt.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).