public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: disabled cache handling fix for sh4
@ 2009-10-16  1:20 Magnus Damm
  2009-10-16  5:39 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2009-10-16  1:20 UTC (permalink / raw)
  To: linux-sh

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 {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-16  5:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-16  1:20 [PATCH] sh: disabled cache handling fix for sh4 Magnus Damm
2009-10-16  5:39 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox