changeset 993:46540206b407

Cache fix - from Jani Monoses.
author gthomas
date Fri, 02 May 2003 16:35:23 +0000
parents 8f4717f85ff4
children 7e0dca248469
files packages/devs/flash/intel/strata/current/ChangeLog packages/devs/flash/intel/strata/current/src/strata.c
diffstat 2 files changed, 12 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/flash/intel/strata/current/ChangeLog
+++ b/packages/devs/flash/intel/strata/current/ChangeLog
@@ -1,3 +1,11 @@
+2003-05-02  Jani Monoses <jani@iv.ro>
+
+	* src/strata.c: Switch to using generic flash_query_dev.
+	The previous cache related changes broke flash_query for
+	Strata because in the query case the generic flash driver was not
+	called to handle the caches but the internal handling was removed
+	nevertheless.
+	
 2003-04-04  Jani Monoses <jani@iv.ro>
 	
 	* src/strata.h:
--- a/packages/devs/flash/intel/strata/current/src/strata.c
+++ b/packages/devs/flash/intel/strata/current/src/strata.c
@@ -53,7 +53,6 @@
 #include <pkgconf/system.h>
 #include <pkgconf/hal.h>
 #include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_cache.h>
 
 #define  _FLASH_PRIVATE_
 #include <cyg/io/flash.h>
@@ -71,31 +70,9 @@ int
 flash_hwr_init(void)
 {
     struct FLASH_query data, *qp;
-    extern char flash_query[], flash_query_end[];
-    typedef int code_fun(unsigned char *);
-    code_fun *_flash_query;
-    int code_len, stat, num_regions, region_size, buffer_size;
-    int icache_on, dcache_on;
-
-    HAL_DCACHE_IS_ENABLED(dcache_on);
-    HAL_ICACHE_IS_ENABLED(icache_on);
+    int num_regions, region_size, buffer_size;
 
-    // Copy 'program' code to RAM for execution
-    code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
-    _flash_query = (code_fun *)flash_info.work_space;
-    memcpy(_flash_query, &flash_query, code_len);
-    if (dcache_on) {
-        HAL_DCACHE_SYNC();  // Should guarantee this code will run
-    }
-    if (icache_on) {
-        HAL_ICACHE_DISABLE(); // is also required to avoid old contents
-    }
-
-    stat = (*_flash_query)((unsigned char *)&data);
-    if (icache_on) {
-        HAL_ICACHE_ENABLE();
-    }
-
+    flash_dev_query(&data);
     qp = &data;
     if ( (qp->manuf_code == FLASH_Intel_code)
 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
@@ -171,8 +148,8 @@ flash_hwr_init(void)
 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
  flash_type_unknown:
 #endif
-    (*flash_info.pf)("Can't identify FLASH, sorry, man %x, dev %x, id [%4s] stat %x\n",
-           qp->manuf_code, qp->device_code, qp->id, stat );
+    (*flash_info.pf)("Can't identify FLASH, sorry, man %x, dev %x, id [%4s] \n",
+           qp->manuf_code, qp->device_code, qp->id );
     diag_dump_buf(qp, sizeof(data));
     return FLASH_ERR_HWR;
 }