This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Strata flash with sequential chips


Hi,

The Strata flash driver doesn't handle flash regions consisting of more than one sequential chip. Plenty of places read and write (mostly status related stuff) from address 0, which might a different chip than the one we're interested in.

I've attached a patch which (I think) corrects flash_program_buf() as an example. It seems erasing, locking, and unlocking have similar problems.

Unfortunaly, I cannot test anything (the board I have requires flash stuff from our working tree which is too far removed from upstream) so I've not fixed up everything.

David Vrabel
--
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/
Index: devs/flash/intel/strata/current/ChangeLog
===================================================================
RCS file: /var/cvs/ecos/packages/devs/flash/intel/strata/current/ChangeLog,v
retrieving revision 1.1.1.5
diff -u -B -p -r1.1.1.5 ChangeLog
--- devs/flash/intel/strata/current/ChangeLog	14 Oct 2004 10:53:58 -0000	1.1.1.5
+++ devs/flash/intel/strata/current/ChangeLog	14 Jan 2005 14:42:01 -0000
@@ -1,3 +1,8 @@
+2005-01-14  David Vrabel  <dvrabel@arcom.com>
+
+	* src/flash_program_buf.c (flash_program_buf): Read status from
+	block address not 0 (which might be on a different chip).
+
 2004-09-02  Mark Salter  <msalter@redhat.com>
 
 	* src/flash_query.c (CYGHWR_FLASH_READ_QUERY): Add platform hook
Index: devs/flash/intel/strata/current/src/flash_program_buf.c
===================================================================
RCS file: /var/cvs/ecos/packages/devs/flash/intel/strata/current/src/flash_program_buf.c,v
retrieving revision 1.1.1.3
diff -u -B -p -r1.1.1.3 flash_program_buf.c
--- devs/flash/intel/strata/current/src/flash_program_buf.c	14 Oct 2004 10:53:58 -0000	1.1.1.3
+++ devs/flash/intel/strata/current/src/flash_program_buf.c	14 Jan 2005 14:42:01 -0000
@@ -68,7 +68,6 @@ int
 flash_program_buf(volatile flash_t *addr, flash_t *data, int len,
                   unsigned long block_mask, int buffer_size)
 {
-    volatile flash_t *ROM;
     volatile flash_t *BA;
     flash_t stat = 0;
     int timeout = 50000;
@@ -77,11 +76,10 @@ flash_program_buf(volatile flash_t *addr
 #endif
 
     // Get base address and map addresses to virtual addresses
-    ROM = FLASH_P2V( CYGNUM_FLASH_BASE_MASK & (unsigned int)addr );
     BA = addr = FLASH_P2V(addr);
 
     // Clear any error conditions
-    ROM[0] = FLASH_Clear_Status;
+    *BA = FLASH_Clear_Status;
 
 #ifdef FLASH_Write_Buffer
     // Write any big chunks first
@@ -93,7 +91,7 @@ flash_program_buf(volatile flash_t *addr
         wc = wc / sizeof(flash_t);  // Word count
         *BA = FLASH_Write_Buffer;
         timeout = 5000000;
-        while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
+        while(((stat = *BA) & FLASH_Status_Ready) != FLASH_Status_Ready) {
             if (--timeout == 0) {
                 goto bad;
             }
@@ -109,9 +107,9 @@ flash_program_buf(volatile flash_t *addr
         }
         *BA = FLASH_Confirm;
     
-        ROM[0] = FLASH_Read_Status;
+        *BA = FLASH_Read_Status;
         timeout = 5000000;
-        while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
+        while(((stat = *BA) & FLASH_Status_Ready) != FLASH_Status_Ready) {
             if (--timeout == 0) {
                 goto bad;
             }

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]