Skip to contentSkip to conversation

sh: disabled cache handling fix for sh4

PATCH In review Magnus Damm 2 participants 2 messages Oct 16, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: disabled cache handling fix for sh4

From: Magnus Damm <[email protected]>

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.

---

2.6.32 material

 arch/sh/mm/cache-sh4.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/sh/mm/cache-sh4.c +12 -0
index a98c7d8..c1615d8 100644
@@ -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 {
#1 lore raw
Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

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.

Applied after moving it to cache.c and some tidying.