This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
important strataflash fix
- From: jani at iv dot ro
- To: ecos-patches at sources dot redhat dot com
- Date: Fri, 2 May 2003 19:37:42 +0300
- Subject: important strataflash fix
Hi
While doing the cleanup patches which removed cache handling from low level
flash drivers I overlooked the fact that for flash_query the upper layer
only handles caches if dev_flash_query is called. Since strata had it's
own 'copy code to RAM and execute' it did not call flash_dev_query but I
stupidly removed the cache enabling and disabling.
So the cerfpda does not boot if flash support is enabled and a PXA with
strataflash I am working with has the same problem but edb7xxx works.
Here's a patch that converts strata to using flash_dev_query and fixes the
breakage.
/me goes to the blackboard and writes "If it ain't broken but you fix it
at least fix it right!" several times
Jani
Index: devs/flash/intel/strata//current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/strata/current/ChangeLog,v
retrieving revision 1.15
diff -u -r1.15 ChangeLog
--- devs/flash/intel/strata//current/ChangeLog 12 Apr 2003 05:09:45 -0000 1.15
+++ devs/flash/intel/strata//current/ChangeLog 2 May 2003 14:56:01 -0000
@@ -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:
Index: devs/flash/intel/strata//current/src/strata.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/strata/current/src/strata.c,v
retrieving revision 1.7
diff -u -r1.7 strata.c
--- devs/flash/intel/strata//current/src/strata.c 23 May 2002 23:01:02 -0000 1.7
+++ devs/flash/intel/strata//current/src/strata.c 2 May 2003 14:56:02 -0000
@@ -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 @@
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);
-
- // 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();
- }
+ int num_regions, region_size, buffer_size;
+ flash_dev_query(&data);
qp = &data;
if ( (qp->manuf_code == FLASH_Intel_code)
#ifdef CYGOPT_FLASH_IS_BOOTBLOCK
@@ -171,8 +148,8 @@
#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;
}