This is the mail archive of the ecos-patches@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]

Support for synchronous strataflash.


I just checked this in to add support for K-series strataflash which
support unlocking of individual blocks.

--Mark


Index: devs/flash/intel/strata/current/ChangeLog
===================================================================
RCS file: /home/cvs/ecc/ecc/devs/flash/intel/strata/current/ChangeLog,v
retrieving revision 1.23
diff -u -p -5 -r1.23 ChangeLog
--- devs/flash/intel/strata/current/ChangeLog	2002/05/21 21:07:04	1.23
+++ devs/flash/intel/strata/current/ChangeLog	2002/08/12 11:56:02
@@ -1,5 +1,10 @@
+2002-08-12  Mark Salter  <msalter@redhat.com>
+
+	* src/flash_unlock_block.c: Add synchronous strataflash support.
+	* src/strata.h: Add comments regarding synchronous strataflash.
+
 2002-04-30  Christoph Csebits  <christoph.csebits@frequentis.com>
 
 	* src/flash_unlock_block.c: Getting the current block lock
 	state for flashes in 8-Bit mode is now working correctly.
 
Index: devs/flash/intel/strata/current/src/flash_unlock_block.c
===================================================================
RCS file: /home/cvs/ecc/ecc/devs/flash/intel/strata/current/src/flash_unlock_block.c,v
retrieving revision 1.4
diff -u -p -5 -r1.4 flash_unlock_block.c
--- devs/flash/intel/strata/current/src/flash_unlock_block.c	2002/05/21 21:07:05	1.4
+++ devs/flash/intel/strata/current/src/flash_unlock_block.c	2002/08/12 11:56:02
@@ -70,15 +70,19 @@
 #define MAX_FLASH_BLOCKS 128
 
 int
 flash_unlock_block(volatile flash_t *block, int block_size, int blocks)
 {
-    volatile flash_t *ROM, *bp, *bpv;
+    volatile flash_t *ROM;
     flash_t stat;
     int timeout = 5000000;
+    int cache_on;
+#ifndef CYGOPT_FLASH_IS_SYNCHRONOUS
+    int i;
+    volatile flash_t *bp, *bpv;
     unsigned char is_locked[MAX_FLASH_BLOCKS];
-    int i, cache_on;
+#endif
 
     HAL_DCACHE_IS_ENABLED(cache_on);
     if (cache_on) {
         HAL_DCACHE_SYNC();
         HAL_DCACHE_DISABLE();
@@ -89,10 +93,18 @@ flash_unlock_block(volatile flash_t *blo
     block = FLASH_P2V(block);
 
     // Clear any error conditions
     ROM[0] = FLASH_Clear_Status;
 
+#ifdef CYGOPT_FLASH_IS_SYNCHRONOUS
+    // Clear lock bit
+    block[0] = FLASH_Clear_Locks;
+    block[0] = FLASH_Clear_Locks_Confirm;  // Confirmation
+    while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
+        if (--timeout == 0) break;
+    }
+#else
     // Get current block lock state.  This needs to access each block on
     // the device so currently locked blocks can be re-locked.
     bp = ROM;
     for (i = 0;  i < blocks;  i++) {
         bpv = FLASH_P2V( bp );
@@ -129,10 +141,11 @@ flash_unlock_block(volatile flash_t *blo
                 if (--timeout == 0) break;
             }
         }
         bp += block_size / sizeof(*bp);
     }
+#endif  // CYGOPT_FLASH_IS_SYNCHRONOUS
 
     // Restore ROM to "normal" mode
     ROM[0] = FLASH_Reset;
 
     if (cache_on) {
Index: devs/flash/intel/strata/current/src/strata.h
===================================================================
RCS file: /home/cvs/ecc/ecc/devs/flash/intel/strata/current/src/strata.h,v
retrieving revision 1.6
diff -u -p -5 -r1.6 strata.h
--- devs/flash/intel/strata/current/src/strata.h	2002/05/21 21:07:05	1.6
+++ devs/flash/intel/strata/current/src/strata.h	2002/08/12 11:56:03
@@ -59,22 +59,24 @@
 // ------------------------------------------------------------------------
 // 
 // It is expected that the above include defined all the properties of the
 // device we want to drive: the choices this module supports include:
 //
-//                                 Buffered  Read     Block
-//                                  write    query    locking
-// 28FxxxB3 - Bootblock            - no      no       no
-// 28FxxxC3 - StrataFlash          - no      yes      yes
-// 28FxxxJ3 - Advanced StrataFlash - yes     yes      yes
+//                                    Buffered  Read     Block
+//                                     write    query    locking
+// 28FxxxB3 - Bootblock               - no      no       no
+// 28FxxxC3 - StrataFlash             - no      yes      yes
+// 28FxxxJ3 - Advanced StrataFlash    - yes     yes      yes
+// 28FxxxK3 - Synchronous StrataFlash - yes     yes      yes
 // 
 // These options are controlled by defining or not, in that include file,
 // these symbols (not CDL options, just symbols - though they could be CDL
 // in future)
 //         CYGOPT_FLASH_IS_BOOTBLOCK     - for xxxB3 devices.
 //         CYGOPT_FLASH_IS_NOT_ADVANCED  - for xxxC3 devices.
-//         neither                       - for xxxJ3 devices.  
+//         CYGOPT_FLASH_IS_SYNCHRONOUS   - for xxxK3 devices.
+//         none of the above             - for xxxJ3 devices.  
 // (Advanced seems to be usual these days hence the sense of that opt)
 //
 // Other properties are controlled by these symbols:
 //         CYGNUM_FLASH_DEVICES 	number of devices across the databus
 //         CYGNUM_FLASH_WIDTH 	        number of bits in each device


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