changeset 2137:314da12fc072

* include/hal_cache.h: Added support for ARM926EJ. Changed ARM925T to use CYGHWR_HAL_ARM_ARM9_ALT_CLEAN_CACHE and defined CYGHWR_HAL_ARM_ARM9_ALT_CLEAN_CACHE to clean the cache manually because CYGHWR_HAL_ARM_ARM9_CLEAN_CACHE did not work for the OMAP1510.
author asl
date Mon, 20 Feb 2006 13:40:03 +0000
parents 2d5143279e53
children b0b9630950c9
files packages/hal/arm/arm9/var/current/ChangeLog packages/hal/arm/arm9/var/current/cdl/hal_arm_arm9.cdl packages/hal/arm/arm9/var/current/include/hal_cache.h
diffstat 3 files changed, 73 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/arm/arm9/var/current/ChangeLog
+++ b/packages/hal/arm/arm9/var/current/ChangeLog
@@ -1,3 +1,13 @@
+2006-02-17  Tom Chase  <tchase@dtccom.com>
+
+	* include/hal_cache.h: Added support for ARM926EJ.  Changed
+	ARM925T to use CYGHWR_HAL_ARM_ARM9_ALT_CLEAN_CACHE and defined 
+	CYGHWR_HAL_ARM_ARM9_ALT_CLEAN_CACHE to clean the cache manually 
+	because CYGHWR_HAL_ARM_ARM9_CLEAN_CACHE did not work for the 
+	OMAP1510.
+
+	* cdl/hal_arm_arm9.cdl: Added option for ARM926EJ.
+
 2003-01-08  Patrick Doyle  <wpd@delcomsys.com>
 
 	* include/hal_cache.h: Changed HAL_ICACHE_LINE_SIZE and
--- a/packages/hal/arm/arm9/var/current/cdl/hal_arm_arm9.cdl
+++ b/packages/hal/arm/arm9/var/current/cdl/hal_arm_arm9.cdl
@@ -106,6 +106,17 @@ cdl_package CYGPKG_HAL_ARM_ARM9 {
             The ARM925T has 8k data cache, 16k instruction cache, 16 word
             write buffer and an MMU."
     }
+    
+    cdl_option CYGPKG_HAL_ARM_ARM9_ARM926EJ {
+        display       "ARM ARM926EJ microprocessor"
+        implements    CYGINT_HAL_ARM_ARM9_VARIANT
+        default_value 0
+        no_define
+        define        -file=system.h CYGPKG_HAL_ARM_ARM9_ARM926EJ
+        description "
+            The ARM926EJ has 16k data cache, 16k instruction cache, 16 word
+            write buffer and an MMU."
+    }
 
     cdl_option CYGPKG_HAL_ARM_ARM9_ARM940T {
         display       "ARM ARM940T microprocessor"
--- a/packages/hal/arm/arm9/var/current/include/hal_cache.h
+++ b/packages/hal/arm/arm9/var/current/include/hal_cache.h
@@ -46,7 +46,8 @@
 // Author(s):   gthomas
 // Contributors:hmt, jskov
 //              Travis C. Furrer <furrer@mit.edu>
-// Date:        2000-05-08
+//              Tom Chase        <tomc@dtccom.com>
+// Date:        2005-05-10
 // Purpose:     Cache control API
 // Description: The macros defined here provide the HAL APIs for handling
 //              cache control operations.
@@ -112,8 +113,23 @@
 # define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS))
 
 # define HAL_WRITE_BUFFER                64
+// must flush everything manually
+# define CYGHWR_HAL_ARM_ARM9_ALT_CLEAN_DCACHE 
 
-# define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE // has instruction to clean D-cache
+#elif defined(CYGPKG_HAL_ARM_ARM9_ARM926EJ)
+# define HAL_ICACHE_SIZE                 0x4000
+# define HAL_ICACHE_LINE_SIZE            32
+# define HAL_ICACHE_WAYS                 4
+# define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS))
+
+# define HAL_DCACHE_SIZE                 0x2000
+# define HAL_DCACHE_LINE_SIZE            32
+# define HAL_DCACHE_WAYS                 4
+# define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS))
+
+# define HAL_WRITE_BUFFER                64
+
+#define CYGHWR_HAL_ARM_ARM926EJ_CLEAN_DCACHE //has instruction to clean D-cache
 
 #elif defined(CYGPKG_HAL_ARM_ARM9_ARM940T)
 # define HAL_ICACHE_SIZE                 0x1000
@@ -369,6 +385,40 @@ CYG_MACRO_START                         
         : "r0" /* Clobber list */                                       \
         );                                                              \
 CYG_MACRO_END
+#elif defined(CYGHWR_HAL_ARM_ARM9_ALT_CLEAN_DCACHE)
+/*
+ * 'Clean & Invalidate whole DCache'
+  */
+#define HAL_DCACHE_SYNC()                                               \
+CYG_MACRO_START                                                         \
+    asm volatile (                                                      \
+	"mov	r0, #255 << 4;" /* 256 entries/set */ \
+        "2: "                    \
+	"mcr	p15, 0, r0, c7, c14, 2;" \
+	"subs	r0, r0, #1 << 4;" \
+	"bcs	2b;"		/* entries 255 to 0 */ \
+        "mcr    p15,0,r0,c7,c10,4;" /* drain the write buffer */        \
+        : \
+        : \
+        : "r0" /* Clobber list */                                       \
+        );                                                              \
+CYG_MACRO_END
+#elif defined(CYGHWR_HAL_ARM_ARM926EJ_CLEAN_DCACHE)
+/*
+ * 'Clean & Invalidate whole DCache'
+ */
+#define HAL_DCACHE_SYNC()                                               \
+CYG_MACRO_START                                                         \
+    asm volatile (                                                      \
+        "1: "                   /* clean & invalidate D index */ \
+	"mrc	p15, 0, r15, c7, c14, 3;" \
+	"bne    1b;" \
+        "mcr    p15,0,r0,c7,c10,4;" /* drain the write buffer */        \
+        : \
+        : \
+        : "r0" /* Clobber list */                                       \
+        );                                                              \
+CYG_MACRO_END
 #else
 # error "Don't know how to sync Dcache"
 #endif