diff mbox

sh: disabled cache handling fix for sh4

Message ID 20091016012006.20892.67821.sendpatchset@rxone.opensource.se (mailing list archive)
State Accepted
Headers show

Commit Message

Magnus Damm Oct. 16, 2009, 1:20 a.m. UTC
None
diff mbox

Patch

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 {