public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: disabled cache handling fix for sh4
Date: Fri, 16 Oct 2009 01:20:06 +0000	[thread overview]
Message-ID: <20091016012006.20892.67821.sendpatchset@rxone.opensource.se> (raw)

From: Magnus Damm <damm@opensource.se>

Add code to handle the cache disabled case for sh4. Fixes breakage
introduced by 37443ef3f0406e855e169c87ae3f4ffb4b6ff635. Without
this patch configuring caches off with CONFIG_CACHE_OFF=y makes
kfr2r09 and migo-r lock up in fbdev deferred io or early user space.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 2.6.32 material

 arch/sh/mm/cache-sh4.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index a98c7d8..c1615d8 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -709,6 +709,7 @@ extern void __weak sh4__flush_region_init(void);
  */
 void __init sh4_cache_init(void)
 {
+	unsigned int cache_enabled = !!(__raw_readl(CCR) & CCR_CACHE_ENABLE);
 	unsigned int wt_enabled = !!(__raw_readl(CCR) & CCR_CACHE_WT);
 
 	printk("PVR=%08x CVR=%08x PRR=%08x\n",
@@ -716,6 +717,17 @@ void __init sh4_cache_init(void)
 		ctrl_inl(CCN_CVR),
 		ctrl_inl(CCN_PRR));
 
+	/* disabled cache handling:
+	 *
+	 * __flush_dcache_segment_fn() implementations in this file make use
+	 * of the movca instruction which bombs out if caches are disabled.
+	 *
+	 * no flushing is necessary in the disabled cache case so we can
+	 * just keep the noop functions in local_flush_..() and __flush_..()
+	 */
+	if (!cache_enabled)
+		return;
+
 	if (wt_enabled)
 		__flush_dcache_segment_fn = __flush_dcache_segment_writethrough;
 	else {

             reply	other threads:[~2009-10-16  1:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16  1:20 Magnus Damm [this message]
2009-10-16  5:39 ` [PATCH] sh: disabled cache handling fix for sh4 Paul Mundt

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=20091016012006.20892.67821.sendpatchset@rxone.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=linux-sh@vger.kernel.org \
    /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